1 add_subdirectory(baseset)
6 add_library(openttd::media ALIAS media)
12 set(MEDIA_PNG_SOURCE_FILES
13 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.16.png
14 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.32.png
15 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.48.png
16 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.64.png
17 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.128.png
18 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.256.png
21 # Walk over all the png files, and generate a command to copy them
22 foreach(MEDIA_PNG_SOURCE_FILE IN LISTS MEDIA_PNG_SOURCE_FILES)
23 get_filename_component(MEDIA_PNG_FILE_NAME "${MEDIA_PNG_SOURCE_FILE}" NAME)
24 string(REGEX REPLACE "[^.]+.([0-9]*).*" "${CMAKE_CURRENT_BINARY_DIR}/icons/hicolor/\\1x\\1/apps/${BINARY_NAME}.png" MEDIA_PNG_BINARY_FILE "${MEDIA_PNG_FILE_NAME}")
26 add_custom_command(OUTPUT ${MEDIA_PNG_BINARY_FILE}
27 COMMAND ${CMAKE_COMMAND} -E copy
28 ${MEDIA_PNG_SOURCE_FILE}
29 ${MEDIA_PNG_BINARY_FILE}
30 MAIN_DEPENDENCY ${MEDIA_PNG_SOURCE_FILE}
31 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
32 COMMENT "Copying ${MEDIA_PNG_FILE_NAME} file"
35 list(APPEND MEDIA_BINARY_FILES ${MEDIA_PNG_BINARY_FILE})
38 set(MEDIA_XPM_SOURCE_FILES
39 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.32.xpm
40 ${CMAKE_CURRENT_SOURCE_DIR}/openttd.64.xpm
43 # Walk over all the xpm files, and generate a command to copy them
44 foreach(MEDIA_XPM_SOURCE_FILE IN LISTS MEDIA_XPM_SOURCE_FILES)
45 get_filename_component(MEDIA_XPM_FILE_NAME "${MEDIA_XPM_SOURCE_FILE}" NAME)
46 get_filename_component(MEDIA_XPM_FILE_EXT "${MEDIA_XPM_FILE_NAME}" EXT)
47 set(MEDIA_XPM_BINARY_FILE "${CMAKE_CURRENT_BINARY_DIR}/pixmaps/${BINARY_NAME}${MEDIA_XPM_FILE_EXT}")
49 add_custom_command(OUTPUT ${MEDIA_XPM_BINARY_FILE}
50 COMMAND ${CMAKE_COMMAND} -E copy
51 ${MEDIA_XPM_SOURCE_FILE}
52 ${MEDIA_XPM_BINARY_FILE}
53 MAIN_DEPENDENCY ${MEDIA_XPM_SOURCE_FILE}
54 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
55 COMMENT "Copying ${MEDIA_XPM_FILE_NAME} file"
58 list(APPEND MEDIA_BINARY_FILES ${MEDIA_XPM_BINARY_FILE})
61 # Create a new target which copies media files
62 add_custom_target(media_files
67 add_dependencies(media
71 get_target_property(LANG_SOURCE_FILES language_files LANG_SOURCE_FILES)
73 set(DESKTOP_BINARY_NAME ${BINARY_NAME}.desktop)
75 add_custom_command_timestamp(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_BINARY_NAME}
76 COMMAND ${CMAKE_COMMAND}
77 -DDESKTOP_SOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/openttd.desktop
78 -DDESKTOP_BINARY_FILE=${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_BINARY_NAME}
79 -DBINARY_NAME=${BINARY_NAME}
80 -P ${CMAKE_SOURCE_DIR}/cmake/scripts/Desktop.cmake
83 MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/openttd.desktop
84 DEPENDS ${LANG_SOURCE_FILES}
85 ${CMAKE_SOURCE_DIR}/cmake/scripts/Desktop.cmake
86 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
87 COMMENT "Generating desktop file"
90 # Create a new target which generates desktop file
91 add_custom_target_timestamp(desktop_file
93 ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_BINARY_NAME}
96 add_dependencies(media