Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core7/CMakeLists.txt @ 10578

Last change on this file since 10578 was 10547, checked in by landauf, 9 years ago

added support for plugins in the buildsystem. plugins are like modules, but can be loaded/unloaded at runtime

  • Property svn:eol-style set to native
File size: 6.1 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 #  Author:
21 #    Reto Grieder
22 #  Description:
23 #    Configures some basics and controls the configuration scripts
24 #
25
26# Defined LINUX
27IF(UNIX AND NOT APPLE)
28  SET(LINUX TRUE)
29ENDIF()
30
31# Keep devs from using the root directory as binary directory (messes up the source tree)
32IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
33  MESSAGE(FATAL_ERROR "Please do not use the root directory as CMake output directory!
34  mkdir build; cd build; cmake ..
35  And you will have to clean the source directory by deleting CMakeCache.txt and the folder CMakeFiles")
36ENDIF()
37
38PROJECT(Orxonox C CXX)
39
40# Check AFTER the PROJECT command because MSVC10 gets defined there
41IF(WIN32)
42  IF(MSVC10)
43    CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3 FATAL_ERROR)
44  ELSE()
45    CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
46  ENDIF()
47ELSE()
48  CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
49ENDIF()
50
51################ General Config #################
52
53# Version info
54SET(ORXONOX_VERSION_MAJOR 0)
55SET(ORXONOX_VERSION_MINOR 0)
56SET(ORXONOX_VERSION_PATCH 5)
57SET(ORXONOX_VERSION
58  ${ORXONOX_VERSION_MAJOR}.${ORXONOX_VERSION_MINOR}.${ORXONOX_VERSION_PATCH}
59)
60SET(ORXONOX_VERSION_NAME "Arcturus")
61
62# Standard path suffixes
63SET(DEFAULT_RUNTIME_PATH bin)
64SET(DEFAULT_LIBRARY_PATH lib)
65SET(DEFAULT_ARCHIVE_PATH lib/static)
66SET(DEFAULT_MODULE_PATH  lib/modules)
67SET(DEFAULT_PLUGIN_PATH  lib/plugins)
68SET(DEFAULT_DOC_PATH     doc)
69SET(DEFAULT_DATA_PATH    data)
70SET(DEFAULT_CONFIG_PATH  config)
71SET(DEFAULT_LOG_PATH     log)
72SET(DEFAULT_BUNDLE_PATH  bundle)
73
74# Set output directories
75SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_RUNTIME_PATH})
76SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
77SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
78SET(CMAKE_MODULE_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_MODULE_PATH})
79SET(CMAKE_PLUGIN_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_PLUGIN_PATH})
80SET(CMAKE_DOC_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH})
81# Data directories are only inputs, no delclaration here
82SET(CMAKE_CONFIG_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH})
83SET(CMAKE_LOG_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH})
84
85# Set the extension of the dynamic modules
86SET(ORXONOX_MODULE_EXTENSION ".module")
87SET(ORXONOX_PLUGIN_EXTENSION ".plugin")
88
89# Sets where to find the external libraries like OgreMain.dll at runtime
90# On Unix you should not have to change this at all.
91# This only applies to development runs in the build tree
92SET(RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
93
94# Take care of some CMake 2.6.0 leftovers
95MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
96
97# This sets where to look for CMake modules (e.g. "Find*.cmake" files)
98SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/tools)
99
100# Flag variables for extra configuration "RelForDevs" should be hidden
101MARK_AS_ADVANCED(
102  CMAKE_CXX_FLAGS_RELFORDEVS
103  CMAKE_C_FLAGS_RELFORDEVS
104  CMAKE_EXE_LINKER_FLAGS_RELFORDEVS
105  CMAKE_MODULE_LINKER_FLAGS_RELFORDEVS
106  CMAKE_SHARED_LINKER_FLAGS_RELFORDEVS
107)
108
109IF(NOT CMAKE_CONFIGURATION_TYPES)
110  # Set Debug build to default when not having multi-config generator like MSVC or XCODE
111  IF(NOT CMAKE_BUILD_TYPE)
112    SET(CMAKE_BUILD_TYPE Debug CACHE STRING
113        "Build types are: Debug, RelForDevs, RelWithDebInfo, Release, MinSizeRel" FORCE)
114  ENDIF()
115  MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
116
117  MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***")
118ELSE()
119  # Make sure no build type is ever set
120  IF(CMAKE_BUILD_TYPE)
121    SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
122  ENDIF()
123  MARK_AS_ADVANCED(FORCE CMAKE_BUILD_TYPE)
124  # Add our extra configuration "RelForDevs"
125  SET(CMAKE_CONFIGURATION_TYPES "Debug;RelForDevs;RelWithDebInfo;Release;MinSizeRel"
126      CACHE STRING "Semicolon separated list of supported configuration types." FORCE)
127ENDIF()
128
129# Debug builds can not be installed
130INSTALL(SCRIPT cmake/InstallCheck.cmake)
131
132IF(APPLE)
133  # Set 10.5 as the base SDK by default
134  SET(XCODE_ATTRIBUTE_SDKROOT macosx10.5)
135
136  # 10.6 sets x86_64 as the default architecture.
137  # Because Carbon isn't supported on 64-bit and we still need it, force the architectures to ppc and i386
138  IF(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
139    SET(CMAKE_OSX_ARCHITECTURES "i386")
140  ENDIF()
141  IF(CMAKE_OSX_ARCHITECTURES MATCHES "ppc64")
142    SET(CMAKE_OSX_ARCHITECTURES "ppc")
143  ENDIF()
144  IF(NOT CMAKE_OSX_ARCHITECTURES)
145    SET(CMAKE_OSX_ARCHITECTURES "i386")
146  ENDIF()
147ENDIF()
148
149########### Subfolders and Subscripts ###########
150
151# General build and compiler options and configurations
152INCLUDE(CompilerConfig)
153
154# Library finding
155INCLUDE(LibraryConfig)
156
157# Configure installation paths and options
158INCLUDE(InstallConfig)
159
160# Configure data directory location and installation
161ADD_SUBDIRECTORY(data)
162
163# Create the actual project
164ADD_SUBDIRECTORY(src)
165
166# Create the test suites
167ADD_SUBDIRECTORY(test)
168
169# Configure the binary output directory. Do this after src!
170ADD_SUBDIRECTORY(bin)
171
172# System specific files (mostly for installation)
173ADD_SUBDIRECTORY(contrib)
174
175# Last but not least: Try to make a doc target with Doxygen
176ADD_SUBDIRECTORY(doc)
177
178########### CPack Packaging ###########
179
180# Currently only testing on Apple
181#IF(APPLE)
182#  INCLUDE(BundleConfig)
183#ENDIF(APPLE)
Note: See TracBrowser for help on using the repository browser.