[790] | 1 | PROJECT(Orxonox) |
---|
| 2 | #set some global variables, which are used throughout the project |
---|
| 3 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
| 4 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/lib) |
---|
| 5 | |
---|
| 6 | OPTION(TESTING_ENABLED "Do you want to enable Testing") |
---|
| 7 | IF (TESTING_ENABLED) |
---|
| 8 | ENABLE_TESTING() |
---|
| 9 | ENDIF(TESTING_ENABLED) |
---|
| 10 | |
---|
| 11 | OPTION(NETWORK_TESTING_ENABLED "Do you want to build network testing tools: i.e. chatclient chatserver and alike") |
---|
| 12 | |
---|
| 13 | #Create some verbose output |
---|
| 14 | SET(CMAKE_VERBOSE_MAKEFILE TRUE) |
---|
| 15 | |
---|
| 16 | # set boost search path |
---|
| 17 | SET(Boost_INCLUDE_DIR "/usr/include/boost/") |
---|
| 18 | |
---|
| 19 | # force-set the compile on tardis machines, as default points to g++-3.3 |
---|
| 20 | # only run this test on a lunix/unix machine |
---|
| 21 | IF (UNIX) |
---|
| 22 | |
---|
| 23 | FIND_PROGRAM(UNAME_CMD "uname" |
---|
| 24 | PATHS "/usr/bin /bin") |
---|
| 25 | IF(NOT UNAME_CMD) |
---|
| 26 | MESSAGE(ERROR "Unable to find uname. Tardis-Check cannot be done.") |
---|
| 27 | ENDIF(NOT UNAME_CMD) |
---|
| 28 | |
---|
| 29 | # run uname -n to get nodename |
---|
| 30 | EXECUTE_PROCESS( |
---|
| 31 | COMMAND "${UNAME_CMD}" "-n" |
---|
| 32 | RESULT_VARIABLE UNAME_RV |
---|
| 33 | ERROR_VARIABLE UNAME_EV |
---|
| 34 | OUTPUT_VARIABLE UNAME_OV) |
---|
| 35 | |
---|
| 36 | IF (NOT "${UNAME_RV}" STREQUAL "0") |
---|
| 37 | MESSAGE(ERROR "ERROR: uname terminated unclean.") |
---|
| 38 | ENDIF (NOT "${UNAME_RV}" STREQUAL "0") |
---|
| 39 | |
---|
| 40 | # check wheter we are on a tardis machine |
---|
| 41 | IF ("${UNAME_OV}" MATCHES "tardis") |
---|
| 42 | SET (IS_TARDIS ON) |
---|
| 43 | ENDIF ("${UNAME_OV}" MATCHES "tardis") |
---|
| 44 | |
---|
| 45 | # if on tardis change compiler |
---|
| 46 | IF(IS_TARDIS) |
---|
| 47 | MESSAGE("System is a TARDIS: Setting Compiler to g++-4.1.1") |
---|
| 48 | SET(CMAKE_CXX_COMPILER "g++-4.1.1") |
---|
| 49 | # reset Boost serach path |
---|
| 50 | SET(Boost_INCLUDE_DIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include") |
---|
| 51 | ENDIF(IS_TARDIS) |
---|
| 52 | |
---|
| 53 | ENDIF (UNIX) |
---|
| 54 | |
---|
| 55 | # pipe $FLAGS to the compiler, and add some local flags. force -O2! |
---|
| 56 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O2 -Wall -g -ggdb") |
---|
| 57 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O2 -Wall -g -ggdb") |
---|
| 58 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
| 59 | |
---|
| 60 | #This sets where to look for "Find*.cmake" files |
---|
| 61 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
| 62 | #Performs the search and sets the variables |
---|
| 63 | FIND_PACKAGE(OGRE) |
---|
| 64 | FIND_PACKAGE(OIS) |
---|
| 65 | # FIND_PACKAGE(CEGUI) |
---|
| 66 | # FIND_PACKAGE(CEGUI_OGRE) |
---|
| 67 | FIND_PACKAGE(ENet) |
---|
| 68 | FIND_PACKAGE(Boost REQUIRED thread) |
---|
| 69 | FIND_PACKAGE(OpenAL) |
---|
| 70 | FIND_PACKAGE(ALUT) |
---|
| 71 | FIND_PACKAGE(OggVorbis) |
---|
[946] | 72 | FIND_PACKAGE(ZLIB) |
---|
[996] | 73 | FIND_PACKAGE(Lua) |
---|
[998] | 74 | #FIND_PACKAGE(ToLua) |
---|
[790] | 75 | |
---|
| 76 | #Sets the search paths for the linking |
---|
[946] | 77 | LINK_DIRECTORIES(${OGRE_LIB_DIR} ${OIS_LIB_DIR} ${CEGUI_LIB_DIR} ${CEGUI_OGRE_LIB_DIR} ${ENet_LIBRARY} ${Boost_LIBRARY_DIRS} ${Zlib_LIBRARY_DIR} ${Lua_LIBRARIES} core objects loader network weapon classHierarchy audio) |
---|
[790] | 78 | #Sets the search path for include files |
---|
[946] | 79 | INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${CEGUI_INCLUDE_DIR} ${CEGUI_OGRE_INCLUDE_DIR} ${ENet_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR} ${ALUT_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR} ${OGG_INCLUDE_DIR} ${Lua_INCLUDE_DIR}) |
---|
[790] | 80 | |
---|
| 81 | #Set the execution directory |
---|
| 82 | |
---|
| 83 | #add main source dir |
---|
| 84 | ADD_SUBDIRECTORY(src) |
---|