Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2627 was 2626, checked in by rgrieder, 16 years ago

Added license text to all CMake files except to the subdirectoties of the libraries.
Also adjusted some the Find script documentation and wrote Descriptions for every file not in src/.

  • Property svn:eol-style set to native
File size: 5.0 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 compilers and sets build options.
24 #    This also includes handling the OGRE plugins and the media directory.
25 #
26
27################ Misc Options ###################
28
29# Set binary output directories
30SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
31SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
32SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
33
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.
36IF(NOT ORXONOX_RUNTIME_LIBRARY_DIRECTORY)
37  SET(ORXONOX_RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
38ENDIF()
39
40# Set Debug build to default when not having multi-config generator like msvc
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)
45  ENDIF()
46  MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
47ELSE()
48  IF(CMAKE_BUILD_TYPE)
49    SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
50  ENDIF()
51  MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
52ENDIF()
53
54OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)")
55
56# Specify media directory
57GET_FILENAME_COMPONENT(_media_path "${CMAKE_SOURCE_DIR}/../media" ABSOLUTE)
58SET(ORXONOX_MEDIA_DIRECTORY ${_media_path} CACHE PATH
59    "Location of the media directory.")
60IF(NOT EXISTS ${ORXONOX_MEDIA_DIRECTORY})
61  MESSAGE(STATUS "Warning: The media directory does not exist ${ORXONOX_MEDIA_DIRECTORY}")
62ENDIF()
63
64# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
65# Render systems may be optional, but at least one has to be found in FindOgre
66SET(OGRE_PLUGINS_INT RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX)
67IF(WIN32)
68  # CG program manager is probably DirectX related (not available under unix)
69  LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
70ENDIF(WIN32)
71SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
72   "Specify which OGRE plugins to load. Existance check is performed.")
73
74# Check the plugins and determine the plugin folder
75# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
76INCLUDE(CheckOGREPlugins)
77CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
78
79
80############## Compiler Config ##################
81
82INCLUDE(FlagUtilities)
83
84# Configure the compiler specific build options
85IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
86  INCLUDE(BuildConfigGCC)
87ELSEIF(MSVC)
88  INCLUDE(BuildConfigMSVC)
89ELSE()
90  MESSAGE(STATUS "Warning: Your compiler is not officially supported.")
91ENDIF()
92
93SET(BUILD_CONFIG_USER_SCRIPT "" CACHE FILEPATH
94    "Specify a CMake script if you wish to write your own build config.
95     See BuildConfigGCC.cmake or BuildConfigMSVC.cmake for examples.")
96IF(BUILD_CONFIG_USER_SCRIPT)
97  IF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT}.cmake)
98    INCLUDE(${BUILD_CONFIG_USER_SCRIPT})
99  ELSEIF(EXISTS ${BUILD_CONFIG_USER_SCRIPT})
100    INCLUDE(${BUILD_CONFIG_USER_SCRIPT})
101  ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT})
102    INCLUDE(${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT})
103  ENDIF()
104ENDIF(BUILD_CONFIG_USER_SCRIPT)
105
106
107################ Test options ###################
108
109OPTION(ENABLE_TESTS "Enable build tests.")
110IF(ENABLE_TESTS)
111  ENABLE_TESTING()
112ENDIF(ENABLE_TESTS)
113
114OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
115OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
116
117
118####### Static/Dynamic linking defines ##########
119
120# If no defines are specified, these libs get linked statically
121ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
122ADD_COMPILER_FLAGS("-DENET_DLL"           WIN32 LINK_ENET_DYNAMIC)
123ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
124ADD_COMPILER_FLAGS("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
125
126# If no defines are specified, these libs get linked dynamically
127# You can change that optionally in the Cache.
128ADD_COMPILER_FLAGS("-DCEGUI_STATIC"       WIN32 NOT LINK_CEGUI_DYNAMIC)
129ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
130ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       WIN32 NOT LINK_TCL_DYNAMIC)
Note: See TracBrowser for help on using the repository browser.