1 | # |
---|
2 | # ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | # > www.orxonox.net < |
---|
4 | # |
---|
5 | # |
---|
6 | # License notice: |
---|
7 | # |
---|
8 | # This program is free software; you can redistribute it and/or |
---|
9 | # modify it under the terms of the GNU General Public License |
---|
10 | # as published by the Free Software Foundation; either version 2 |
---|
11 | # of the License, or (at your option) any later version. |
---|
12 | # |
---|
13 | # This program is distributed in the hope that it will be useful, |
---|
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | # GNU General Public License for more details. |
---|
17 | # |
---|
18 | # You should have received a copy of the GNU General Public License |
---|
19 | # along with this program; if not, write to the Free Software |
---|
20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | # |
---|
22 | # Author: |
---|
23 | # Reto Grieder |
---|
24 | # Co-authors: |
---|
25 | # ... |
---|
26 | # |
---|
27 | |
---|
28 | ################ Misc Options ################### |
---|
29 | |
---|
30 | # Set binary output directories |
---|
31 | SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) |
---|
32 | SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) |
---|
33 | SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) |
---|
34 | |
---|
35 | # Sets where to find the external libraries like OgreMain.dll at runtime |
---|
36 | # On Unix you should not have to change this at all. |
---|
37 | IF(NOT ORXONOX_RUNTIME_LIBRARY_DIRECTORY) |
---|
38 | SET(ORXONOX_RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
---|
39 | ENDIF() |
---|
40 | |
---|
41 | # Set Debug build to default when not having multi-config generator like msvc |
---|
42 | IF(NOT CMAKE_CONFIGURATION_TYPES) |
---|
43 | IF(NOT CMAKE_BUILD_TYPE) |
---|
44 | SET(CMAKE_BUILD_TYPE Debug CACHE STRING |
---|
45 | "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE) |
---|
46 | ENDIF() |
---|
47 | MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE) |
---|
48 | ELSE() |
---|
49 | IF(CMAKE_BUILD_TYPE) |
---|
50 | SET(CMAKE_BUILD_TYPE CACHE STRING FORCE) |
---|
51 | ENDIF() |
---|
52 | MARK_AS_ADVANCED(CMAKE_BUILD_TYPE) |
---|
53 | ENDIF() |
---|
54 | |
---|
55 | OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)") |
---|
56 | |
---|
57 | # Specify media directory |
---|
58 | GET_FILENAME_COMPONENT(_media_path "${CMAKE_SOURCE_DIR}/../media" ABSOLUTE) |
---|
59 | SET(ORXONOX_MEDIA_DIRECTORY ${_media_path} CACHE PATH |
---|
60 | "Location of the media directory.") |
---|
61 | IF(NOT EXISTS ${ORXONOX_MEDIA_DIRECTORY}) |
---|
62 | MESSAGE(STATUS "Warning: The media directory does not exist ${ORXONOX_MEDIA_DIRECTORY}") |
---|
63 | ENDIF() |
---|
64 | |
---|
65 | # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager |
---|
66 | # Render systems may be optional, but at least one has to be found in FindOgre |
---|
67 | SET(OGRE_PLUGINS_INT RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX) |
---|
68 | IF(WIN32) |
---|
69 | # CG program manager is probably DirectX related (not available under unix) |
---|
70 | LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager) |
---|
71 | ENDIF(WIN32) |
---|
72 | SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING |
---|
73 | "Specify which OGRE plugins to load. Existance check is performed.") |
---|
74 | |
---|
75 | # Check the plugins and determine the plugin folder |
---|
76 | # You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR} |
---|
77 | INCLUDE(CheckOGREPlugins) |
---|
78 | CHECK_OGRE_PLUGINS(${OGRE_PLUGINS}) |
---|
79 | |
---|
80 | |
---|
81 | ############## Compiler Config ################## |
---|
82 | |
---|
83 | INCLUDE(FlagUtilities) |
---|
84 | |
---|
85 | # Configure the compiler specific build options |
---|
86 | IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC) |
---|
87 | INCLUDE(BuildConfigGCC) |
---|
88 | ELSEIF(MSVC) |
---|
89 | INCLUDE(BuildConfigMSVC) |
---|
90 | ELSE() |
---|
91 | MESSAGE(STATUS "Warning: Your compiler is not officially supported.") |
---|
92 | ENDIF() |
---|
93 | |
---|
94 | SET(BUILD_CONFIG_USER_SCRIPT "" CACHE FILEPATH |
---|
95 | "Specify a CMake script if you wish to write your own build config. |
---|
96 | See BuildConfigGCC.cmake or BuildConfigMSVC.cmake for examples.") |
---|
97 | IF(BUILD_CONFIG_USER_SCRIPT) |
---|
98 | IF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT}.cmake) |
---|
99 | INCLUDE(${BUILD_CONFIG_USER_SCRIPT}) |
---|
100 | ELSEIF(EXISTS ${BUILD_CONFIG_USER_SCRIPT}) |
---|
101 | INCLUDE(${BUILD_CONFIG_USER_SCRIPT}) |
---|
102 | ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT}) |
---|
103 | INCLUDE(${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT}) |
---|
104 | ENDIF() |
---|
105 | ENDIF(BUILD_CONFIG_USER_SCRIPT) |
---|
106 | |
---|
107 | |
---|
108 | ################ Test options ################### |
---|
109 | |
---|
110 | OPTION(ENABLE_TESTS "Enable build tests.") |
---|
111 | IF(ENABLE_TESTS) |
---|
112 | ENABLE_TESTING() |
---|
113 | ENDIF(ENABLE_TESTS) |
---|
114 | |
---|
115 | OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.") |
---|
116 | OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.") |
---|
117 | |
---|
118 | |
---|
119 | ####### Static/Dynamic linking defines ########## |
---|
120 | |
---|
121 | # If no defines are specified, these libs get linked statically |
---|
122 | ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC) |
---|
123 | ADD_COMPILER_FLAGS("-DENET_DLL" WIN32 LINK_ENET_DYNAMIC) |
---|
124 | ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL" WIN32 LINK_LUA_DYNAMIC) |
---|
125 | ADD_COMPILER_FLAGS("-DZLIB_DLL" WIN32 LINK_ZLIB_DYNAMIC) |
---|
126 | |
---|
127 | # If no defines are specified, these libs get linked dynamically |
---|
128 | # You can change that optionally in the Cache. |
---|
129 | ADD_COMPILER_FLAGS("-DCEGUI_STATIC" WIN32 NOT LINK_CEGUI_DYNAMIC) |
---|
130 | ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB" WIN32 NOT LINK_OGRE_DYNAMIC) |
---|
131 | ADD_COMPILER_FLAGS("-DSTATIC_BUILD" WIN32 NOT LINK_TCL_DYNAMIC) |
---|