]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
CMake: add install target
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 30 Jul 2017 12:22:39 +0000 (22:22 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 30 Jul 2017 12:22:39 +0000 (22:22 +1000)
CMakeLists.txt
contrib/CMakeLists.txt
plugins/CMakeLists.txt
radiant/CMakeLists.txt

index 065ddf1090ed4728465c0fe7f62dc1995b66e78e..6876c362b5733905ca94fcaf222588152887a12a 100644 (file)
@@ -4,6 +4,10 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
 project(NetRadiant C CXX)
 option(BUILD_RADIANT "Build the gui" ON)
 
+if (NOT CMAKE_INSTALL_PREFIX)
+    set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install")
+endif ()
+
 #-----------------------------------------------------------------------
 # Version
 #-----------------------------------------------------------------------
@@ -174,13 +178,14 @@ endif ()
 
 add_subdirectory(tools)
 
+file(GLOB DATA_FILES "${PROJECT_SOURCE_DIR}/setup/data/tools/*")
+file(GLOB DOCS_FILES "${PROJECT_SOURCE_DIR}/docs/*")
+
 if (NOT (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR))
     # Copy data files from sources to the build directory
     message(STATUS "Copying data files")
-    file(GLOB DATA_FILES "${PROJECT_SOURCE_DIR}/setup/data/tools/*")
     file(COPY ${DATA_FILES} DESTINATION "${PROJECT_BINARY_DIR}")
-    file(GLOB DATA_FILES "${PROJECT_SOURCE_DIR}/docs/*")
-    file(COPY ${DATA_FILES} DESTINATION "${PROJECT_BINARY_DIR}/docs")
+    file(COPY ${DOCS_FILES} DESTINATION "${PROJECT_BINARY_DIR}/docs")
 endif ()
 
 #-----------------------------------------------------------------------
@@ -196,3 +201,32 @@ add_custom_target(game_packs
 if (DOWNLOAD_GAMEPACKS)
     add_custom_target(game_packs_all ALL DEPENDS game_packs)
 endif ()
+
+#-----------------------------------------------------------------------
+# Install
+#-----------------------------------------------------------------------
+
+install(
+        FILES
+        "${PROJECT_BINARY_DIR}/RADIANT_MAJOR"
+        "${PROJECT_BINARY_DIR}/RADIANT_MINOR"
+        "${PROJECT_BINARY_DIR}/RADIANT_PATCH"
+        DESTINATION ${CMAKE_INSTALL_PREFIX}
+)
+file(GLOB GAME_FILES "${PROJECT_SOURCE_DIR}/games/*")
+unset(_tmp)
+foreach (it ${GAME_FILES})
+    list(APPEND _tmp "${it}/games")
+    file(GLOB GAME_DIR "${it}/*.game")
+    list(APPEND _tmp "${GAME_DIR}")
+endforeach ()
+set(GAME_FILES ${_tmp})
+
+install(
+        DIRECTORY
+        ${PROJECT_SOURCE_DIR}/setup/data/tools/
+        ${PROJECT_SOURCE_DIR}/docs
+        ${GAME_FILES}
+        DESTINATION ${CMAKE_INSTALL_PREFIX}
+)
+
index 9802014614cb89f3f5f4319eaaff4308518329c5..8233ea1e672581e7c4febfff5b58fde1b4c5f3df 100644 (file)
@@ -6,6 +6,10 @@ macro(radiant_plugin name)
     add_library(${name} MODULE ${ARGN})
     add_dependencies(plugins ${name})
     copy_dlls(${name})
+    install(
+            TARGETS ${name}
+            LIBRARY DESTINATION plugins
+    )
 endmacro()
 
 add_subdirectory(bobtoolz)
index bc9fcad327271775b40df4d48273012a01c17650..a41ed78042ae5ec2a771bb0b1f33ee783707bf5f 100644 (file)
@@ -6,6 +6,10 @@ macro(radiant_plugin name)
     add_library(${name} MODULE ${ARGN})
     add_dependencies(modules ${name})
     copy_dlls(${name})
+    install(
+            TARGETS ${name}
+            LIBRARY DESTINATION modules
+    )
 endmacro()
 
 add_subdirectory(archivepak)
index 287cc951695f4ed0b7280f20d0e4dd455b530c7e..895630638f7d626489d114d6b544e050dddbf951 100644 (file)
@@ -130,3 +130,8 @@ if (X11_LIBRARIES)
 endif ()
 
 copy_dlls(radiant)
+
+install(
+        TARGETS radiant
+        RUNTIME DESTINATION .
+)