Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pch/src/CMakeLists.txt @ 3175

Last change on this file since 3175 was 3167, checked in by rgrieder, 15 years ago

Merged the build system changes from the Gruppenarbeit:

  • More Comments (including Doxygen stuff for the config files)
  • Removed redundancy between PackageConfigMSVC.cmake and PackageConfigMinGW.cmake
  • Option ORXONOX_RELEASE which activates some expensive (build time) optimisations
  • Native Visual Leak Detector support (doesn't work for MSVC9 though)
  • Added CMake option to disable the console on Windows
  • Property svn:eol-style set to native
File size: 4.9 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################ Various Options ################
21
22# various macro includes
23INCLUDE(FlagUtilities)
24INCLUDE(TargetUtilities)
25
26# Use TinyXML++
27ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
28# OIS dynamic linking requires macro definition, at least for Windows
29ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
30# Tolua binding speedup if required
31ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" ORXONOX_RELEASE)
32
33# Default linking is SHARED
34SET(ORXONOX_DEFAULT_LINK SHARED)
35
36################ OrxonoxConfig.h ################
37
38# Check endianness
39INCLUDE(TestBigEndian)
40TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN)
41IF(NOT ORXONOX_BIG_ENDIAN)
42  SET(ORXONOX_LITTLE_ENDIAN TRUE)
43ENDIF()
44
45# 32/64 bit system check
46IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
47  SET(ORXONOX_ARCH_64 TRUE)
48ELSE()
49  SET(ORXONOX_ARCH_32 TRUE)
50ENDIF()
51
52# Platforms
53SET(ORXONOX_PLATFORM_WINDOWS ${WIN32})
54SET(ORXONOX_PLATFORM_APPLE ${APPLE})
55SET(ORXONOX_PLATFORM_UNIX ${UNIX})
56IF(UNIX AND NOT APPLE)
57  SET(ORXONOX_PLATFORM_LINUX TRUE)
58ENDIF()
59
60# Check __forceinline
61IF(MSVC)
62  INCLUDE(CheckCXXSourceCompiles)
63  SET(_source "int main() { return 0; } __forceinline void test() { return; }")
64  CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE)
65ENDIF(MSVC)
66
67# Check ciso646 include (literal operators)
68INCLUDE(CheckIncludeFileCXX)
69CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H)
70
71# XCode and Visual Studio support multiple configurations. In order to tell the
72# which one we have to define the macros separately for each configuration
73ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Debug"          Debug)
74ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Release"        Release)
75ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=RelWithDebInfo" RelWithDebInfo)
76ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=MinSizeRel"     MinSizeRel)
77
78SET(GENERATED_FILE_COMMENT
79   "DO NOT EDIT THIS FILE! <br>
80    It has been automatically generated by CMake from OrxonoxConfig.h.in")
81# Copy and configure OrxonoxConfig which gets included in every file
82CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h)
83# This file only gets included by very few classes to avoid a large recompilation
84CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h)
85
86SET(ORXONOX_CONFIG_FILES
87  ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h
88  ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in
89  ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h
90  ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in
91)
92
93############## Include Directories ##############
94
95# Set the search paths for include files
96INCLUDE_DIRECTORIES(
97  # External
98  ${OGRE_INCLUDE_DIR}
99  ${CEGUI_INCLUDE_DIR}
100  ${ENET_INCLUDE_DIR}
101  ${Boost_INCLUDE_DIRS}
102  ${OPENAL_INCLUDE_DIRS}
103  ${ALUT_INCLUDE_DIR}
104  ${VORBIS_INCLUDE_DIR}
105  ${OGG_INCLUDE_DIR}
106  ${LUA_INCLUDE_DIR}
107  ${TCL_INCLUDE_PATH}
108  ${DIRECTX_INCLUDE_DIR}
109  ${ZLIB_INCLUDE_DIR}
110  ${VLD_INCLUDE_DIR}
111
112  # All library includes are prefixed with the path to avoid conflicts
113  ${CMAKE_CURRENT_SOURCE_DIR}
114  # Bullet headers really need the include directory
115  ${CMAKE_CURRENT_SOURCE_DIR}/bullet
116  # OIS headers need the root dir as well
117  ${CMAKE_CURRENT_SOURCE_DIR}/ois
118  # Convenience directory
119  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
120  # OrxonoxConfig.h
121  ${CMAKE_CURRENT_BINARY_DIR}
122  # Tolua bind files for Core
123  ${CMAKE_CURRENT_BINARY_DIR}/core/${CMAKE_CFG_INTDIR}
124  # Tolua bind files for Orxonox
125  ${CMAKE_CURRENT_BINARY_DIR}/orxonox/${CMAKE_CFG_INTDIR}
126)
127
128
129################ Sub Directories ################
130
131# Third party libraries
132ADD_SUBDIRECTORY(tolua)
133
134# Include CEGUILua if not requested otherwise
135IF(CEGUILUA_USE_INTERNAL_LIBRARY)
136  IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})
137    MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")
138  ENDIF()
139
140  INCLUDE_DIRECTORIES(ceguilua/ceguilua-${CEGUI_VERSION})
141  ADD_SUBDIRECTORY(ceguilua)
142ENDIF()
143
144ADD_SUBDIRECTORY(bullet)
145ADD_SUBDIRECTORY(cpptcl)
146ADD_SUBDIRECTORY(ogreceguirenderer)
147ADD_SUBDIRECTORY(ois)
148ADD_SUBDIRECTORY(tinyxml)
149
150# Orxonox code
151ADD_SUBDIRECTORY(util)
152ADD_SUBDIRECTORY(core)
153ADD_SUBDIRECTORY(network)
154ADD_SUBDIRECTORY(orxonox)
Note: See TracBrowser for help on using the repository browser.