From 418d2831ef8fcf24e33d0889d04449e7dc8ab891 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2015 21:50:01 -0400 Subject: [PATCH 1/2] Add a framework for including 3rd-party script repos Repos need to include a CMakeLists.txt file with calls to the DFHACK_SCRIPTS macro, which functions similarly to DFHACK_PLUGIN. The `open-legends` script from lethosor/dfhack-scripts is included as an example. --- .gitmodules | 3 +++ CMakeLists.txt | 2 ++ library/CMakeLists.txt | 1 + scripts/3rdparty/lethosor | 1 + scripts/CMakeLists.txt | 2 ++ scripts/Scripts.cmake | 19 +++++++++++++++++++ 6 files changed, 28 insertions(+) create mode 160000 scripts/3rdparty/lethosor create mode 100644 scripts/CMakeLists.txt create mode 100644 scripts/Scripts.cmake diff --git a/.gitmodules b/.gitmodules index b20d189ec..275772e0e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "depends/clsocket"] path = depends/clsocket url = git://github.com/DFHack/clsocket.git +[submodule "scripts/3rdparty/lethosor"] + path = scripts/3rdparty/lethosor + url = https://github.com/lethosor/dfhack-scripts diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a8dabd13..50fca68f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,8 @@ IF(BUILD_PLUGINS) add_subdirectory (plugins) endif() +add_subdirectory(scripts) + # Packaging with CPack! IF(UNIX) if(APPLE) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 270948e1a..73d6188a3 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -377,6 +377,7 @@ install(DIRECTORY ${dfhack_SOURCE_DIR}/scripts DESTINATION ${DFHACK_DATA_DESTINATION} FILES_MATCHING PATTERN "*.lua" PATTERN "*.rb" + PATTERN "3rdparty" EXCLUDE ) install(DIRECTORY ${dfhack_SOURCE_DIR}/patches diff --git a/scripts/3rdparty/lethosor b/scripts/3rdparty/lethosor new file mode 160000 index 000000000..213826bd6 --- /dev/null +++ b/scripts/3rdparty/lethosor @@ -0,0 +1 @@ +Subproject commit 213826bd6feba0b16a582e0c4a74c5678ddc3be8 diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt new file mode 100644 index 000000000..ed5cc1ffc --- /dev/null +++ b/scripts/CMakeLists.txt @@ -0,0 +1,2 @@ +include(Scripts.cmake) +DFHACK_3RDPARTY_SCRIPT_REPO(lethosor) diff --git a/scripts/Scripts.cmake b/scripts/Scripts.cmake new file mode 100644 index 000000000..8ef0d1161 --- /dev/null +++ b/scripts/Scripts.cmake @@ -0,0 +1,19 @@ +include(../plugins/Plugins.cmake) + +MACRO(DFHACK_SCRIPTS) + PARSE_ARGUMENTS(SCRIPT + "SUBDIRECTORY" + "SOME_OPT" + ${ARGN} + ) + CAR(SCRIPT_SUBDIRECTORY ${SCRIPT_SUBDIRECTORY}) + install(FILES ${SCRIPT_DEFAULT_ARGS} + DESTINATION ${DFHACK_DATA_DESTINATION}/scripts/${SCRIPT_SUBDIRECTORY}) +ENDMACRO() + +MACRO(DFHACK_3RDPARTY_SCRIPT_REPO repo_path) + if(NOT EXISTS ${dfhack_SOURCE_DIR}/scripts/3rdparty/${repo_path}/CMakeLists.txt) + MESSAGE(FATAL_ERROR "Script submodule scripts/3rdparty/${repo_path} does not exist - run `git submodule update`.") + endif() + add_subdirectory(3rdparty/${repo_path}) +ENDMACRO() From 9a58332aedcb1b1eb655766ca990583e9fa08ef5 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2015 21:59:33 -0400 Subject: [PATCH 2/2] Update lethosor/dfhack-scripts submodule (whitespace) --- scripts/3rdparty/lethosor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/3rdparty/lethosor b/scripts/3rdparty/lethosor index 213826bd6..ceed207e3 160000 --- a/scripts/3rdparty/lethosor +++ b/scripts/3rdparty/lethosor @@ -1 +1 @@ -Subproject commit 213826bd6feba0b16a582e0c4a74c5678ddc3be8 +Subproject commit ceed207e38220e21067a91b8d6f7b9680a476f69