Changeset - r25109:3ff77dcc2f0b
[Not reviewed]
master
0 2 3
Loïc Guilloux - 4 years ago 2021-04-02 08:15:45
glx22@users.noreply.github.com
Change: [CMake] Copy AI/GS compatibility files to build dir (#8906)
5 files changed with 83 insertions and 3 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
@@ -220,6 +220,7 @@ if(MSVC)
 
    target_sources(openttd PRIVATE "${CMAKE_SOURCE_DIR}/os/windows/openttd.manifest")
 
endif()
 

	
 
add_subdirectory(${CMAKE_SOURCE_DIR}/bin)
 
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
 
add_subdirectory(${CMAKE_SOURCE_DIR}/media)
 

	
 
@@ -240,7 +241,7 @@ if(IPO_FOUND)
 
    set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True)
 
    set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True)
 
endif()
 
set_target_properties(openttd PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
 
set_target_properties(openttd PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
 
process_compile_flags()
 

	
 
include(LinkPackage)
bin/CMakeLists.txt
Show inline comments
 
new file 100644
 
add_subdirectory(ai)
 
add_subdirectory(game)
bin/ai/CMakeLists.txt
Show inline comments
 
new file 100644
 
set(AI_COMPAT_SOURCE_FILES
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_0.7.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.0.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.1.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.2.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.3.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.4.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.5.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.6.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.7.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.8.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.9.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.10.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.11.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.12.nut
 
)
 

	
 
foreach(AI_COMPAT_SOURCE_FILE IN LISTS AI_COMPAT_SOURCE_FILES)
 
    string(REPLACE "${CMAKE_SOURCE_DIR}/bin/" "" AI_COMPAT_SOURCE_FILE_NAME "${AI_COMPAT_SOURCE_FILE}")
 
    string(CONCAT AI_COMPAT_BINARY_FILE "${CMAKE_BINARY_DIR}/" "${AI_COMPAT_SOURCE_FILE_NAME}")
 

	
 
    add_custom_command(OUTPUT ${AI_COMPAT_BINARY_FILE}
 
            COMMAND ${CMAKE_COMMAND} -E copy
 
                    ${AI_COMPAT_SOURCE_FILE}
 
                    ${AI_COMPAT_BINARY_FILE}
 
            MAIN_DEPENDENCY ${AI_COMPAT_SOURCE_FILE}
 
            COMMENT "Copying ${AI_COMPAT_SOURCE_FILE_NAME}"
 
    )
 

	
 
    list(APPEND AI_COMPAT_BINARY_FILES ${AI_COMPAT_BINARY_FILE})
 
endforeach()
 

	
 
# Create a new target which copies all compat files
 
add_custom_target(ai_compat_files
 
        DEPENDS ${AI_COMPAT_BINARY_FILES}
 
)
 

	
 
add_dependencies(openttd
 
    ai_compat_files
 
)
bin/game/CMakeLists.txt
Show inline comments
 
new file 100644
 
set(GS_COMPAT_SOURCE_FILES
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.2.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.3.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.4.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.5.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.6.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.7.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.8.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.9.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.10.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.11.nut
 
	${CMAKE_CURRENT_SOURCE_DIR}/compat_1.12.nut
 
)
 

	
 
foreach(GS_COMPAT_SOURCE_FILE IN LISTS GS_COMPAT_SOURCE_FILES)
 
    string(REPLACE "${CMAKE_SOURCE_DIR}/bin/" "" GS_COMPAT_SOURCE_FILE_NAME "${GS_COMPAT_SOURCE_FILE}")
 
    string(CONCAT GS_COMPAT_BINARY_FILE "${CMAKE_BINARY_DIR}/" "${GS_COMPAT_SOURCE_FILE_NAME}")
 

	
 
    add_custom_command(OUTPUT ${GS_COMPAT_BINARY_FILE}
 
            COMMAND ${CMAKE_COMMAND} -E copy
 
                    ${GS_COMPAT_SOURCE_FILE}
 
                    ${GS_COMPAT_BINARY_FILE}
 
            MAIN_DEPENDENCY ${GS_COMPAT_SOURCE_FILE}
 
            COMMENT "Copying ${GS_COMPAT_SOURCE_FILE_NAME}"
 
    )
 

	
 
    list(APPEND GS_COMPAT_BINARY_FILES ${GS_COMPAT_BINARY_FILE})
 
endforeach()
 

	
 
# Create a new target which copies all compat files
 
add_custom_target(gs_compat_files
 
        DEPENDS ${GS_COMPAT_BINARY_FILES}
 
)
 

	
 
add_dependencies(openttd
 
    gs_compat_files
 
)
cmake/InstallAndPackage.cmake
Show inline comments
 
@@ -26,8 +26,8 @@ install(TARGETS openttd
 
install(DIRECTORY
 
                ${CMAKE_BINARY_DIR}/lang
 
                ${CMAKE_BINARY_DIR}/baseset
 
                ${CMAKE_SOURCE_DIR}/bin/ai
 
                ${CMAKE_SOURCE_DIR}/bin/game
 
                ${CMAKE_BINARY_DIR}/ai
 
                ${CMAKE_BINARY_DIR}/game
 
                ${CMAKE_SOURCE_DIR}/bin/scripts
 
        DESTINATION ${DATA_DESTINATION_DIR}
 
        COMPONENT language_files)
0 comments (0 inline, 0 general)