Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/mac_HS16/cmake/InstallConfig.cmake @ 12412

Last change on this file since 12412 was 10624, checked in by landauf, 9 years ago

merged branch core7 back to trunk

  • Property svn:eol-style set to native
File size: 4.6 KB
Line 
1 #
2 #             ORXONOX - the hottest 3D action shooter ever to exist
3 #                             > www.orxonox.net <
4 #
5 #        This program is free software; you can redistribute it and/or
6 #         modify it under the terms of the GNU General Public License
7 #        as published by the Free Software Foundation; either version 2
8 #            of the License, or (at your option) any later version.
9 #
10 #       This program is distributed in the hope that it will be useful,
11 #        but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #                 GNU General Public License for more details.
14 #
15 #   You should have received a copy of the GNU General Public License along
16 #      with this program; if not, write to the Free Software Foundation,
17 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 #
19 #
20 #  Author:
21 #    Reto Grieder
22 #  Description:
23 #    Configures the installation (paths, rpaths, options)
24 #
25
26IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # Variable provided by CMake
27  IF("$ENV{ORXONOX_DEV}" OR TARDIS)
28    SET(_install_prefix_changed 1)
29    SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH
30        "Install path prefix, prepended onto install directories." FORCE)
31  ENDIF()
32ENDIF()
33
34SET(_info_text "Puts all installed files in subfolders of the install prefix path. That root folder can then be moved, copied and renamed as you wish. The executable will not write to folders like ~/.orxonox or \"Applictation Data\"")
35IF(UNIX AND NOT _install_prefix_changed)
36  OPTION(INSTALL_COPYABLE "${_info_text}" FALSE)
37ELSE()
38  OPTION(INSTALL_COPYABLE "${_info_text}" TRUE)
39ENDIF()
40
41IF(MSVC)
42  # Allow developers to install the debug symbols as well (safes the copying)
43  OPTION(INSTALL_PDB_FILES "Also installs the debug symbol files" FALSE)
44ENDIF()
45
46# Default relative installation paths
47SET(RUNTIME_INSTALL_DIRECTORY ${DEFAULT_RUNTIME_PATH})
48SET(LIBRARY_INSTALL_DIRECTORY ${DEFAULT_LIBRARY_PATH})
49SET(ARCHIVE_INSTALL_DIRECTORY ${DEFAULT_ARCHIVE_PATH})
50SET(MODULE_INSTALL_DIRECTORY  ${DEFAULT_MODULE_PATH})
51SET(PLUGIN_INSTALL_DIRECTORY  ${DEFAULT_PLUGIN_PATH})
52SET(DOC_INSTALL_DIRECTORY     ${DEFAULT_DOC_PATH})
53SET(DATA_INSTALL_DIRECTORY    ${DEFAULT_DATA_PATH})
54SET(CONFIG_INSTALL_DIRECTORY  ${DEFAULT_CONFIG_PATH})
55SET(LOG_INSTALL_DIRECTORY     ${DEFAULT_LOG_PATH})
56
57IF(NOT INSTALL_COPYABLE)
58  IF(LINUX)
59    # Using absolute paths
60    SET(RUNTIME_INSTALL_DIRECTORY games)
61    SET(LIBRARY_INSTALL_DIRECTORY lib/games/orxonox)
62    SET(ARCHIVE_INSTALL_DIRECTORY lib/games/orxonox/static)
63    SET(MODULE_INSTALL_DIRECTORY  lib/games/orxonox/modules)
64    SET(PLUGIN_INSTALL_DIRECTORY  lib/games/orxonox/plugins)
65    SET(DOC_INSTALL_DIRECTORY     share/doc/orxonox)
66    SET(DATA_INSTALL_DIRECTORY    share/games/orxonox)
67  ELSEIF(WIN32)
68    # Leave on default (installs to only one location anyway)
69  ELSEIF(APPLE)
70    # TODO: Figure out what's the best way to install the application
71  ENDIF()
72
73  # Leave empty because it is user and therefore runtime dependent
74  SET(CONFIG_INSTALL_DIRECTORY)
75  SET(LOG_INSTALL_DIRECTORY)
76ENDIF()
77
78################## Unix rpath ###################
79
80# Use, i.e. don't skip the full RPATH for the build tree
81SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
82
83# When building, don't use the install RPATH already
84# (but later on when installing)
85SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
86
87# The RPATH to be used when installing
88IF(INSTALL_COPYABLE)
89  # Get relative paths from run to lib and from module/plugin to lib directory.
90  FILE(RELATIVE_PATH _runtime_rpath "/${RUNTIME_INSTALL_DIRECTORY}" "/${LIBRARY_INSTALL_DIRECTORY}")
91  FILE(RELATIVE_PATH _module_rpath  "/${MODULE_INSTALL_DIRECTORY}" "/${LIBRARY_INSTALL_DIRECTORY}")
92  FILE(RELATIVE_PATH _plugin_rpath  "/${PLUGIN_INSTALL_DIRECTORY}" "/${LIBRARY_INSTALL_DIRECTORY}")
93  # $ORIGIN (with $ escaped) refers to the actual location of the library
94  # The UNIX loader recognises this special variable
95  SET(RUNTIME_RPATH "\$ORIGIN/${_runtime_rpath}")
96  SET(LIBRARY_RPATH "\$ORIGIN")
97  SET(MODULE_RPATH  "\$ORIGIN:\$ORIGIN/${_module_rpath}")
98  SET(PLUGIN_RPATH  "\$ORIGIN:\$ORIGIN/${_plugin_rpath}")
99ELSE()
100  SET(RUNTIME_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY}")
101  SET(LIBRARY_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY}")
102  SET(MODULE_RPATH  "${LIBRARY_RPATH}:${CMAKE_INSTALL_PREFIX}/${MODULE_INSTALL_DIRECTORY}")
103  SET(PLUGIN_RPATH  "${LIBRARY_RPATH}:${CMAKE_INSTALL_PREFIX}/${PLUGIN_INSTALL_DIRECTORY}")
104ENDIF()
105
106# Add the automatically determined parts of the RPATH
107# which point to directories outside the build tree to the install RPATH
108SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Note: See TracBrowser for help on using the repository browser.