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