Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3116


Ignore:
Timestamp:
Jun 3, 2009, 8:28:37 PM (16 years ago)
Author:
rgrieder
Message:

Added new CMake functions: ORXONOX_ADD_LIBRARY and ORXONOX_ADD_EXECUTABLE.
They replace the current functions ADD_LIBRARY and ADD_EXECUTABLE to allow for clearer and easier declaration.
And it allows for GCC precompiled header file support in the first place ;)
More information can be found in TargetUtilities.cmake

Location:
code/branches/pch
Files:
3 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pch/cmake/BuildConfigGCC.cmake

    r3111 r3116  
    2323 #    Sets the right compiler and linker flags for GCC.
    2424 #
     25
     26# Shortcut for CMAKE_COMPILER_IS_GNUCXX and ..._GNUC
     27SET(CMAKE_COMPILER_IS_GNU TRUE)
    2528
    2629# Determine compiler version
  • code/branches/pch/cmake/BuildConfigMSVC.cmake

    r2710 r3116  
    2424 #
    2525
     26################### Compiler Version ####################
     27
     28# We make use of variadic macros, which is only supported by MSVC 8 and above
     29IF(MSVC_VERSION LESS 1400)
     30  MESSAGE(FATAL_ERROR "Microsoft Visual Studio versions below 8 (2005) are not supported because of missing compiler extensions.")
     31ENDIF()
     32
     33
    2634######################## Options ########################
    2735
    28 OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" FALSE)
     36IF(MSVC80)
     37  OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" FALSE)
     38ENDIF(MSVC80)
    2939
    3040#################### Compiler Flags #####################
  • code/branches/pch/src/CMakeLists.txt

    r3084 r3116  
    2222# various macro includes
    2323INCLUDE(FlagUtilities)
    24 INCLUDE(GenerateToluaBindings)
    25 INCLUDE(InstallUtilities)
    26 INCLUDE(SourceFileUtilities)
     24INCLUDE(TargetUtilities)
    2725
    2826# Use TinyXML++
     
    3230# Tolua binding speedup if required
    3331ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" Release MinSizeRel TOLUA_PARSER_RELEASE)
     32
     33# Default linking is SHARED
     34SET(ORXONOX_DEFAULT_LINK SHARED)
    3435
    3536################ OrxonoxConfig.h ################
     
    8384CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h)
    8485
     86SET(ORXONOX_CONFIG_FILES
     87  ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h
     88  ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in
     89  ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h
     90  ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in
     91)
    8592
    8693############## Include Directories ##############
  • code/branches/pch/src/bullet/CMakeLists.txt

    r2710 r3116  
    2727ADD_SUBDIRECTORY(LinearMath)
    2828
    29 GENERATE_SOURCE_GROUPS(${BULLET_FILES})
    30 
    3129# No warnings needed from third party libraries
    3230REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
    3331ADD_COMPILER_FLAGS("-w")
    3432
    35 IF(MSVC)
    36   ADD_LIBRARY(bullet_orxonox STATIC ${BULLET_FILES})
    37 ELSE(MSVC)
    38   ADD_LIBRARY(bullet_orxonox SHARED ${BULLET_FILES})
    39   ORXONOX_INSTALL(bullet_orxonox)
    40 ENDIF(MSVC)
    41 
    42 SET_TARGET_PROPERTIES(bullet_orxonox PROPERTIES VERSION 2.73)
     33ORXONOX_ADD_LIBRARY(bullet_orxonox
     34  ORXONOX_EXTERNAL
     35  NO_DLL_INTERFACE
     36  VERSION
     37    2.74
     38  SOURCE_FILES
     39    ${BULLET_FILES}
     40)
  • code/branches/pch/src/ceguilua/CMakeLists.txt

    r2710 r3116  
    7575SET(CEGUILUA_LIBRARY ceguilua_orxonox)
    7676SET(CEGUILUA_LIBRARY ${CEGUILUA_LIBRARY} PARENT_SCOPE)
    77 ADD_LIBRARY(${CEGUILUA_LIBRARY} SHARED ${CEGUILUA_FILES})
    78 SET_TARGET_PROPERTIES(${CEGUILUA_LIBRARY} PROPERTIES DEFINE_SYMBOL "CEGUILUA_EXPORTS")
    79 TARGET_LINK_LIBRARIES(${CEGUILUA_LIBRARY}
    80   tolua++_orxonox
    81   ${LUA_LIBRARIES}
    82   ${CEGUI_LIBRARY}
     77ORXONOX_ADD_LIBRARY(${CEGUILUA_LIBRARY}
     78  ORXONOX_EXTERNAL
     79  NO_SOURCE_GROUPS
     80  DEFINE_SYMBOL
     81    "CEGUILUA_EXPORTS"
     82  VERSION
     83    ${CEGUI_VERSION}
     84  LINK_LIBRARIES
     85    tolua++_orxonox
     86    ${LUA_LIBRARIES}
     87    ${CEGUI_LIBRARY}
     88  SOURCE_FILES
     89    ${CEGUILUA_FILES}
    8390)
    84 
    85 SET_TARGET_PROPERTIES(ceguilua_orxonox PROPERTIES VERSION ${CEGUI_VERSION})
    86 
    87 ORXONOX_INSTALL(ceguilua_orxonox)
  • code/branches/pch/src/core/CMakeLists.txt

    r3036 r3116  
    6363)
    6464ADD_SUBDIRECTORY(input)
    65 GET_ALL_HEADER_FILES(CORE_HDR_FILES)
    66 SET(CORE_FILES ${CORE_SRC_FILES} ${CORE_HDR_FILES})
    6765
    68 GENERATE_SOURCE_GROUPS(${CORE_FILES})
    69 GENERATE_TOLUA_BINDINGS(Core CORE_FILES INPUTFILES LuaBind.h CommandExecutor.h Game.h)
    70 
    71 ADD_LIBRARY(core SHARED ${CORE_FILES})
    72 
    73 SET_TARGET_PROPERTIES(core PROPERTIES DEFINE_SYMBOL "CORE_SHARED_BUILD")
    74 TARGET_LINK_LIBRARIES(core
    75   ${OGRE_LIBRARY}
    76   ${Boost_THREAD_LIBRARY}
    77   ${Boost_FILESYSTEM_LIBRARY}
    78   ${Boost_SYSTEM_LIBRARY}
    79   ${Boost_DATE_TIME_LIBRARY} # MSVC only
    80   ${LUA_LIBRARIES}
    81   cpptcl_orxonox
    82   ois_orxonox
    83   tinyxml++_orxonox
    84   tolua++_orxonox
    85   util
     66ORXONOX_ADD_LIBRARY(core
     67  FIND_HEADER_FILES
     68  TOLUA_FILES
     69    CommandExecutor.h
     70    Game.h
     71    LuaBind.h
     72  DEFINE_SYMBOL
     73    "CORE_SHARED_BUILD"
     74  LINK_LIBRARIES
     75    ${OGRE_LIBRARY}
     76    ${Boost_THREAD_LIBRARY}
     77    ${Boost_FILESYSTEM_LIBRARY}
     78    ${Boost_SYSTEM_LIBRARY}
     79    ${Boost_DATE_TIME_LIBRARY} # MSVC only
     80    ${LUA_LIBRARIES}
     81    cpptcl_orxonox
     82    ois_orxonox
     83    tinyxml++_orxonox
     84    tolua++_orxonox
     85    util
     86  SOURCE_FILES
     87    ${CORE_SRC_FILES}
    8688)
    87 
    88 ORXONOX_INSTALL(core)
  • code/branches/pch/src/cpptcl/CMakeLists.txt

    r2710 r3116  
    3131  details/methods_v.h
    3232)
    33 GENERATE_SOURCE_GROUPS(${CPPTCL_FILES})
    3433
    3534# No warnings needed from third party libraries
     
    3736ADD_COMPILER_FLAGS("-w")
    3837
    39 IF(MSVC)
    40   ADD_LIBRARY(cpptcl_orxonox STATIC ${CPPTCL_FILES})
    41 ELSE()
    42   ADD_LIBRARY(cpptcl_orxonox SHARED ${CPPTCL_FILES})
    43   ORXONOX_INSTALL(cpptcl_orxonox)
    44 ENDIF()
    45 
    46 TARGET_LINK_LIBRARIES(cpptcl_orxonox ${TCL_LIBRARY})
    47 
    48 SET_TARGET_PROPERTIES(cpptcl_orxonox PROPERTIES VERSION 1.1.3)
     38ORXONOX_ADD_LIBRARY(cpptcl_orxonox
     39  ORXONOX_EXTERNAL
     40  NO_DLL_INTERFACE
     41  VERSION
     42    1.1.3
     43  LINK_LIBRARIES
     44    ${TCL_LIBRARY}
     45  SOURCE_FILES
     46    ${CPPTCL_FILES}
     47)
  • code/branches/pch/src/network/CMakeLists.txt

    r3084 r3116  
    3737ADD_SUBDIRECTORY(packet)
    3838ADD_SUBDIRECTORY(synchronisable)
    39 GET_ALL_HEADER_FILES(NETWORK_HDR_FILES)
    40 SET(NETWORK_FILES ${NETWORK_SRC_FILES} ${NETWORK_HDR_FILES})
    4139
    42 GENERATE_SOURCE_GROUPS(${NETWORK_FILES})
    43 
    44 ADD_LIBRARY(network SHARED ${NETWORK_FILES})
    45 SET_TARGET_PROPERTIES(network PROPERTIES DEFINE_SYMBOL "NETWORK_SHARED_BUILD")
    46 TARGET_LINK_LIBRARIES(network
    47   ${ZLIB_LIBRARY}
    48   ${ENET_LIBRARY}
    49   ${Boost_THREAD_LIBRARY}
    50   util
    51   core
     40ORXONOX_ADD_LIBRARY(network
     41  FIND_HEADER_FILES
     42  DEFINE_SYMBOL
     43    "NETWORK_SHARED_BUILD"
     44  LINK_LIBRARIES
     45    ${ZLIB_LIBRARY}
     46    ${ENET_LIBRARY}
     47    ${Boost_THREAD_LIBRARY}
     48    util
     49    core
     50  SOURCE_FILES
     51    ${NETWORK_SRC_FILES}
    5252)
    53 
    54 ORXONOX_INSTALL(network)
  • code/branches/pch/src/ogreceguirenderer/CMakeLists.txt

    r2710 r3116  
    2727  OgreCEGUITexture.cpp
    2828)
    29 GENERATE_SOURCE_GROUPS(${OCR_FILES})
    3029
    3130# No warnings needed from third party libraries
     
    3332ADD_COMPILER_FLAGS("-w")
    3433
    35 ADD_LIBRARY(ogreceguirenderer_orxonox SHARED ${OCR_FILES})
    36 SET_TARGET_PROPERTIES(ogreceguirenderer_orxonox PROPERTIES DEFINE_SYMBOL "OGRE_GUIRENDERER_EXPORTS")
    37 TARGET_LINK_LIBRARIES(ogreceguirenderer_orxonox
    38   ${OGRE_LIBRARY}
    39   ${CEGUI_LIBRARY}
     34ORXONOX_ADD_LIBRARY(ogreceguirenderer_orxonox
     35  ORXONOX_EXTERNAL
     36  LINK_LIBRARIES
     37    ${OGRE_LIBRARY}
     38    ${CEGUI_LIBRARY}
     39  DEFINE_SYMBOL
     40    "OGRE_GUIRENDERER_EXPORTS"
     41  VERSION
     42    1.4.9
     43  SOURCE_FILES
     44    ${OCR_FILES}
    4045)
    41 
    42 SET_TARGET_PROPERTIES(ogreceguirenderer_orxonox PROPERTIES VERSION 1.4.9)
    43 
    44 ORXONOX_INSTALL(ogreceguirenderer_orxonox)
  • code/branches/pch/src/ois/CMakeLists.txt

    r2710 r3116  
    5050ENDIF()
    5151
    52 GENERATE_SOURCE_GROUPS(${OIS_FILES})
    53 
    5452# No warnings needed from third party libraries
    5553REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
     
    5856INCLUDE_DIRECTORIES(.)
    5957
    60 ADD_LIBRARY(ois_orxonox SHARED ${OIS_FILES})
    61 SET_TARGET_PROPERTIES(ois_orxonox PROPERTIES DEFINE_SYMBOL "OIS_NONCLIENT_BUILD")
     58ORXONOX_ADD_LIBRARY(ois_orxonox
     59  ORXONOX_EXTERNAL
     60  DEFINE_SYMBOL
     61    "OIS_NONCLIENT_BUILD"
     62  VERSION
     63    1.2
     64  SOURCE_FILES
     65    ${OIS_FILES}
     66)
    6267
    6368IF(WIN32)
    6469  TARGET_LINK_LIBRARIES(ois_orxonox ${DIRECTX_LIBRARIES})
    6570ENDIF()
    66 
    67 SET_TARGET_PROPERTIES(ois_orxonox PROPERTIES VERSION 1.2)
    68 
    69 ORXONOX_INSTALL(ois_orxonox)
  • code/branches/pch/src/orxonox/CMakeLists.txt

    r3110 r3116  
    3030ADD_SUBDIRECTORY(objects)
    3131ADD_SUBDIRECTORY(overlays)
     32ADD_SUBDIRECTORY(sound)
    3233ADD_SUBDIRECTORY(tools)
    33 ADD_SUBDIRECTORY(sound)
    34 GET_ALL_HEADER_FILES(ORXONOX_HDR_FILES)
    35 SET(ORXONOX_FILES ${ORXONOX_SRC_FILES} ${ORXONOX_HDR_FILES})
    3634
    37 GENERATE_SOURCE_GROUPS(${ORXONOX_FILES})
    38 GENERATE_TOLUA_BINDINGS(Orxonox ORXONOX_FILES INPUTFILES gui/GUIManager.h objects/quest/QuestManager.h objects/quest/QuestDescription.h objects/pickup/PickupInventory.h objects/pickup/BaseItem.h)
     35ORXONOX_ADD_EXECUTABLE(orxonox
     36  FIND_HEADER_FILES
     37  TOLUA_FILES
     38    gui/GUIManager.h
     39    objects/pickup/BaseItem.h
     40    objects/pickup/PickupInventory.h
     41    objects/quest/QuestDescription.h
     42    objects/quest/QuestManager.h
     43  LINK_LIBRARIES
     44    ${OGRE_LIBRARY}
     45    ${CEGUI_LIBRARY}
     46    ${LUA_LIBRARIES}
     47    ${CEGUILUA_LIBRARY}
     48    ${Boost_SYSTEM_LIBRARY}
     49    ${OPENAL_LIBRARY}
     50    ${ALUT_LIBRARY}
     51    ${VORBISFILE_LIBRARY}
     52    ${VORBIS_LIBRARY}
     53    ${OGG_LIBRARY}
     54    ogreceguirenderer_orxonox
     55    tinyxml++_orxonox
     56    tolua++_orxonox
     57    bullet_orxonox
     58    util
     59    core
     60    network
     61  SOURCE_FILES ${ORXONOX_SRC_FILES}
     62)
    3963
    40 ADD_EXECUTABLE(orxonox ${ORXONOX_FILES})
    4164GET_TARGET_PROPERTY(_exec_loc orxonox LOCATION)
    4265GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
    4366SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
    44 
    45 TARGET_LINK_LIBRARIES(orxonox
    46   ${OGRE_LIBRARY}
    47   ${CEGUI_LIBRARY}
    48   ${LUA_LIBRARIES}
    49   ${CEGUILUA_LIBRARY}
    50   ${Boost_SYSTEM_LIBRARY}
    51   ${OPENAL_LIBRARY}
    52   ${ALUT_LIBRARY}
    53   ${VORBISFILE_LIBRARY}
    54   ${VORBIS_LIBRARY}
    55   ${OGG_LIBRARY}
    56   ogreceguirenderer_orxonox
    57   tinyxml++_orxonox
    58   tolua++_orxonox
    59   bullet_orxonox
    60   util
    61   core
    62   network
    63 )
    64 
    65 ORXONOX_INSTALL(orxonox)
    6667
    6768
  • code/branches/pch/src/tinyxml/CMakeLists.txt

    r2710 r3116  
    3030  tinyxmlparser.cpp
    3131)
    32 GENERATE_SOURCE_GROUPS(${TINYXML++_FILES})
    3332
    3433# No warnings needed from third party libraries
     
    3635ADD_COMPILER_FLAGS("-w")
    3736
    38 IF(MSVC)
    39   ADD_LIBRARY(tinyxml++_orxonox STATIC ${TINYXML++_FILES})
    40 ELSE()
    41   ADD_LIBRARY(tinyxml++_orxonox SHARED ${TINYXML++_FILES})
    42   ORXONOX_INSTALL(tinyxml++_orxonox)
    43 ENDIF()
    44 
    45 SET_TARGET_PROPERTIES(tinyxml++_orxonox PROPERTIES VERSION 2.5.3)
     37ORXONOX_ADD_LIBRARY(tinyxml++_orxonox
     38  ORXONOX_EXTERNAL
     39  NO_DLL_INTERFACE
     40  VERSION
     41    2.5.3
     42  SOURCE_FILES
     43    ${TINYXML++_FILES}
     44)
  • code/branches/pch/src/tolua/CMakeLists.txt

    r2710 r3116  
    3636ADD_COMPILER_FLAGS("-w")
    3737
    38 ADD_LIBRARY(tolua++_orxonox SHARED ${TOLUA++_FILES})
    39 SET_TARGET_PROPERTIES(tolua++_orxonox PROPERTIES DEFINE_SYMBOL "TOLUA_SHARED_BUILD")
    40 TARGET_LINK_LIBRARIES(tolua++_orxonox ${LUA_LIBRARIES})
    41 
    42 SET_TARGET_PROPERTIES(tolua++_orxonox PROPERTIES VERSION 1.0.92)
    43 
    44 ORXONOX_INSTALL(tolua++_orxonox)
     38ORXONOX_ADD_LIBRARY(tolua++_orxonox
     39  ORXONOX_EXTERNAL
     40  DEFINE_SYMBOL
     41    "TOLUA_SHARED_BUILD"
     42  VERSION
     43    1.0.92
     44  LINK_LIBRARIES
     45    ${LUA_LIBRARIES}
     46  SOURCE_FILES
     47    ${TOLUA++_FILES}
     48)
    4549
    4650
    4751################## Tolua++ generator ##################
    4852
    49 ADD_EXECUTABLE(tolua++app_orxonox tolua.c)
    50 TARGET_LINK_LIBRARIES(tolua++app_orxonox tolua++_orxonox ${LUA_LIBRARIES})
     53ORXONOX_ADD_EXECUTABLE(tolua++app_orxonox
     54  ORXONOX_EXTERNAL
     55  VERSION
     56    1.0.92
     57  LINK_LIBRARIES
     58    ${LUA_LIBRARIES}
     59  SOURCE_FILES
     60    tolua.c
     61)
    5162
    5263OPTION(TOLUA_PARSER_RELEASE "Disable all debug messages from tolua bind files for Release and MinSizeRel build types." FALSE)
  • code/branches/pch/src/util/CMakeLists.txt

    r3089 r3116  
    5252  SubString.cc
    5353)
    54 #GET_ALL_HEADER_FILES(UTIL_HDR_FILES)
    55 #SET(UTIL_FILES ${UTIL_SRC_FILES} ${UTIL_HDR_FILES})
    56 GENERATE_SOURCE_GROUPS(${UTIL_FILES})
    57 # Also add OrxonoxConfig to have it least somewhere in the IDE
    58 LIST(APPEND UTIL_FILES
    59   ${CMAKE_BINARY_DIR}/src/OrxonoxConfig.h
    60   ${CMAKE_SOURCE_DIR}/src/OrxonoxConfig.h.in
    61   ${CMAKE_BINARY_DIR}/src/SpecialConfig.h
    62   ${CMAKE_SOURCE_DIR}/src/SpecialConfig.h.in
    63 )
    64 SOURCE_GROUP("" FILES
    65   ${CMAKE_BINARY_DIR}/src/OrxonoxConfig.h
    66   ${CMAKE_SOURCE_DIR}/src/OrxonoxConfig.h.in
    67   ${CMAKE_BINARY_DIR}/src/SpecialConfig.h
    68   ${CMAKE_SOURCE_DIR}/src/SpecialConfig.h.in
    69 )
    7054
    7155IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
     
    7458ENDIF()
    7559
    76 ADD_LIBRARY(util SHARED ${UTIL_FILES})
    77 SET_TARGET_PROPERTIES(util PROPERTIES DEFINE_SYMBOL "UTIL_SHARED_BUILD")
    78 TARGET_LINK_LIBRARIES(util ${OGRE_LIBRARY})
    79 
    80 ORXONOX_INSTALL(util)
     60ORXONOX_ADD_LIBRARY(util
     61  #FIND_HEADER_FILES
     62  DEFINE_SYMBOL
     63    "UTIL_SHARED_BUILD"
     64  LINK_LIBRARIES
     65    ${OGRE_LIBRARY}
     66  SOURCE_FILES
     67    ${UTIL_FILES}
     68)
Note: See TracChangeset for help on using the changeset viewer.