Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/cmake/BuildConfig.cmake @ 2680

Last change on this file since 2680 was 2658, checked in by rgrieder, 16 years ago

rpath bugfix.

  • Property svn:eol-style set to native
File size: 6.4 KB
RevLine 
[2579]1 #
[2626]2 #             ORXONOX - the hottest 3D action shooter ever to exist
3 #                             > www.orxonox.net <
[2579]4 #
[2626]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.
[2579]9 #
[2626]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.
[2579]14 #
[2626]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.
[2579]18 #
19 #
[2626]20 #  Author:
21 #    Reto Grieder
22 #  Description:
23 #    Configures the compilers and sets build options.
24 #    This also includes handling the OGRE plugins and the media directory.
[2579]25 #
26
[2612]27################ Misc Options ###################
[2582]28
[2612]29# Set binary output directories
30SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
[2650]31SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
32SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
[2612]33
[2618]34# Sets where to find the external libraries like OgreMain.dll at runtime
35# On Unix you should not have to change this at all.
[2621]36IF(NOT ORXONOX_RUNTIME_LIBRARY_DIRECTORY)
37  SET(ORXONOX_RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
[2624]38ENDIF()
[2618]39
[2612]40# Set Debug build to default when not having multi-config generator like msvc
[2618]41IF(NOT CMAKE_CONFIGURATION_TYPES)
42  IF(NOT CMAKE_BUILD_TYPE)
43    SET(CMAKE_BUILD_TYPE Debug CACHE STRING
44        "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE)
[2624]45  ENDIF()
[2618]46  MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
[2636]47
48  MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***")
[2624]49ELSE()
[2618]50  IF(CMAKE_BUILD_TYPE)
51    SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
[2624]52  ENDIF()
[2618]53  MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
[2624]54ENDIF()
[2612]55
[2583]56OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)")
[2582]57
[2585]58# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
59# Render systems may be optional, but at least one has to be found in FindOgre
[2618]60SET(OGRE_PLUGINS_INT RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX)
[2592]61IF(WIN32)
62  # CG program manager is probably DirectX related (not available under unix)
[2618]63  LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
[2592]64ENDIF(WIN32)
[2618]65SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
66   "Specify which OGRE plugins to load. Existance check is performed.")
[2585]67
[2612]68# Check the plugins and determine the plugin folder
69# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
70INCLUDE(CheckOGREPlugins)
[2618]71CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
[2585]72
[2582]73
[2612]74############## Compiler Config ##################
[2582]75
[2621]76INCLUDE(FlagUtilities)
[2582]77
[2621]78# Configure the compiler specific build options
79IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
80  INCLUDE(BuildConfigGCC)
81ELSEIF(MSVC)
82  INCLUDE(BuildConfigMSVC)
[2624]83ELSE()
[2621]84  MESSAGE(STATUS "Warning: Your compiler is not officially supported.")
[2624]85ENDIF()
[2621]86
87SET(BUILD_CONFIG_USER_SCRIPT "" CACHE FILEPATH
88    "Specify a CMake script if you wish to write your own build config.
89     See BuildConfigGCC.cmake or BuildConfigMSVC.cmake for examples.")
90IF(BUILD_CONFIG_USER_SCRIPT)
91  IF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT}.cmake)
92    INCLUDE(${BUILD_CONFIG_USER_SCRIPT})
93  ELSEIF(EXISTS ${BUILD_CONFIG_USER_SCRIPT})
94    INCLUDE(${BUILD_CONFIG_USER_SCRIPT})
95  ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT})
96    INCLUDE(${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT})
[2624]97  ENDIF()
[2621]98ENDIF(BUILD_CONFIG_USER_SCRIPT)
99
100
[2612]101################ Test options ###################
102
103OPTION(ENABLE_TESTS "Enable build tests.")
104IF(ENABLE_TESTS)
105  ENABLE_TESTING()
106ENDIF(ENABLE_TESTS)
107
108OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
109OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
110
111
[2657]112############ Installation Settings ##############
113
114IF(UNIX)
115  SET(ORXONOX_RUNTIME_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/bin/orxonox)
116  SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox)
117  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static)
118  SET(ORXONOX_MEDIA_INSTALL_PATH   ${CMAKE_INSTALL_PREFIX}/share/orxonox)
119  SET(ORXONOX_DOC_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
120  # Not yet used
121  SET(ORXONOX_LOG_INSTALL_PATH     ~/.orxonox/log)
122  SET(ORXONOX_CONFIG_INSTALL_PATH  ~/.orxonox/config)
123ELSEIF(WIN32)
124  SET(ORXONOX_RUNTIME_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/bin)
125  SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib)
126  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/static)
127  SET(ORXONOX_MEDIA_INSTALL_PATH   ${CMAKE_INSTALL_PREFIX}/media)
128  SET(ORXONOX_DOC_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/doc)
129  # Not yet used
130  SET(ORXONOX_LOG_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/log)
131  SET(ORXONOX_CONFIG_INSTALL_PATH  ${CMAKE_INSTALL_PREFIX}/config)
132ENDIF()
133
134
[2658]135################# Unix rpath ####################
[2657]136
137# use, i.e. don't skip the full RPATH for the build tree
138SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
139
140# when building, don't use the install RPATH already
141# (but later on when installing)
142SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
143
144# the RPATH to be used when installing
[2658]145SET(CMAKE_INSTALL_RPATH ${ORXONOX_LIBRARY_INSTALL_PATH})
[2657]146
147# add the automatically determined parts of the RPATH
148# which point to directories outside the build tree to the install RPATH
149SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
150
151
[2621]152####### Static/Dynamic linking defines ##########
[2612]153
[2630]154# Disable Boost auto linking completely
155ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
156
[2621]157# If no defines are specified, these libs get linked statically
158ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
159ADD_COMPILER_FLAGS("-DENET_DLL"           WIN32 LINK_ENET_DYNAMIC)
160ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
161ADD_COMPILER_FLAGS("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
162
163# If no defines are specified, these libs get linked dynamically
164# You can change that optionally in the Cache.
165ADD_COMPILER_FLAGS("-DCEGUI_STATIC"       WIN32 NOT LINK_CEGUI_DYNAMIC)
166ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
167ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       WIN32 NOT LINK_TCL_DYNAMIC)
Note: See TracBrowser for help on using the repository browser.