[1505] | 1 | PROJECT(Orxonox) |
---|
| 2 | |
---|
[2509] | 3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) |
---|
[1505] | 4 | |
---|
[1776] | 5 | # This sets where to look for modules (e.g. "Find*.cmake" files) |
---|
[1505] | 6 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
| 7 | |
---|
[2509] | 8 | # Check for special include paths |
---|
[1505] | 9 | INCLUDE(CheckTardis) |
---|
[2509] | 10 | INCLUDE(CheckOrxonoxWinDeps) |
---|
[1505] | 11 | |
---|
[2509] | 12 | ################ Test options ################### |
---|
[1505] | 13 | |
---|
[2509] | 14 | OPTION(ENABLE_TESTS "Enable build tests.") |
---|
| 15 | IF(ENABLE_TESTS) |
---|
[1505] | 16 | ENABLE_TESTING() |
---|
[2509] | 17 | ENDIF(ENABLE_TESTS) |
---|
[1505] | 18 | |
---|
[2509] | 19 | OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.") |
---|
| 20 | OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.") |
---|
[1505] | 21 | |
---|
| 22 | ########## Compiler/Linker options ############## |
---|
| 23 | |
---|
[1776] | 24 | # Set binary output directories |
---|
[2509] | 25 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
| 26 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
| 27 | MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) |
---|
[1505] | 28 | |
---|
[2509] | 29 | # Compiler/Linker flags. |
---|
| 30 | IF(NOT CMAKE_BUILD_TYPE) |
---|
| 31 | SET(CMAKE_BUILD_TYPE "Debug") |
---|
| 32 | ENDIF(NOT CMAKE_BUILD_TYPE) |
---|
[2517] | 33 | #SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -Wall -Wextra -Wno-unused-parameter") |
---|
[2526] | 34 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -Wall ${ORXONOX_FPIC_FLAG}") |
---|
[2517] | 35 | #SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Wno-unused-parameter") |
---|
[2526] | 36 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall ${ORXONOX_FPIC_FLAG}") |
---|
[2521] | 37 | SET(CMAKE_C_FLAGS_DEBUG "-g -ggdb") |
---|
| 38 | SET(CMAKE_CXX_FLAGS_DEBUG "-g -ggdb") |
---|
| 39 | SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") |
---|
| 40 | SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") |
---|
| 41 | SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb") |
---|
| 42 | SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb") |
---|
| 43 | SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") |
---|
| 44 | SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") |
---|
[1505] | 45 | |
---|
| 46 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
| 47 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
---|
| 48 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
---|
| 49 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
---|
| 50 | |
---|
| 51 | ############### Library finding ################# |
---|
| 52 | |
---|
[1776] | 53 | # Performs the search and sets the variables |
---|
[2509] | 54 | FIND_PACKAGE(OGRE REQUIRED) |
---|
| 55 | FIND_PACKAGE(CEGUI REQUIRED) |
---|
[2510] | 56 | # CEGUI_OGRE is already included in source |
---|
[2509] | 57 | #FIND_PACKAGE(CEGUI_OGRE REQUIRED) |
---|
| 58 | FIND_PACKAGE(ENet REQUIRED) |
---|
| 59 | FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem) |
---|
| 60 | FIND_PACKAGE(OpenAL REQUIRED) |
---|
| 61 | FIND_PACKAGE(ALUT REQUIRED) |
---|
| 62 | FIND_PACKAGE(OggVorbis REQUIRED) |
---|
| 63 | FIND_PACKAGE(ZLIB REQUIRED) |
---|
| 64 | FIND_PACKAGE(DirectX REQUIRED) |
---|
[1505] | 65 | |
---|
[2510] | 66 | # Require Lua 5.0 or 5.1 |
---|
| 67 | FIND_PACKAGE(Lua50 QUIET) |
---|
| 68 | IF(NOT LUA50_FOUND) |
---|
| 69 | # Remove variables set by Lua50 and try with Lua51 |
---|
| 70 | SET(LUA_INCLUDE_DIR) |
---|
| 71 | SET(LUA_LIBRARY_lua) |
---|
| 72 | SET(LUA_LIBRARY_lualib) |
---|
| 73 | SET(LUA_LIBRARIES) |
---|
| 74 | FIND_PACKAGE(Lua51 REQUIRED) |
---|
| 75 | ENDIF(NOT LUA50_FOUND) |
---|
| 76 | # Determine Lua version (Lua50 may also find Lua51) |
---|
| 77 | FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" LUA_VERSION REGEX "LUA_VERSION") |
---|
| 78 | STRING(REGEX REPLACE "^.*\"Lua (.*)\".*$" "\\1" LUA_VERSION "${LUA_VERSION}") |
---|
| 79 | |
---|
| 80 | # Don't require the whole tcl rat tail |
---|
[2509] | 81 | FIND_PACKAGE(TCL QUIET) |
---|
| 82 | IF(NOT TCL_FOUND) |
---|
| 83 | MESSAGE(FATAL_ERROR "Tcl not found.") |
---|
| 84 | ENDIF(NOT TCL_FOUND) |
---|
[1505] | 85 | |
---|
[1776] | 86 | # Add main source dir |
---|
[1505] | 87 | ADD_SUBDIRECTORY(src) |
---|
[2509] | 88 | ADD_SUBDIRECTORY(bin) |
---|