Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ggz/src/CMakeLists.txt @ 3094

Last change on this file since 3094 was 3002, checked in by rgrieder, 16 years ago

Possible build bug: in the compiler config files (BuildConfig, etc.) the compiler flags get reset at first. Adding flags before that will have no effect.

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