[1505] | 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 | #This sets where to look for modules (e.g. "Find*.cmake" files) |
---|
| 10 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
| 11 | |
---|
| 12 | #Check whether we are on a tardis box |
---|
| 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 | |
---|
| 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") |
---|
| 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") |
---|
| 32 | # force-set the compiler on tardis machines, as default points to g++-3.3 |
---|
| 33 | SET(CMAKE_CXX_COMPILER "g++-4.1.1") |
---|
| 34 | # reset Boost serach path |
---|
| 35 | SET(Boost_INCLUDE_DIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include") |
---|
| 36 | ELSE (IS_TARDIS) |
---|
| 37 | SET(Boost_INCLUDE_DIR "/usr/include/boost") |
---|
| 38 | ENDIF(IS_TARDIS) |
---|
| 39 | |
---|
| 40 | #set binary output directories |
---|
| 41 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) |
---|
| 42 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/lib) |
---|
| 43 | |
---|
| 44 | # global compiler/linker flags. force -O2! |
---|
| 45 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O0 -Wall -g -ggdb") |
---|
| 46 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb") |
---|
| 47 | #SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O3") |
---|
| 48 | #SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O3") |
---|
| 49 | |
---|
| 50 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
| 51 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
---|
| 52 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
---|
| 53 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
---|
| 54 | |
---|
| 55 | #use 'cmake -D make_verb:1 path' to get verbose make output when compiling |
---|
| 56 | IF (MAKE_VERB) |
---|
| 57 | SET(CMAKE_VERBOSE_MAKEFILE TRUE) |
---|
| 58 | ENDIF (MAKE_VERB) |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | ############### Library finding ################# |
---|
| 62 | |
---|
| 63 | #Performs the search and sets the variables |
---|
| 64 | FIND_PACKAGE(OGRE) |
---|
| 65 | #FIND_PACKAGE(OIS) |
---|
| 66 | # FIND_PACKAGE(CEGUI) |
---|
| 67 | # FIND_PACKAGE(CEGUI_OGRE) |
---|
| 68 | FIND_PACKAGE(ENet) |
---|
[1535] | 69 | FIND_PACKAGE(Boost REQUIRED thread filesystem) |
---|
| 70 | #FIND_PACKAGE(Boost REQUIRED filesystem) |
---|
[1505] | 71 | FIND_PACKAGE(OpenAL) |
---|
| 72 | FIND_PACKAGE(ALUT) |
---|
| 73 | FIND_PACKAGE(OggVorbis) |
---|
| 74 | FIND_PACKAGE(ZLIB) |
---|
| 75 | FIND_PACKAGE(Lua) |
---|
| 76 | FIND_PACKAGE(TCL) |
---|
| 77 | FIND_PACKAGE(DirectX) |
---|
| 78 | |
---|
| 79 | #Set the search paths for the linking |
---|
| 80 | LINK_DIRECTORIES( |
---|
| 81 | ${OGRE_LIB_DIR} |
---|
| 82 | # ${OIS_LIB_DIR} |
---|
| 83 | # ${CEGUI_LIB_DIR} ${CEGUI_OGRE_LIB_DIR} |
---|
| 84 | ${ENet_LIBRARY} |
---|
| 85 | ${Boost_LIBRARY_DIRS} |
---|
| 86 | ${Zlib_LIBRARY_DIR} |
---|
| 87 | ${TCL_LIBRARY} |
---|
| 88 | ) |
---|
| 89 | |
---|
| 90 | #Set the search paths for include files |
---|
| 91 | INCLUDE_DIRECTORIES( |
---|
| 92 | ${OGRE_INCLUDE_DIR} |
---|
| 93 | # ${OIS_INCLUDE_DIR} |
---|
| 94 | # ${CEGUI_INCLUDE_DIR} ${CEGUI_OGRE_INCLUDE_DIR} |
---|
| 95 | ${ENet_INCLUDE_DIR} |
---|
| 96 | ${Boost_INCLUDE_DIRS} |
---|
| 97 | ${OPENAL_INCLUDE_DIR} |
---|
| 98 | ${ALUT_INCLUDE_DIR} |
---|
| 99 | ${VORBIS_INCLUDE_DIR} |
---|
| 100 | ${OGG_INCLUDE_DIR} |
---|
| 101 | ${Lua_INCLUDE_DIR} |
---|
| 102 | ${TCL_INCLUDE_PATH} |
---|
| 103 | ${DirectX_INCLUDE_DIR} |
---|
| 104 | ${ZLIB_INCLUDE_DIR} |
---|
| 105 | ) |
---|
| 106 | |
---|
| 107 | #add main source dir |
---|
| 108 | ADD_SUBDIRECTORY(src) |
---|
| 109 | |
---|