summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorLoïc Guilloux <glx22@users.noreply.github.com>2021-04-02 10:15:45 +0200
committerGitHub <noreply@github.com>2021-04-02 10:15:45 +0200
commit799eb31ff199745888ffecf76a37e0d7cce437dd (patch)
treebb0ee0ee1b644d15d9883367c82ed645ebed63f8 /bin
parente760c9fbec7ab4f0637662bd299369de6dee3db2 (diff)
downloadopenttd-799eb31ff199745888ffecf76a37e0d7cce437dd.tar.xz
Change: [CMake] Copy AI/GS compatibility files to build dir (#8906)
Diffstat (limited to 'bin')
-rw-r--r--bin/CMakeLists.txt2
-rw-r--r--bin/ai/CMakeLists.txt40
-rw-r--r--bin/game/CMakeLists.txt37
3 files changed, 79 insertions, 0 deletions
diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt
new file mode 100644
index 000000000..9d75bc0ee
--- /dev/null
+++ b/bin/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(ai)
+add_subdirectory(game)
diff --git a/bin/ai/CMakeLists.txt b/bin/ai/CMakeLists.txt
new file mode 100644
index 000000000..83eb11962
--- /dev/null
+++ b/bin/ai/CMakeLists.txt
@@ -0,0 +1,40 @@
+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
+)
diff --git a/bin/game/CMakeLists.txt b/bin/game/CMakeLists.txt
new file mode 100644
index 000000000..508254e1f
--- /dev/null
+++ b/bin/game/CMakeLists.txt
@@ -0,0 +1,37 @@
+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
+)