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