1 | PROJECT(Orxonox) |
---|
2 | |
---|
3 | cmake_minimum_required(VERSION 2.4) |
---|
4 | |
---|
5 | IF (COMMAND cmake_policy) |
---|
6 | cmake_policy(SET CMP0003 NEW) |
---|
7 | ENDIF (COMMAND cmake_policy) |
---|
8 | |
---|
9 | # Allow for simple IF constructs (makes code a lot more readable) |
---|
10 | #SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) |
---|
11 | |
---|
12 | # This sets where to look for modules (e.g. "Find*.cmake" files) |
---|
13 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
14 | |
---|
15 | # Check whether we are on a tardis box |
---|
16 | INCLUDE(CheckTardis) |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | ############## Testing options ################## |
---|
21 | |
---|
22 | OPTION(TESTING_ENABLED "Do you want to enable Testing") |
---|
23 | IF (TESTING_ENABLED) |
---|
24 | ENABLE_TESTING() |
---|
25 | ENDIF(TESTING_ENABLED) |
---|
26 | |
---|
27 | OPTION (NETWORK_TESTING_ENABLED "Do you want to build network testing tools: i.e. chatclient chatserver and alike") |
---|
28 | OPTION (NETWORKTRAFFIC_TESTING_ENABLED "Do you want to build dummyserver4 and dummyclient4") |
---|
29 | |
---|
30 | |
---|
31 | ########## Compiler/Linker options ############## |
---|
32 | |
---|
33 | # if on tardis change compiler and reset boost include directory |
---|
34 | IF(IS_TARDIS) |
---|
35 | MESSAGE("System is a TARDIS: Setting Compiler to g++-4.1.1") |
---|
36 | # Force-set the compiler on tardis machines, as default points to g++-3.3 |
---|
37 | SET(CMAKE_CXX_COMPILER "g++-4.1.1") |
---|
38 | # Reset Boost serach path |
---|
39 | SET(Boost_INCLUDE_DIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include") |
---|
40 | ELSE (IS_TARDIS) |
---|
41 | IF (NOT WIN32) |
---|
42 | SET(Boost_INCLUDE_DIR "/usr/include/boost") |
---|
43 | ENDIF (NOT WIN32) |
---|
44 | ENDIF(IS_TARDIS) |
---|
45 | |
---|
46 | # Set binary output directories |
---|
47 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) |
---|
48 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/lib) |
---|
49 | |
---|
50 | # Global compiler/linker flags. force -O2! |
---|
51 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O0 -Wall -g -ggdb") |
---|
52 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb") |
---|
53 | #SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O3 -s") |
---|
54 | #SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O3 -s") |
---|
55 | |
---|
56 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
57 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
---|
58 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
---|
59 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
---|
60 | |
---|
61 | # Use 'cmake -D make_verb:1 path' to get verbose make output when compiling |
---|
62 | IF (MAKE_VERB) |
---|
63 | SET(CMAKE_VERBOSE_MAKEFILE TRUE) |
---|
64 | ENDIF (MAKE_VERB) |
---|
65 | |
---|
66 | |
---|
67 | ############### Library finding ################# |
---|
68 | |
---|
69 | # Uncomment the following line if you want the include and library paths to be shown |
---|
70 | # Alternatively use the "-D VERBOSE_FIND:BOOL=true" option when executing cmake |
---|
71 | |
---|
72 | # SET (VERBOSE_FIND true) |
---|
73 | |
---|
74 | # Set the library directory when using precompiled tarballs for the dependencies under windows |
---|
75 | IF (WIN32) |
---|
76 | IF (MSVC) |
---|
77 | IF ($ENV{ORXONOX_DEV}) |
---|
78 | SET (DEPENDENCY_DIR ${CMAKE_SOURCE_DIR}/../lib_dist/dependencies/) |
---|
79 | ELSE ($ENV{ORXONOX_DEV}) |
---|
80 | SET (DEPENDENCY_DIR ${CMAKE_SOURCE_DIR}/dependencies/) |
---|
81 | ENDIF ($ENV{ORXONOX_DEV}) |
---|
82 | SET(Boost_LIB_SUFFIX_DEBUG vc80-mt-gd-1_35) |
---|
83 | ENDIF (MSVC) |
---|
84 | ENDIF (WIN32) |
---|
85 | MESSAGE(STATUS ${DEPENDENCY_DIR}) |
---|
86 | |
---|
87 | # Performs the search and sets the variables |
---|
88 | FIND_PACKAGE(OGRE) |
---|
89 | FIND_PACKAGE(CEGUI) |
---|
90 | # FIND_PACKAGE(CEGUI_OGRE) |
---|
91 | FIND_PACKAGE(ENet) |
---|
92 | FIND_PACKAGE(Boost REQUIRED thread filesystem) |
---|
93 | FIND_PACKAGE(OpenAL) |
---|
94 | FIND_PACKAGE(ALUT) |
---|
95 | FIND_PACKAGE(OggVorbis) |
---|
96 | FIND_PACKAGE(ZLIB) |
---|
97 | #FIND_PACKAGE(Lua) |
---|
98 | FIND_PACKAGE(TCL) |
---|
99 | FIND_PACKAGE(DirectX) |
---|
100 | |
---|
101 | # Set the search paths for the linking |
---|
102 | LINK_DIRECTORIES( |
---|
103 | ${OGRE_LIB_DIR} |
---|
104 | ${CEGUI_LIB_DIR} |
---|
105 | # ${CEGUI_SCRIPT_LIB_DIR} |
---|
106 | # ${CEGUI_OGRE_LIB_DIR} |
---|
107 | ${ENet_LIBRARY} |
---|
108 | ${Boost_LIBRARY_DIRS} |
---|
109 | ${Zlib_LIBRARY_DIR} |
---|
110 | ${TCL_LIBRARY} |
---|
111 | ) |
---|
112 | |
---|
113 | # Set the search paths for include files |
---|
114 | INCLUDE_DIRECTORIES( |
---|
115 | ${OGRE_INCLUDE_DIR} |
---|
116 | ${CEGUI_INCLUDE_DIR} |
---|
117 | # ${CEGUI_OGRE_INCLUDE_DIR} |
---|
118 | ${ENet_INCLUDE_DIR} |
---|
119 | ${Boost_INCLUDE_DIRS} |
---|
120 | ${OPENAL_INCLUDE_DIR} |
---|
121 | ${ALUT_INCLUDE_DIR} |
---|
122 | ${VORBIS_INCLUDE_DIR} |
---|
123 | ${OGG_INCLUDE_DIR} |
---|
124 | # ${Lua_INCLUDE_DIR} |
---|
125 | ${TCL_INCLUDE_PATH} |
---|
126 | ${DirectX_INCLUDE_DIR} |
---|
127 | ${ZLIB_INCLUDE_DIR} |
---|
128 | ) |
---|
129 | |
---|
130 | # Add main source dir |
---|
131 | ADD_SUBDIRECTORY(src) |
---|
132 | |
---|