[790] | 1 | PROJECT(Orxonox) |
---|
| 2 | |
---|
[1071] | 3 | #This sets where to look for modules (e.g. "Find*.cmake" files) |
---|
| 4 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
| 5 | |
---|
| 6 | #Check whether we are on a tardis box |
---|
| 7 | INCLUDE(CheckTardis) |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | ############## Testing options ################## |
---|
| 11 | |
---|
[790] | 12 | OPTION(TESTING_ENABLED "Do you want to enable Testing") |
---|
| 13 | IF (TESTING_ENABLED) |
---|
| 14 | ENABLE_TESTING() |
---|
| 15 | ENDIF(TESTING_ENABLED) |
---|
| 16 | |
---|
| 17 | OPTION(NETWORK_TESTING_ENABLED "Do you want to build network testing tools: i.e. chatclient chatserver and alike") |
---|
| 18 | |
---|
| 19 | |
---|
[1071] | 20 | ########## Compiler/Linker options ############## |
---|
[790] | 21 | |
---|
[1071] | 22 | # if on tardis change compiler and reset boost include directory |
---|
| 23 | IF(IS_TARDIS) |
---|
| 24 | MESSAGE("System is a TARDIS: Setting Compiler to g++-4.1.1") |
---|
| 25 | # force-set the compiler on tardis machines, as default points to g++-3.3 |
---|
| 26 | SET(CMAKE_CXX_COMPILER "g++-4.1.1") |
---|
| 27 | # reset Boost serach path |
---|
| 28 | SET(Boost_INCLUDE_DIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include") |
---|
| 29 | ELSE (IS_TARDIS) |
---|
| 30 | SET(Boost_INCLUDE_DIR "/usr/include/boost") |
---|
| 31 | ENDIF(IS_TARDIS) |
---|
[790] | 32 | |
---|
[1071] | 33 | #set binary output directories |
---|
| 34 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
| 35 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/lib) |
---|
[790] | 36 | |
---|
[1071] | 37 | # global compiler/linker flags. force -O2! |
---|
[790] | 38 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O2 -Wall -g -ggdb") |
---|
| 39 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O2 -Wall -g -ggdb") |
---|
| 40 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
[1070] | 41 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
---|
| 42 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
---|
[1071] | 43 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
---|
[790] | 44 | |
---|
[1071] | 45 | #Create verbose makefile output when compiling |
---|
| 46 | SET(CMAKE_VERBOSE_MAKEFILE TRUE) |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | ############### Library finding ################# |
---|
| 50 | |
---|
[790] | 51 | #Performs the search and sets the variables |
---|
| 52 | FIND_PACKAGE(OGRE) |
---|
| 53 | FIND_PACKAGE(OIS) |
---|
| 54 | # FIND_PACKAGE(CEGUI) |
---|
| 55 | # FIND_PACKAGE(CEGUI_OGRE) |
---|
| 56 | FIND_PACKAGE(ENet) |
---|
[1085] | 57 | FIND_PACKAGE(Boost REQUIRED thread) |
---|
[790] | 58 | FIND_PACKAGE(OpenAL) |
---|
| 59 | FIND_PACKAGE(ALUT) |
---|
| 60 | FIND_PACKAGE(OggVorbis) |
---|
[1070] | 61 | FIND_PACKAGE(ZLIB) |
---|
| 62 | FIND_PACKAGE(Lua) |
---|
[790] | 63 | |
---|
[1071] | 64 | #Set the search paths for the linking |
---|
[1070] | 65 | LINK_DIRECTORIES( |
---|
| 66 | ${OGRE_LIB_DIR} |
---|
| 67 | ${OIS_LIB_DIR} |
---|
[1071] | 68 | # ${CEGUI_LIB_DIR} ${CEGUI_OGRE_LIB_DIR} |
---|
[1070] | 69 | ${ENet_LIBRARY} |
---|
| 70 | ${Boost_LIBRARY_DIRS} |
---|
| 71 | ${Zlib_LIBRARY_DIR} |
---|
| 72 | ) |
---|
| 73 | |
---|
[1071] | 74 | #Set the search paths for include files |
---|
[1070] | 75 | INCLUDE_DIRECTORIES( |
---|
| 76 | ${OGRE_INCLUDE_DIR} |
---|
| 77 | ${OIS_INCLUDE_DIR} |
---|
[1071] | 78 | # ${CEGUI_INCLUDE_DIR} ${CEGUI_OGRE_INCLUDE_DIR} |
---|
[1070] | 79 | ${ENet_INCLUDE_DIR} |
---|
| 80 | ${Boost_INCLUDE_DIRS} |
---|
[1076] | 81 | ${OPENAL_INCLUDE_DIR} ${ALUT_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR} ${OGG_INCLUDE_DIR} |
---|
[1070] | 82 | ${Lua_INCLUDE_DIR} |
---|
| 83 | ) |
---|
[790] | 84 | |
---|
| 85 | |
---|
[1071] | 86 | ################ Source files ################### |
---|
| 87 | |
---|
[1101] | 88 | #if on a windows box, you have to generate the tolua bind files yourself |
---|
| 89 | IF(NOT WIN32) |
---|
[1076] | 90 | |
---|
[1101] | 91 | #At first, build lua |
---|
| 92 | MESSAGE(STATUS "\n******************* Building tolua... ******************\n\n") |
---|
| 93 | EXECUTE_PROCESS(COMMAND ./tolua-build) |
---|
| 94 | MESSAGE(STATUS "\n\n******************* Building tolua done ****************\n") |
---|
[1076] | 95 | |
---|
[1101] | 96 | #generate lua bind source files |
---|
| 97 | EXECUTE_PROCESS(COMMAND bin/./tolua-exec-script) |
---|
| 98 | |
---|
| 99 | ENDIF(NOT WIN32) |
---|
| 100 | |
---|
[790] | 101 | #add main source dir |
---|
| 102 | ADD_SUBDIRECTORY(src) |
---|
[1076] | 103 | |
---|