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.
develop
lethosor 2015-08-06 21:50:01 -04:00
parent f46d3d137f
commit 418d2831ef
6 changed files with 28 additions and 0 deletions

3
.gitmodules vendored

@ -13,3 +13,6 @@
[submodule "depends/clsocket"] [submodule "depends/clsocket"]
path = depends/clsocket path = depends/clsocket
url = git://github.com/DFHack/clsocket.git url = git://github.com/DFHack/clsocket.git
[submodule "scripts/3rdparty/lethosor"]
path = scripts/3rdparty/lethosor
url = https://github.com/lethosor/dfhack-scripts

@ -184,6 +184,8 @@ IF(BUILD_PLUGINS)
add_subdirectory (plugins) add_subdirectory (plugins)
endif() endif()
add_subdirectory(scripts)
# Packaging with CPack! # Packaging with CPack!
IF(UNIX) IF(UNIX)
if(APPLE) if(APPLE)

@ -377,6 +377,7 @@ install(DIRECTORY ${dfhack_SOURCE_DIR}/scripts
DESTINATION ${DFHACK_DATA_DESTINATION} DESTINATION ${DFHACK_DATA_DESTINATION}
FILES_MATCHING PATTERN "*.lua" FILES_MATCHING PATTERN "*.lua"
PATTERN "*.rb" PATTERN "*.rb"
PATTERN "3rdparty" EXCLUDE
) )
install(DIRECTORY ${dfhack_SOURCE_DIR}/patches install(DIRECTORY ${dfhack_SOURCE_DIR}/patches

@ -0,0 +1 @@
Subproject commit 213826bd6feba0b16a582e0c4a74c5678ddc3be8

@ -0,0 +1,2 @@
include(Scripts.cmake)
DFHACK_3RDPARTY_SCRIPT_REPO(lethosor)

@ -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()