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_LIBRARY_BIN_DIR) |
---|
38 | SET(ORXONOX_LIBRARY_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
---|
39 | ENDIF(NOT ORXONOX_LIBRARY_BIN_DIR) |
---|
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(NOT CMAKE_BUILD_TYPE) |
---|
47 | MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE) |
---|
48 | ELSE(NOT CMAKE_CONFIGURATION_TYPES) |
---|
49 | IF(CMAKE_BUILD_TYPE) |
---|
50 | SET(CMAKE_BUILD_TYPE CACHE STRING FORCE) |
---|
51 | ENDIF(CMAKE_BUILD_TYPE) |
---|
52 | MARK_AS_ADVANCED(CMAKE_BUILD_TYPE) |
---|
53 | ENDIF(NOT CMAKE_CONFIGURATION_TYPES) |
---|
54 | |
---|
55 | OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)") |
---|
56 | IF(EXTRA_WARNINGS) |
---|
57 | SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter") |
---|
58 | ELSE(EXTRA_WARNINGS) |
---|
59 | SET(ORXONOX_WARNING_FLAGS "-Wall") |
---|
60 | ENDIF(EXTRA_WARNINGS) |
---|
61 | |
---|
62 | SET(ORXONOX_MEDIA_DIRECTORY "${CMAKE_SOURCE_DIR}/../media") |
---|
63 | # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager |
---|
64 | # Render systems may be optional, but at least one has to be found in FindOgre |
---|
65 | SET(OGRE_PLUGINS_INT RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX) |
---|
66 | IF(WIN32) |
---|
67 | # CG program manager is probably DirectX related (not available under unix) |
---|
68 | LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager) |
---|
69 | ENDIF(WIN32) |
---|
70 | SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING |
---|
71 | "Specify which OGRE plugins to load. Existance check is performed.") |
---|
72 | |
---|
73 | # Check the plugins and determine the plugin folder |
---|
74 | # You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR} |
---|
75 | INCLUDE(CheckOGREPlugins) |
---|
76 | CHECK_OGRE_PLUGINS(${OGRE_PLUGINS}) |
---|
77 | |
---|
78 | |
---|
79 | ############## Compiler Config ################## |
---|
80 | INCLUDE(BuildConfigGCC) |
---|
81 | INCLUDE(BuildConfigMSVC) |
---|
82 | # User can create his own file if required |
---|
83 | IF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake) |
---|
84 | INCLUDE(${CMAKE_BINARY_DIR}/BuildConfigUser) |
---|
85 | ENDIF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake) |
---|
86 | |
---|
87 | |
---|
88 | ################ Test options ################### |
---|
89 | |
---|
90 | OPTION(ENABLE_TESTS "Enable build tests.") |
---|
91 | IF(ENABLE_TESTS) |
---|
92 | ENABLE_TESTING() |
---|
93 | ENDIF(ENABLE_TESTS) |
---|
94 | |
---|
95 | OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.") |
---|
96 | OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.") |
---|
97 | |
---|
98 | |
---|
99 | ################### Macros ###################### |
---|
100 | |
---|
101 | # Also define macros to easily extend the compiler flags |
---|
102 | # Additional argument is a condition |
---|
103 | MACRO(ADD_CXX_FLAGS _flag _cond) |
---|
104 | IF(${_cond}) |
---|
105 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}") |
---|
106 | ENDIF(${_cond}) |
---|
107 | ENDMACRO(ADD_CXX_FLAGS _flag) |
---|
108 | MACRO(ADD_C_FLAGS _flag) |
---|
109 | IF(${_cond}) |
---|
110 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}") |
---|
111 | ENDIF(${_cond}) |
---|
112 | ENDMACRO(ADD_C_FLAGS _flag) |
---|