[2579] | 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 | |
---|
[2612] | 28 | ################ Misc Options ################### |
---|
[2582] | 29 | |
---|
[2612] | 30 | # Set binary output directories |
---|
| 31 | SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) |
---|
| 32 | SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) |
---|
| 33 | SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) |
---|
| 34 | |
---|
| 35 | # Set Debug build to default when not having multi-config generator like msvc |
---|
| 36 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
---|
| 37 | SET(CMAKE_BUILD_TYPE "Debug") |
---|
| 38 | ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
---|
| 39 | |
---|
[2583] | 40 | # When searching for debug libraries, this is appended to the libarary name |
---|
[2579] | 41 | SET(LIBRARY_DEBUG_POSTFIX "_d") |
---|
[2590] | 42 | # Sets where to find the binary directory of external libraries |
---|
| 43 | SET(ORXONOX_LIBRARY_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
---|
[2583] | 44 | # Working directory for the tolua parser. Adjust for windows because lua.dll has to be there! |
---|
| 45 | SET(TOLUA_PARSER_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
---|
[2582] | 46 | |
---|
[2583] | 47 | OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)") |
---|
[2582] | 48 | IF(EXTRA_WARNINGS) |
---|
| 49 | SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter") |
---|
| 50 | ELSE(EXTRA_WARNINGS) |
---|
| 51 | SET(ORXONOX_WARNING_FLAGS "-Wall") |
---|
| 52 | ENDIF(EXTRA_WARNINGS) |
---|
| 53 | |
---|
[2585] | 54 | SET(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 |
---|
[2592] | 57 | SET(OGRE_PLUGINS RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX) |
---|
| 58 | IF(WIN32) |
---|
| 59 | # CG program manager is probably DirectX related (not available under unix) |
---|
| 60 | LIST(APPEND OGRE_PLUGINS Plugin_CgProgramManager) |
---|
| 61 | ENDIF(WIN32) |
---|
[2585] | 62 | |
---|
[2612] | 63 | # Check the plugins and determine the plugin folder |
---|
| 64 | # You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR} |
---|
| 65 | INCLUDE(CheckOGREPlugins) |
---|
[2585] | 66 | |
---|
[2582] | 67 | |
---|
[2612] | 68 | ############## Compiler Config ################## |
---|
| 69 | INCLUDE(BuildConfigGCC) |
---|
| 70 | INCLUDE(BuildConfigMSVC) |
---|
| 71 | # User can create his own file if required |
---|
| 72 | IF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake) |
---|
| 73 | INCLUDE(${CMAKE_BINARY_DIR}/BuildConfigUser) |
---|
| 74 | ENDIF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake) |
---|
[2582] | 75 | |
---|
| 76 | |
---|
[2612] | 77 | ################ Test options ################### |
---|
| 78 | |
---|
| 79 | OPTION(ENABLE_TESTS "Enable build tests.") |
---|
| 80 | IF(ENABLE_TESTS) |
---|
| 81 | ENABLE_TESTING() |
---|
| 82 | ENDIF(ENABLE_TESTS) |
---|
| 83 | |
---|
| 84 | OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.") |
---|
| 85 | OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.") |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | ################### Macros ###################### |
---|
| 89 | |
---|
[2588] | 90 | # Also define macros to easily extend the compiler flags |
---|
| 91 | # Additional argument is a condition |
---|
| 92 | MACRO(ADD_CXX_FLAGS _flag _cond) |
---|
| 93 | IF(${_cond}) |
---|
| 94 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}") |
---|
| 95 | ENDIF(${_cond}) |
---|
| 96 | ENDMACRO(ADD_CXX_FLAGS _flag) |
---|
| 97 | MACRO(ADD_C_FLAGS _flag) |
---|
| 98 | IF(${_cond}) |
---|
| 99 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}") |
---|
| 100 | ENDIF(${_cond}) |
---|
| 101 | ENDMACRO(ADD_C_FLAGS _flag) |
---|