Changeset 2582
- Timestamp:
- Jan 9, 2009, 1:10:33 PM (16 years ago)
- Location:
- code/branches/buildsystem2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem2/CMakeLists.txt
r2579 r2582 3 3 CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) 4 4 5 # Also forbid to use the root directory as binary directory 5 ############### Various Options ################# 6 7 # Keep devs from using the root directory as binary directory (messes up the source tree) 6 8 IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) 7 MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! Mkdir a new subdir and invokecmake ..")9 MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! mkdir build; cd build; cmake ..") 8 10 ENDIF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) 9 11 … … 11 13 SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 12 14 13 # Configre special platforms if required 15 # Set binary output directories 16 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) 17 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) 18 MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) 19 20 # Set Debug build to default when not having multi-config generator like msvc 21 IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 22 SET(CMAKE_BUILD_TYPE "Debug") 23 ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 24 25 ############## Platform Config ################## 26 27 # Configre platform specific options 14 28 INCLUDE(ConfigPlatforms) 15 29 … … 23 37 OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.") 24 38 OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.") 25 26 ########## Compiler/Linker options ##############27 28 # Set binary output directories29 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)30 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)31 MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)32 33 # Compiler/Linker flags.34 IF(NOT CMAKE_BUILD_TYPE)35 SET(CMAKE_BUILD_TYPE "Debug")36 ENDIF(NOT CMAKE_BUILD_TYPE)37 #SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -Wall -Wextra -Wno-unused-parameter")38 SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -Wall ${ORXONOX_FPIC_FLAG}")39 #SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Wno-unused-parameter")40 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall ${ORXONOX_FPIC_FLAG}")41 SET(CMAKE_C_FLAGS_DEBUG "-g -ggdb")42 SET(CMAKE_CXX_FLAGS_DEBUG "-g -ggdb")43 SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")44 SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")45 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb")46 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb")47 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")48 SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")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 39 55 40 ############### Library finding ################# … … 97 82 ) 98 83 99 # Add main source dir 84 ############### Orxonox Source ################## 85 100 86 ADD_SUBDIRECTORY(src) 101 87 ADD_SUBDIRECTORY(bin) -
code/branches/buildsystem2/cmake/ConfigMSVC.cmake
r2579 r2582 32 32 33 33 IF (MSVC) 34 MESSAGE(STATUS "Running on MSVC. Using customized paths.") 35 SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8") 34 MESSAGE(STATUS "Running on MSVC. Using customized paths and options.") 35 36 # Determine library directory 37 IF(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8) 38 SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8") 39 ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/../lib_dist/vc8/dependencies/orxonox_vc8) 40 SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../lib_dist/vc8/dependencies/orxonox_vc8") 41 ELSE(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8) 42 MESSAGE(FATAL_ERROR "Could not find dependency directory for the Visual Studio libraries") 43 ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8) 36 44 MARK_AS_ADVANCED(MSVC_LIBRARY_DIR) 37 45 38 SET(BOOST_INCLUDEDIR ${MSVC_LIBRARY_DIR}/boost-1.35.0/include) 39 SET(BOOST_LIBRARYDIR ${MSVC_LIBRARY_DIR}/boost-1.35.0/lib) 40 SET(ENV{CEGUIDIR} ${MSVC_LIBRARY_DIR}/cegui-0.6.1) 41 SET(ENV{ENETDIR} ${MSVC_LIBRARY_DIR}/enet-1.2) 42 SET(ENV{ALUTDIR} ${MSVC_LIBRARY_DIR}/freealut-1.1.0) 43 SET(ENV{OGGDIR} ${MSVC_LIBRARY_DIR}/libogg-1.1.3) 44 SET(ENV{VORBISDIR} ${MSVC_LIBRARY_DIR}/libvorbis-1.2.0) 45 SET(ENV{OPENALDIR} ${MSVC_LIBRARY_DIR}/openal-1.1) 46 SET(ENV{LUA_DIR} ${MSVC_LIBRARY_DIR}/lua-5.1.3) 47 SET(ENV{OGRE_HOME} ${MSVC_LIBRARY_DIR}/ogre-1.4.9) 48 SET(TCL_INCLUDE_PATH ${MSVC_LIBRARY_DIR}/tcl-8.5.2/include) 49 SET(TCL_LIBRARY ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib) 46 # Set variables for the include directories and the libraries 47 SET(BOOST_INCLUDEDIR ${MSVC_LIBRARY_DIR}/boost-1.35.0/include) 48 SET(BOOST_LIBRARYDIR ${MSVC_LIBRARY_DIR}/boost-1.35.0/lib) 49 SET(ENV{CEGUIDIR} ${MSVC_LIBRARY_DIR}/cegui-0.6.1) 50 SET(ENV{ENETDIR} ${MSVC_LIBRARY_DIR}/enet-1.2) 51 SET(ENV{ALUTDIR} ${MSVC_LIBRARY_DIR}/freealut-1.1.0) 52 SET(ENV{OGGDIR} ${MSVC_LIBRARY_DIR}/libogg-1.1.3) 53 SET(ENV{VORBISDIR} ${MSVC_LIBRARY_DIR}/libvorbis-1.2.0) 54 SET(ENV{OPENALDIR} ${MSVC_LIBRARY_DIR}/openal-1.1) 55 SET(ENV{LUA_DIR} ${MSVC_LIBRARY_DIR}/lua-5.1.3) 56 SET(ENV{OGRE_HOME} ${MSVC_LIBRARY_DIR}/ogre-1.4.9) 57 SET(TCL_INCLUDE_PATH ${MSVC_LIBRARY_DIR}/tcl-8.5.2/include) 58 SET(TCL_LIBRARY ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib) 50 59 SET(TCL_FOUND TRUE) 51 SET(TCL_TCLSH ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib) 60 # Do some hacking to avoid "Tclsh not found" message 61 SET(TCL_TCLSH ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib) 52 62 SET(TCL_TCLSH_FOUND TRUE) 53 SET(ZLIB_INCLUDE_DIR ${MSVC_LIBRARY_DIR}/zlib-1.2.3/include)63 SET(ZLIB_INCLUDE_DIR ${MSVC_LIBRARY_DIR}/zlib-1.2.3/include) 54 64 SET(ZLIB_LIBRARY OPTIMIZED ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib.lib 55 65 DEBUG ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib_d.lib) 56 66 SET(ZLIB_FOUND TRUE) 67 68 69 # Set standard compiler flags 70 SET(CMAKE_C_FLAGS "$ENV{CFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC") 71 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC") 72 # These flags are added to the flags above 73 SET(CMAKE_C_FLAGS_DEBUG " -g -ggdb") 74 SET(CMAKE_CXX_FLAGS_DEBUG " -g -ggdb") 75 SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") 76 SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") 77 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG") 78 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG") 79 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") 80 SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") 81 82 # Linker flags 83 SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") 84 SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") 85 SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") 86 SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") 57 87 ENDIF (MSVC) -
code/branches/buildsystem2/cmake/ConfigMinGW.cmake
r2581 r2582 32 32 33 33 IF (MINGW) 34 MESSAGE(STATUS "Running on MinGW. Using customized paths.") 35 SET(MINGW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../libs") 34 MESSAGE(STATUS "Running on MinGW. Using customized paths and options.") 35 36 # Determine library directory 37 IF(EXISTS ${CMAKE_SOURCE_DIR}/libs) 38 SET(MINGW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/libs") 39 ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/../lis) 40 SET(MINGW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../libs") 41 ELSE(EXISTS ${CMAKE_SOURCE_DIR}/libs) 42 MESSAGE(FATAL_ERROR "Could not find dependency directory for the MinGW libraries") 43 ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/libs) 36 44 MARK_AS_ADVANCED(MING_LIBRARY_DIR) 37 45 … … 41 49 SET(ENV{CEGUIDIR} ${MINGW_LIBRARY_DIR}/cegui-0.6.1) 42 50 SET(ENV{ENETDIR} ${MINGW_LIBRARY_DIR}/enet-1.1) 43 # ENet is linked statically, hence we need to add some windows dependencies44 SET(ENET_ADDITIONAL_LIBRARIES ws2_32 winmm)45 51 SET(ENV{ALUTDIR} ${MINGW_LIBRARY_DIR}/freealut-1.1.0) 46 52 SET(ENV{OGGSDIR} ${MINGW_LIBRARY_DIR}/libogg-1.1.3 … … 61 67 ENDIF (NOT ENV{DXSDK_DIR}) 62 68 63 # MINGW doesn't like the -fPIC flag very much 64 SET(ORXONOX_FPIC_FLAG "") 69 # MINGW doesn't like the -fPIC flag, reconfigure flags 70 SET(CMAKE_C_FLAGS "$ENV{CFLAGS} ${ORXONOX_WARNING_FLAGS)") 71 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS)") 65 72 ENDIF (MINGW) 66 67 #MARK_AS_ADVANCED(MINGW_LIBRARY_DIR) -
code/branches/buildsystem2/cmake/ConfigPlatforms.cmake
r2581 r2582 26 26 # 27 27 28 # ############# Platform config ################29 # Do some platform specific fiddling.30 # ##############################################28 # If you want to set specific options for your platform, simply 29 # create a file called "ConfigUser.cmake" in the binary folder 30 # (see at the bottom of the file) 31 31 32 # Set some variables to default values that may be configured below 33 SET(ENET_ADDITIONAL_LIBRARIES "") 34 SET(ORXONOX_FPIC_FLAG "-fPIC") 32 ############ Misc Default Options ############### 33 35 34 SET(LIBRARY_DEBUG_POSTFIX "_d") 35 36 OPTION(EXTRA_WARNINGS "Enable some extra warnings (pollutes the output heavily)") 37 IF(EXTRA_WARNINGS) 38 SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter") 39 ELSE(EXTRA_WARNINGS) 40 SET(ORXONOX_WARNING_FLAGS "-Wall") 41 ENDIF(EXTRA_WARNINGS) 42 36 43 MARK_AS_ADVANCED( 37 ENET_ADDITIONAL_LIBRARIES38 ORXONOX_FPIC_FLAG39 44 LIBRARY_DEBUG_POSTFIX 45 ORXONOX_WARNINGS_FLAGS 40 46 ) 47 48 ###### Default Compiler/Linker Options ########## 49 # Most people use GCC to compile orxonox, so use that as default 50 51 SET(CMAKE_C_FLAGS "$ENV{CFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC") 52 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC") 53 # These flags are added to the flags above 54 SET(CMAKE_C_FLAGS_DEBUG " -g -ggdb") 55 SET(CMAKE_CXX_FLAGS_DEBUG " -g -ggdb") 56 SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") 57 SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") 58 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG") 59 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG") 60 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") 61 SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") 62 63 SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") 64 SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") 65 SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") 66 SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") 67 68 ########## Plaform Specific Config ############## 41 69 42 70 # Set the platform specific options and paths … … 44 72 INCLUDE(ConfigMSVC) 45 73 INCLUDE(ConfigMinGW) 74 # User can create his own file if required 75 IF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake) 76 INCLUDE(${CMAKE_BINARY_DIR}/ConfigUser) 77 ENDIF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake) -
code/branches/buildsystem2/cmake/FindENet.cmake
r2581 r2582 47 47 48 48 # Set optimized and debug libraries 49 HandleLibraryTypes(ENET ${ENET_ADDITIONAL_LIBRARIES}) 49 IF(MINGW) 50 # ENet is linked statically, hence we need to add some windows dependencies 51 HandleLibraryTypes(ENET ws2_32 winmm) 52 ELSE(MINGW) 53 HandleLibraryTypes(ENET) 54 ENDIF(MINGW) 50 55 51 56 MARK_AS_ADVANCED(
Note: See TracChangeset
for help on using the changeset viewer.