Changeset - r28239:06e097282a44
[Not reviewed]
master
0 3 0
Loïc Guilloux - 12 months ago 2023-12-04 16:41:02
glx22@users.noreply.github.com
Change: [CMake] Use explicit list for grf source files (#11539)
3 files changed with 72 insertions and 10 deletions:
0 comments (0 inline, 0 general)
cmake/CreateGrfCommand.cmake
Show inline comments
 
# Macro which contains all bits and pieces to create a single grf file based
 
# on NFO and PNG files.
 
#
 
# create_grf_command()
 
# create_grf_command(NFO_SOURCE_FILES nfo_file1 ... PNG_SOURCE_FILES png_file1 ...)
 
#
 
function(create_grf_command)
 
    set(EXTRA_PNG_SOURCE_FILES ${ARGV})
 
    cmake_parse_arguments(GRF "" "" "NFO_SOURCE_FILES;PNG_SOURCE_FILES" ${ARGN})
 

	
 
    get_filename_component(GRF_SOURCE_FOLDER_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
 
    get_filename_component(GRF_BINARY_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../${GRF_SOURCE_FOLDER_NAME}.grf ABSOLUTE)
 
    file(GLOB_RECURSE GRF_PNG_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.png)
 
    file(GLOB_RECURSE GRF_NFO_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nfo)
 
    set(GRF_PNG_SOURCE_FILES ${GRF_PNG_SOURCE_FILES} ${EXTRA_PNG_SOURCE_FILES})
 

	
 
    # Copy over all the PNG files to the correct folder
 
    foreach(GRF_PNG_SOURCE_FILE IN LISTS GRF_PNG_SOURCE_FILES)
 
        get_filename_component(GRF_PNG_SOURCE_FILE_NAME "${GRF_PNG_SOURCE_FILE}" NAME)
 
        set(GRF_PNG_BINARY_FILE "${CMAKE_CURRENT_BINARY_DIR}/sprites/${GRF_PNG_SOURCE_FILE_NAME}")
 

	
media/baseset/openttd/CMakeLists.txt
Show inline comments
 
@@ -2,8 +2,50 @@
 
# Otherwise, just use them from the cache (read: git).
 
# This is mainly because not many people have both of these tools installed,
 
# so it is cheaper to cache them in git, and only regenerate when you are
 
# working on it / have the tools installed.
 
if(GRFCODEC_FOUND)
 
    include(CreateGrfCommand)
 
    create_grf_command()
 
    create_grf_command(
 
        NFO_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/airports.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/airport_preview.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/aqueduct.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/autorail.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/canals.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/chars.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/elrails.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/foundations.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/mono.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/oneway.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/openttd.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/openttdgui.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/palette.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/roadstops.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/signals.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/sloped_tracks.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/tramtracks.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/tunnel_portals.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/2ccmap.nfo
 
        PNG_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/airports.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/airport_preview.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/aqueduct.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/autorail.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/canals.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/canal_locks.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/chars.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/elrails.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/foundations.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/mono.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/oneway.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/openttdgui.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/openttdgui_build_tram.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/openttdgui_convert_road.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/openttdgui_convert_tram.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/openttdgui_group_livery.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/roadstops.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/signals.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/sloped_tracks.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/tramtracks.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/tramtracks_bare_depot.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/tunnel_portals.png
 
    )
 
endif()
media/baseset/orig_extra/CMakeLists.txt
Show inline comments
 
@@ -3,12 +3,35 @@
 
# This is mainly because not many people have both of these tools installed,
 
# so it is cheaper to cache them in git, and only regenerate when you are
 
# working on it / have the tools installed.
 
if(GRFCODEC_FOUND)
 
    include(CreateGrfCommand)
 
    create_grf_command(
 
        # We share some files with 'openttd' grf
 
        ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/airports.png
 
        ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/canals.png
 
        ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/chars.png
 
        NFO_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rivers/arctic.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/rapids.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/temperate.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/toyland.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/tropic.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/airports_orig_extra.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/canals_extra.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/chars_orig_extra.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/fix_graphics.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/fix_gui_icons.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.nfo
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/shore.nfo
 
        PNG_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rivers/arctic_brown.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/arctic_snowy.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/rapids.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/rapids_shading.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/temperate.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/toyland.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/tropic_desert.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/rivers/tropic_forest.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/fix_graphics.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/fix_gui_icons.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/shore.png
 
                         # We share some files with 'openttd' grf
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/airports.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/canals.png
 
                         ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/chars.png
 
    )
 
endif()
0 comments (0 inline, 0 general)