1 add_subdirectory(openttd)
2 add_subdirectory(orig_extra)
4 set(BASESET_SOURCE_FILES
5 ${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obg
6 ${CMAKE_CURRENT_SOURCE_DIR}/orig_dos_de.obg
7 ${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obg
8 ${CMAKE_CURRENT_SOURCE_DIR}/no_music.obm
9 ${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obm
10 ${CMAKE_CURRENT_SOURCE_DIR}/orig_tto.obm
11 ${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obm
12 ${CMAKE_CURRENT_SOURCE_DIR}/no_sound.obs
13 ${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obs
14 ${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obs
16 set(BASESET_OTHER_SOURCE_FILES
17 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.grf
18 ${CMAKE_CURRENT_SOURCE_DIR}/opntitle.dat
19 ${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf
20 ${CMAKE_CURRENT_SOURCE_DIR}/../openttd.32.bmp
21 ${CMAKE_CURRENT_SOURCE_DIR}/OpenTTD-Sans.ttf
22 ${CMAKE_CURRENT_SOURCE_DIR}/OpenTTD-Serif.ttf
23 ${CMAKE_CURRENT_SOURCE_DIR}/OpenTTD-Small.ttf
24 ${CMAKE_CURRENT_SOURCE_DIR}/OpenTTD-Mono.ttf
27 # Done by the subdirectories, if nforenum / grfcodec is installed
29 set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/openttd.grf PROPERTIES GENERATED TRUE)
30 set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf PROPERTIES GENERATED TRUE)
32 list(APPEND BASESET_BINARY_FILES openttd.grf)
33 list(APPEND BASESET_BINARY_FILES orig_extra.grf)
36 set(BASESET_EXTRAGRF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf)
38 # Walk over all the baseset files, and generate a command to configure them
39 foreach(BASESET_SOURCE_FILE IN LISTS BASESET_SOURCE_FILES)
40 get_filename_component(BASESET_SOURCE_FILE_NAME "${BASESET_SOURCE_FILE}" NAME)
41 set(BASESET_BINARY_FILE "${CMAKE_BINARY_DIR}/baseset/${BASESET_SOURCE_FILE_NAME}")
43 get_target_property(LANG_SOURCE_FILES language_files LANG_SOURCE_FILES)
45 add_custom_command_timestamp(OUTPUT ${BASESET_BINARY_FILE}
46 COMMAND ${CMAKE_COMMAND}
47 -DBASESET_SOURCE_FILE=${BASESET_SOURCE_FILE}
48 -DBASESET_BINARY_FILE=${BASESET_BINARY_FILE}
49 -DBASESET_EXTRAGRF_FILE=${BASESET_EXTRAGRF_FILE}
50 -P ${CMAKE_SOURCE_DIR}/cmake/scripts/Baseset.cmake
53 MAIN_DEPENDENCY ${BASESET_SOURCE_FILE}
54 DEPENDS ${LANG_SOURCE_FILES}
55 ${BASESET_EXTRAGRF_FILE}
56 ${BASESET_EXTRAGRF_FILE}.hash
57 ${CMAKE_SOURCE_DIR}/cmake/scripts/Baseset.cmake
58 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
59 COMMENT "Generating ${BASESET_SOURCE_FILE_NAME} baseset metadata file"
62 list(APPEND BASESET_BINARY_FILES ${BASESET_BINARY_FILE})
65 # Walk over all the other baseset files, and generate a command to copy them
66 foreach(BASESET_OTHER_SOURCE_FILE IN LISTS BASESET_OTHER_SOURCE_FILES)
67 get_filename_component(BASESET_OTHER_SOURCE_FILE_NAME "${BASESET_OTHER_SOURCE_FILE}" NAME)
68 set(BASESET_OTHER_BINARY_FILE "${CMAKE_BINARY_DIR}/baseset/${BASESET_OTHER_SOURCE_FILE_NAME}")
70 add_custom_command_timestamp(OUTPUT ${BASESET_OTHER_BINARY_FILE}
71 COMMAND ${CMAKE_COMMAND} -E copy
72 ${BASESET_OTHER_SOURCE_FILE}
73 ${BASESET_OTHER_BINARY_FILE}
74 MAIN_DEPENDENCY ${BASESET_OTHER_SOURCE_FILE}
75 COMMENT "Copying ${BASESET_OTHER_SOURCE_FILE_NAME} baseset file"
78 list(APPEND BASESET_BINARY_FILES ${BASESET_OTHER_BINARY_FILE})
81 # Create a new target which generates all baseset metadata files
82 add_custom_target_timestamp(baseset_files
84 ${BASESET_BINARY_FILES}
90 add_dependencies(basesets
93 add_library(openttd::basesets ALIAS basesets)