Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2582


Ignore:
Timestamp:
Jan 9, 2009, 1:10:33 PM (16 years ago)
Author:
rgrieder
Message:
  • Using dependency directory directly in root dir of a branch as primary folder (./libs resp. ./dependencies) Second priority is ../libs for MinGW and ../lib_dist/vc8/dependencies for msvc.
  • Moved compiler and linker flags to ConfigPlatforms.cmake
  • Solved additional libraries for ENet under MinGW directly in FindEnet.cmake
Location:
code/branches/buildsystem2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem2/CMakeLists.txt

    r2579 r2582  
    33CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
    44
    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)
    68IF(${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 invoke cmake ..")
     9  MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! mkdir build; cd build; cmake ..")
    810ENDIF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
    911
     
    1113SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
    1214
    13 # Configre special platforms if required
     15# Set binary output directories
     16SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
     17SET(LIBRARY_OUTPUT_PATH    ${PROJECT_BINARY_DIR}/bin)
     18MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
     19
     20# Set Debug build to default when not having multi-config generator like msvc
     21IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
     22  SET(CMAKE_BUILD_TYPE "Debug")
     23ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
     24
     25############## Platform Config ##################
     26
     27# Configre platform specific options
    1428INCLUDE(ConfigPlatforms)
    1529
     
    2337OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
    2438OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
    25 
    26 ########## Compiler/Linker options ##############
    27 
    28 # Set binary output directories
    29 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")
    5439
    5540############### Library finding #################
     
    9782)
    9883
    99 # Add main source dir
     84############### Orxonox Source ##################
     85
    10086ADD_SUBDIRECTORY(src)
    10187ADD_SUBDIRECTORY(bin)
  • code/branches/buildsystem2/cmake/ConfigMSVC.cmake

    r2579 r2582  
    3232
    3333IF (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)
    3644  MARK_AS_ADVANCED(MSVC_LIBRARY_DIR)
    3745
    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)
    5059  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)
    5262  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)
    5464  SET(ZLIB_LIBRARY OPTIMIZED ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib.lib
    5565                   DEBUG     ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib_d.lib)
    5666  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")
    5787ENDIF (MSVC)
  • code/branches/buildsystem2/cmake/ConfigMinGW.cmake

    r2581 r2582  
    3232
    3333IF (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)
    3644  MARK_AS_ADVANCED(MING_LIBRARY_DIR)
    3745
     
    4149  SET(ENV{CEGUIDIR}    ${MINGW_LIBRARY_DIR}/cegui-0.6.1)
    4250  SET(ENV{ENETDIR}     ${MINGW_LIBRARY_DIR}/enet-1.1)
    43   # ENet is linked statically, hence we need to add some windows dependencies
    44   SET(ENET_ADDITIONAL_LIBRARIES ws2_32 winmm)
    4551  SET(ENV{ALUTDIR}     ${MINGW_LIBRARY_DIR}/freealut-1.1.0)
    4652  SET(ENV{OGGSDIR}     ${MINGW_LIBRARY_DIR}/libogg-1.1.3
     
    6167  ENDIF (NOT ENV{DXSDK_DIR})
    6268
    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)")
    6572ENDIF (MINGW)
    66 
    67 #MARK_AS_ADVANCED(MINGW_LIBRARY_DIR)
  • code/branches/buildsystem2/cmake/ConfigPlatforms.cmake

    r2581 r2582  
    2626 #
    2727 
    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)
    3131
    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
    3534SET(LIBRARY_DEBUG_POSTFIX "_d")
     35
     36OPTION(EXTRA_WARNINGS "Enable some extra warnings (pollutes the output heavily)")
     37IF(EXTRA_WARNINGS)
     38  SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter")
     39ELSE(EXTRA_WARNINGS)
     40  SET(ORXONOX_WARNING_FLAGS "-Wall")
     41ENDIF(EXTRA_WARNINGS)
     42
    3643MARK_AS_ADVANCED(
    37   ENET_ADDITIONAL_LIBRARIES
    38   ORXONOX_FPIC_FLAG
    3944  LIBRARY_DEBUG_POSTFIX
     45  ORXONOX_WARNINGS_FLAGS
    4046)
     47
     48###### Default Compiler/Linker Options ##########
     49# Most people use GCC to compile orxonox, so use that as default
     50
     51SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   ${ORXONOX_WARNING_FLAGS} -fPIC")
     52SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC")
     53# These flags are added to the flags above
     54SET(CMAKE_C_FLAGS_DEBUG            "    -g -ggdb")
     55SET(CMAKE_CXX_FLAGS_DEBUG          "    -g -ggdb")
     56SET(CMAKE_C_FLAGS_RELEASE          "-O3          -DNDEBUG")
     57SET(CMAKE_CXX_FLAGS_RELEASE        "-O3          -DNDEBUG")
     58SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -ggdb -DNDEBUG")
     59SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG")
     60SET(CMAKE_C_FLAGS_MINSIZEREL       "-Os          -DNDEBUG")
     61SET(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os          -DNDEBUG")
     62
     63SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
     64SET(CMAKE_EXE_LINKER_FLAGS    " --no-undefined")
     65SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
     66SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
     67
     68########## Plaform Specific Config ##############
    4169
    4270# Set the platform specific options and paths
     
    4472INCLUDE(ConfigMSVC)
    4573INCLUDE(ConfigMinGW)
     74# User can create his own file if required
     75IF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake)
     76  INCLUDE(${CMAKE_BINARY_DIR}/ConfigUser)
     77ENDIF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake)
  • code/branches/buildsystem2/cmake/FindENet.cmake

    r2581 r2582  
    4747
    4848# Set optimized and debug libraries
    49 HandleLibraryTypes(ENET ${ENET_ADDITIONAL_LIBRARIES})
     49IF(MINGW)
     50  # ENet is linked statically, hence we need to add some windows dependencies
     51  HandleLibraryTypes(ENET ws2_32 winmm)
     52ELSE(MINGW)
     53  HandleLibraryTypes(ENET)
     54ENDIF(MINGW)
    5055
    5156MARK_AS_ADVANCED(
Note: See TracChangeset for help on using the changeset viewer.