1 | PROJECT(Orxonox) |
---|
2 | |
---|
3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) |
---|
4 | |
---|
5 | # This sets where to look for modules (e.g. "Find*.cmake" files) |
---|
6 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
7 | |
---|
8 | # Check for special include paths |
---|
9 | INCLUDE(CheckTardis) |
---|
10 | INCLUDE(CheckOrxonoxWinDeps) |
---|
11 | |
---|
12 | ################ Test options ################### |
---|
13 | |
---|
14 | OPTION(ENABLE_TESTS "Enable build tests.") |
---|
15 | IF(ENABLE_TESTS) |
---|
16 | ENABLE_TESTING() |
---|
17 | ENDIF(ENABLE_TESTS) |
---|
18 | |
---|
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 | |
---|
22 | ########## Compiler/Linker options ############## |
---|
23 | |
---|
24 | # Set binary output directories |
---|
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) |
---|
28 | |
---|
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") |
---|
35 | SET(CMAKE_C_FLAGS_DEBUG "-g -ggdb -fPIC") |
---|
36 | SET(CMAKE_CXX_FLAGS_DEBUG "-g -ggdb -fPIC") |
---|
37 | SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -fPIC") |
---|
38 | SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fPIC") |
---|
39 | SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb -fPIC") |
---|
40 | SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb -fPIC") |
---|
41 | SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG -fPIC") |
---|
42 | SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -fPIC") |
---|
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 | |
---|
51 | # Performs the search and sets the variables |
---|
52 | FIND_PACKAGE(OGRE REQUIRED) |
---|
53 | FIND_PACKAGE(CEGUI REQUIRED) |
---|
54 | # CEGUI_OGRE is already included in source |
---|
55 | #FIND_PACKAGE(CEGUI_OGRE REQUIRED) |
---|
56 | FIND_PACKAGE(ENet REQUIRED) |
---|
57 | FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem) |
---|
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) |
---|
63 | |
---|
64 | # Require Lua 5.0 or 5.1 |
---|
65 | FIND_PACKAGE(Lua50 QUIET) |
---|
66 | IF(NOT LUA50_FOUND) |
---|
67 | # Remove variables set by Lua50 and try with Lua51 |
---|
68 | SET(LUA_INCLUDE_DIR) |
---|
69 | SET(LUA_LIBRARY_lua) |
---|
70 | SET(LUA_LIBRARY_lualib) |
---|
71 | SET(LUA_LIBRARIES) |
---|
72 | FIND_PACKAGE(Lua51 REQUIRED) |
---|
73 | ENDIF(NOT LUA50_FOUND) |
---|
74 | # Determine Lua version (Lua50 may also find Lua51) |
---|
75 | FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" LUA_VERSION REGEX "LUA_VERSION") |
---|
76 | STRING(REGEX REPLACE "^.*\"Lua (.*)\".*$" "\\1" LUA_VERSION "${LUA_VERSION}") |
---|
77 | |
---|
78 | # Don't require the whole tcl rat tail |
---|
79 | FIND_PACKAGE(TCL QUIET) |
---|
80 | IF(NOT TCL_FOUND) |
---|
81 | MESSAGE(FATAL_ERROR "Tcl not found.") |
---|
82 | ENDIF(NOT TCL_FOUND) |
---|
83 | |
---|
84 | # Add main source dir |
---|
85 | ADD_SUBDIRECTORY(src) |
---|
86 | ADD_SUBDIRECTORY(bin) |
---|