Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2616 was 2612, checked in by rgrieder, 16 years ago

Rearranged CMake configuration code. I split serveral files in two and moved some code around.
There are no actual code changes!

Details:

  • Everything that involves library finding is in LibraryConfig.cmake. It includes other LibraryConfigXXX.cmake files that set specific options for certain platforms or package configurations (like MSVC or MinGW dependency package).
  • All build related code is in BuildConfig.cmake. The actual compiler configuration is done in BuildConfigXXX.cmake where XXX can be GCC or MSVC.
  • The changes above implied splitting FindOGRE.cmake in two (was going to do it anyway, but rather in a later commit) so that CheckOGREPlugins.cmake is now a separate module.
  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
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
31SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
32SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
33SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
34
35# Set Debug build to default when not having multi-config generator like msvc
36IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
37  SET(CMAKE_BUILD_TYPE "Debug")
38ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
39
40# When searching for debug libraries, this is appended to the libarary name
41SET(LIBRARY_DEBUG_POSTFIX "_d")
42# Sets where to find the binary directory of external libraries
43SET(ORXONOX_LIBRARY_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
44# Working directory for the tolua parser. Adjust for windows because lua.dll has to be there!
45SET(TOLUA_PARSER_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
46
47OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)")
48IF(EXTRA_WARNINGS)
49  SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter")
50ELSE(EXTRA_WARNINGS)
51  SET(ORXONOX_WARNING_FLAGS "-Wall")
52ENDIF(EXTRA_WARNINGS)
53
54SET(ORXONOX_MEDIA_DIRECTORY "${CMAKE_SOURCE_DIR}/../media")
55# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
56# Render systems may be optional, but at least one has to be found in FindOgre
57SET(OGRE_PLUGINS RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX)
58IF(WIN32)
59  # CG program manager is probably DirectX related (not available under unix)
60  LIST(APPEND OGRE_PLUGINS Plugin_CgProgramManager)
61ENDIF(WIN32)
62
63# Check the plugins and determine the plugin folder
64# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
65INCLUDE(CheckOGREPlugins)
66
67
68############## Compiler Config ##################
69INCLUDE(BuildConfigGCC)
70INCLUDE(BuildConfigMSVC)
71# User can create his own file if required
72IF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake)
73  INCLUDE(${CMAKE_BINARY_DIR}/BuildConfigUser)
74ENDIF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake)
75
76
77################ Test options ###################
78
79OPTION(ENABLE_TESTS "Enable build tests.")
80IF(ENABLE_TESTS)
81  ENABLE_TESTING()
82ENDIF(ENABLE_TESTS)
83
84OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
85OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
86
87
88################### Macros ######################
89
90# Also define macros to easily extend the compiler flags
91# Additional argument is a condition
92MACRO(ADD_CXX_FLAGS _flag _cond)
93  IF(${_cond})
94    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
95  ENDIF(${_cond})
96ENDMACRO(ADD_CXX_FLAGS _flag)
97MACRO(ADD_C_FLAGS _flag)
98  IF(${_cond})
99    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}")
100  ENDIF(${_cond})
101ENDMACRO(ADD_C_FLAGS _flag)
Note: See TracBrowser for help on using the repository browser.