summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2010-01-17 09:00:55 +0100
committerBardur Arantsson <bardur@scientician.net>2010-01-17 10:01:50 +0100
commit7099a084c7a7438a5f6ce34a2aca7ee5fa62ae7e (patch)
treed6450cf4411db52aed97309577448160aaa01cdc
parentf643e0f1a98f06dee9e0bd7973e4549deae9ddb9 (diff)
Add an "install" target.
-rw-r--r--.gitignore3
-rw-r--r--CMakeLists.txt17
-rw-r--r--building.txt43
-rw-r--r--lib/CMakeLists.txt26
-rw-r--r--src/CMakeLists.txt5
5 files changed, 93 insertions, 1 deletions
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
+)