diff options
| author | Matthew Cline | 2011-07-12 17:25:27 -0700 |
|---|---|---|
| committer | Matthew Cline | 2011-07-12 17:25:27 -0700 |
| commit | a30a4a27202807f5d51b336265b2f75ffb237381 (patch) | |
| tree | f58116848ab8d34d1fada9ed9b69d4ecd04da89e | |
| parent | b5a6087da599f85ef1ab663358aa06463948d653 (diff) | |
| download | dfhack-a30a4a27202807f5d51b336265b2f75ffb237381.tar.gz dfhack-a30a4a27202807f5d51b336265b2f75ffb237381.tar.bz2 dfhack-a30a4a27202807f5d51b336265b2f75ffb237381.tar.xz | |
CMake linux: copy LD_PRELOAD script
Copy package/linux/dfhack to the games directory; it's the same as the
normal df script, but sets LD_PRELOAD properly.
Also, CMAkeLists.txt now checks to see that the output directory is set
to the game directory, and fatally fails if it isn't.
| -rw-r--r-- | CMakeLists.txt | 8 | ||||
| -rw-r--r-- | library/CMakeLists.txt | 9 | ||||
| -rwxr-xr-x | package/linux/dfhack | 13 |
3 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 93db2e81..b2484924 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,14 @@ ENDIF() SET(DFHACK_OUTPUT_DIR "${dfhack_BINARY_DIR}/bin" CACHE STRING "Where should be the produced libraries and binaries stored.") SET(DFHACK_PLUGIN_OUTPUT_DIR "${DFHACK_OUTPUT_DIR}/plugins") +IF(UNIX) + # Make sure output directory is properly set + IF (NOT EXISTS "${DFHACK_OUTPUT_DIR}/df" OR + NOT EXISTS "${DFHACK_OUTPUT_DIR}/libs/Dwarf_Fortress") + message(FATAL_ERROR "DFHACK_OUTPUT_DIR must be directory containg game") + ENDIF() +ENDIF() + ## where to put things during the build (force MSVC to behave) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${DFHACK_OUTPUT_DIR}) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${DFHACK_OUTPUT_DIR}) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 4586ef6a..25e4bb2a 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -144,6 +144,15 @@ COMMAND ${CMAKE_COMMAND} -E make_directory ${DFHACK_PLUGIN_OUTPUT_DIR} COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${DFHACK_OUTPUT_DIR}) ADD_DEPENDENCIES(dfhack prepare) +# Copy our version of the df launch script which sets LD_PRELOAD +IF(UNIX) + ADD_CUSTOM_TARGET( prepare_UNIX + DEPENDS ${dfhack_SOURCE_DIR}/package/linux/dfhack + COMMAND ${CMAKE_COMMAND} -E make_directory ${DFHACK_OUTPUT_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/package/linux/dfhack ${DFHACK_OUTPUT_DIR}) + ADD_DEPENDENCIES(dfhack prepare_UNIX) +ENDIF() + install(TARGETS dfhack LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) #linux: lib diff --git a/package/linux/dfhack b/package/linux/dfhack new file mode 100755 index 00000000..8484a3e5 --- /dev/null +++ b/package/linux/dfhack @@ -0,0 +1,13 @@ +#!/bin/sh + +# NOTE: This is dfhack's modification of the normal invocation script, +# changed to properly set LD_PRELOAD so as to run DFHACK. + +DF_DIR=$(dirname "$0") +cd "${DF_DIR}" +export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch. +#export SDL_VIDEO_CENTERED=1 # Centre the screen. Messes up resizing. + +export LD_PRELOAD=./libdfhack.so + +./libs/Dwarf_Fortress $* # Go, go, go! :) |
