[1505] | 1 | PROJECT(Orxonox) |
---|
| 2 | |
---|
[1981] | 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 | |
---|
[2197] | 8 | # Check for special include paths |
---|
[1505] | 9 | INCLUDE(CheckTardis) |
---|
[2197] | 10 | INCLUDE(CheckOrxonoxWinDeps) |
---|
[1505] | 11 | |
---|
[2197] | 12 | ################ Test options ################### |
---|
[1505] | 13 | |
---|
[2197] | 14 | OPTION(ENABLE_TESTS "Enable build tests.") |
---|
| 15 | IF(ENABLE_TESTS) |
---|
| 16 | ENABLE_TESTING() |
---|
| 17 | ENDIF(ENABLE_TESTS) |
---|
[1505] | 18 | |
---|
[2197] | 19 | OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.") |
---|
| 20 | OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.") |
---|
| 21 | |
---|
[1505] | 22 | ########## Compiler/Linker options ############## |
---|
| 23 | |
---|
[1776] | 24 | # Set binary output directories |
---|
[1882] | 25 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
[1977] | 26 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
[2197] | 27 | MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) |
---|
[1505] | 28 | |
---|
[2223] | 29 | # Compiler/Linker flags. |
---|
| 30 | IF(NOT CMAKE_BUILD_TYPE) |
---|
| 31 | SET(CMAKE_BUILD_TYPE "Debug") |
---|
| 32 | ENDIF(NOT CMAKE_BUILD_TYPE) |
---|
| 33 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -Wall -Wextra -Wno-unused-parameter") |
---|
| 34 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Wno-unused-parameter") |
---|
[2277] | 35 | SET(CMAKE_C_FLAGS_DEBUG "-g -ggdb") |
---|
| 36 | SET(CMAKE_CXX_FLAGS_DEBUG "-g -ggdb") |
---|
[2260] | 37 | SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") |
---|
| 38 | SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") |
---|
| 39 | SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb") |
---|
| 40 | SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb") |
---|
| 41 | SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") |
---|
| 42 | SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") |
---|
[1505] | 43 | |
---|
| 44 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
| 45 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
---|
| 46 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
---|
| 47 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
---|
| 48 | |
---|
| 49 | ############### Library finding ################# |
---|
| 50 | |
---|
[1776] | 51 | # Performs the search and sets the variables |
---|
[1977] | 52 | FIND_PACKAGE(OGRE REQUIRED) |
---|
| 53 | FIND_PACKAGE(CEGUI REQUIRED) |
---|
[1999] | 54 | # CEGUI_OGRE included in source |
---|
[1977] | 55 | #FIND_PACKAGE(CEGUI_OGRE REQUIRED) |
---|
| 56 | FIND_PACKAGE(ENet REQUIRED) |
---|
[1981] | 57 | FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem) |
---|
[1977] | 58 | FIND_PACKAGE(OpenAL REQUIRED) |
---|
| 59 | FIND_PACKAGE(ALUT REQUIRED) |
---|
| 60 | FIND_PACKAGE(OggVorbis REQUIRED) |
---|
| 61 | FIND_PACKAGE(ZLIB REQUIRED) |
---|
| 62 | FIND_PACKAGE(DirectX REQUIRED) |
---|
[1999] | 63 | FIND_PACKAGE(Lua50 REQUIRED) |
---|
| 64 | #FIND_PACKAGE(Lua51 QUIET) |
---|
[1505] | 65 | |
---|
[2204] | 66 | #don't require the whole tcl rat tail |
---|
| 67 | FIND_PACKAGE(TCL QUIET) |
---|
| 68 | IF(NOT TCL_FOUND) |
---|
| 69 | MESSAGE(FATAL_ERROR "Tcl not found.") |
---|
| 70 | ENDIF(NOT TCL_FOUND) |
---|
| 71 | |
---|
[1776] | 72 | # Add main source dir |
---|
[1505] | 73 | ADD_SUBDIRECTORY(src) |
---|
[2199] | 74 | ADD_SUBDIRECTORY(bin) |
---|