From 7099a084c7a7438a5f6ce34a2aca7ee5fa62ae7e Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sun, 17 Jan 2010 09:00:55 +0100 Subject: Add an "install" target. --- .gitignore | 3 ++- CMakeLists.txt | 17 +++++++++++++++++ building.txt | 43 +++++++++++++++++++++++++++++++++++++++++++ lib/CMakeLists.txt | 26 ++++++++++++++++++++++++++ src/CMakeLists.txt | 5 +++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 building.txt create mode 100644 lib/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 7d02029f..d7793155 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ CMakeFiles CMakeCache.txt cmake_install.cmake -Makefile \ No newline at end of file +install_manifest.txt +Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index 147e39b2..a6b9aba2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ PROJECT (tome2) CMAKE_MINIMUM_REQUIRED (VERSION 2.6) +# We want a readable feature summary. +INCLUDE(FeatureSummary) + # Default flags. IF(CMAKE_COMPILER_IS_GNUCC) # Let's set sensible options. @@ -62,5 +65,19 @@ IF(CURSES_FOUND) SET(LIBS ${LIBS} ${CURSES_LIBRARIES}) ENDIF() +# +# Set the path for loading the library bits. +# +IF(SYSTEM_INSTALL) + SET(DEFAULT_PATH "${CMAKE_INSTALL_PREFIX}/lib/tome") +ELSE() + SET(DEFAULT_PATH "./lib") +ENDIF() +ADD_DEFINITIONS(-DDEFAULT_PATH="${DEFAULT_PATH}") + +# Print out a summary of features. +PRINT_ENABLED_FEATURES() + # Add the source subdirectory. ADD_SUBDIRECTORY (src) +ADD_SUBDIRECTORY (lib) diff --git a/building.txt b/building.txt new file mode 100644 index 00000000..274e235c --- /dev/null +++ b/building.txt @@ -0,0 +1,43 @@ +Using the CMake build system +============================ + +There are basically two options for how to run ToME once built. + + + +Option #1 : Run ToME from the build directory +============================================= + +Simply run the commands below. + + $ cmake . + $ make + +You should now be able to run + + $ ./src/tome2 + +to start ToME. + +This is currently the recommended option. + + + +Option #2: Run ToME from a system install location +================================================== + +Run + + $ cmake -DSYSTEM_INSTALL:BOOL=true . + $ make + $ sudo make install + +You can now run ToME from anywhere. + +NOTE: The user running ToME must have write access to the +install location's lib/data subdirectory for the first run. +(This is because the *.raw files will be generated the first +time ToME is run.) + +You can also use DESTDIR when installing to install into a different +location (useful with e.g. stow or when building distribution packages). diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 00000000..acb87b25 --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,26 @@ +INSTALL(FILES + module.lua + DESTINATION ${DEFAULT_PATH} +) +INSTALL(DIRECTORY + apex + cmov + core + data + dngn + edit + file + help + info + mods + note + plot + pref + save + scpt + user + xtra + DESTINATION ${DEFAULT_PATH} + PATTERN "*.raw" EXCLUDE + PATTERN "delete.me" EXCLUDE + ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 68c6a92b..e3e04b0e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,3 +43,8 @@ ADD_EXECUTABLE(tome main-gcu.c main-x11.c main-xaw.c main-sdl.c w_obj.c w_util.c w_spells.c w_quest.c w_dun.c ) TARGET_LINK_LIBRARIES(tome lua ${LIBS}) + +# Installation +INSTALL(TARGETS tome + RUNTIME DESTINATION bin +) -- cgit v1.2.3