Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3166 was 3116, checked in by rgrieder, 15 years ago

Added new CMake functions: ORXONOX_ADD_LIBRARY and ORXONOX_ADD_EXECUTABLE.
They replace the current functions ADD_LIBRARY and ADD_EXECUTABLE to allow for clearer and easier declaration.
And it allows for GCC precompiled header file support in the first place ;)
More information can be found in TargetUtilities.cmake

  • Property svn:eol-style set to native
File size: 5.0 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" Release MinSizeRel TOLUA_PARSER_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!
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
111  # All library includes are prefixed with the path to avoid conflicts
112  ${CMAKE_CURRENT_SOURCE_DIR}
113  # Bullet headers really need the include directory
114  ${CMAKE_CURRENT_SOURCE_DIR}/bullet
115  # OIS headers need the root dir as well
116  ${CMAKE_CURRENT_SOURCE_DIR}/ois
117  # Convenience directory
118  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
119  # OrxonoxConfig.h
120  ${CMAKE_CURRENT_BINARY_DIR}
121  # Tolua bind files for Core
122  ${CMAKE_CURRENT_BINARY_DIR}/core/${CMAKE_CFG_INTDIR}
123  # Tolua bind files for Orxonox
124  ${CMAKE_CURRENT_BINARY_DIR}/orxonox/${CMAKE_CFG_INTDIR}
125)
126
127
128################ Sub Directories ################
129
130# Third party libraries
131ADD_SUBDIRECTORY(tolua)
132
133# Include CEGUILua if not requested otherwise
134IF(CEGUILUA_USE_INTERNAL_LIBRARY)
135  IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})
136    MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")
137  ENDIF()
138
139  INCLUDE_DIRECTORIES(ceguilua/ceguilua-${CEGUI_VERSION})
140  ADD_SUBDIRECTORY(ceguilua)
141ENDIF()
142
143ADD_SUBDIRECTORY(bullet)
144ADD_SUBDIRECTORY(cpptcl)
145ADD_SUBDIRECTORY(ogreceguirenderer)
146ADD_SUBDIRECTORY(ois)
147ADD_SUBDIRECTORY(tinyxml)
148
149# Orxonox code
150ADD_SUBDIRECTORY(util)
151ADD_SUBDIRECTORY(core)
152ADD_SUBDIRECTORY(network)
153ADD_SUBDIRECTORY(orxonox)
154
155# Apply version info
156SET_TARGET_PROPERTIES(util core network orxonox
157  PROPERTIES VERSION ${ORXONOX_VERSION})
Note: See TracBrowser for help on using the repository browser.