Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5693 for code/trunk/cmake


Ignore:
Timestamp:
Aug 29, 2009, 10:19:38 PM (15 years ago)
Author:
landauf
Message:

merged libraries branch back to trunk

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/cmake/BuildConfig.cmake

    r3330 r5693  
    3131SET(DEFAULT_LIBRARY_PATH lib)
    3232SET(DEFAULT_ARCHIVE_PATH lib/static)
     33SET(DEFAULT_MODULE_PATH  lib/modules)
    3334SET(DEFAULT_DOC_PATH     doc)
    3435SET(DEFAULT_MEDIA_PATH   media)
     
    4041SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
    4142SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
     43SET(CMAKE_MODULE_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_MODULE_PATH})
    4244# Do not set doc and media, rather check in the two subdirectories
    4345# whether they concur with the DEFAULT_..._PATH
     
    7072ENDIF()
    7173
     74# Set the extension of the dynamic modules
     75SET(ORXONOX_MODULE_EXTENSION ".module")
    7276
    7377################# OGRE Plugins ##################
     
    132136  SET(ORXONOX_LIBRARY_INSTALL_PATH ${DEFAULT_LIBRARY_PATH})
    133137  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${DEFAULT_ARCHIVE_PATH})
     138  SET(ORXONOX_MODULE_INSTALL_PATH  ${DEFAULT_MODULE_PATH})
    134139  SET(ORXONOX_DOC_INSTALL_PATH     ${DEFAULT_DOC_PATH})
    135140  SET(ORXONOX_MEDIA_INSTALL_PATH   ${DEFAULT_MEDIA_PATH})
     
    142147  SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox)
    143148  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static)
     149  SET(ORXONOX_MODULE_INSTALL_PATH  ${CMAKE_INSTALL_PREFIX}/lib/orxonox/modules)
    144150  SET(ORXONOX_DOC_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
    145151  SET(ORXONOX_MEDIA_INSTALL_PATH   ${CMAKE_INSTALL_PREFIX}/share/orxonox)
     
    152158  SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIBRARY_PATH})
    153159  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH})
     160  SET(ORXONOX_MODULE_INSTALL_PATH  ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MODULE_PATH})
    154161  SET(ORXONOX_DOC_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH})
    155162  SET(ORXONOX_MEDIA_INSTALL_PATH   ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MEDIA_PATH})
     
    167174# when building, don't use the install RPATH already
    168175# (but later on when installing)
    169 SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
     176SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
    170177
    171178# the RPATH to be used when installing
  • code/trunk/cmake/TargetUtilities.cmake

    r3371 r5693  
    2424 #    accepts a lot more input information. Simply supply the keywords
    2525 #    described below in any order you wish.
     26 #    The output is then stored in "_arg_ARGNAME" where ARGNAME is the the
     27 #    name of the switch or list.
    2628 #
    2729 #    Switches: (when given --> TRUE, FALSE otherwise)
     
    3335 #      NO_SOURCE_GROUPS:  Don't create msvc source groups
    3436 #      STATIC/SHARED:     Inherited from ADD_LIBRARY
     37 #      MODULE:            For dynamic module libraries
    3538 #      WIN32:             Inherited from ADD_EXECUTABLE
    3639 #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
    3740 #                         specified with PCH_FILE
     41 #      NO_INSTALL:        Do not install the target at all
     42 #
    3843 #    Lists:
    3944 #      LINK_LIBRARIES:    Redirects to TARGET_LINK_LIBRARIES
     
    4449 #      PCH_FILE:          Precompiled header file
    4550 #      PCH_EXCLUDE:       Source files to be excluded from PCH support
     51 #      OUTPUT_NAME:       If you want a different name than the target name
    4652 #  Note:
    4753 #    This function also installs the target!
     
    7581  SET(_switches   FIND_HEADER_FILES  EXCLUDE_FROM_ALL  ORXONOX_EXTERNAL
    7682                  NO_DLL_INTERFACE   NO_SOURCE_GROUPS  ${_additional_switches}
    77                   PCH_NO_DEFAULT NO_INSTALL)
     83                  PCH_NO_DEFAULT     NO_INSTALL        MODULE)
    7884  SET(_list_names LINK_LIBRARIES  VERSION   SOURCE_FILES  DEFINE_SYMBOL
    79                   TOLUA_FILES     PCH_FILE  PCH_EXCLUDE)
     85                  TOLUA_FILES     PCH_FILE  PCH_EXCLUDE OUTPUT_NAME)
    8086  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
    8187
     
    142148  ENDIF()
    143149
     150  # MODULE A
     151  # Always create shared libraries
     152  IF(_arg_MODULE)
     153    SET(_arg_SHARED SHARED)
     154    SET(_arg_STATIC)
     155  ENDIF()
     156
    144157  # Add the library/executable
    145158  IF("${_target_type}" STREQUAL "LIBRARY")
     
    151164  ENDIF()
    152165
     166  # MODULE B
     167  IF (_arg_MODULE)
     168    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
     169      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows
     170      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
     171    )
     172    ADD_MODULE(${_target_name})
     173  ENDIF()
     174
    153175  # LINK_LIBRARIES
    154176  IF(_arg_LINK_LIBRARIES)
     
    168190  ENDIF()
    169191
     192  # OUTPUT_NAME
     193  IF(_arg_OUTPUT_NAME)
     194    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES OUTPUT_NAME  ${_arg_OUTPUT_NAME})
     195  ENDIF()
     196
    170197  # Second part of precompiled header files
    171198  IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE)
     
    174201
    175202  IF(NOT _arg_STATIC AND NOT _arg_NO_INSTALL)
    176     INSTALL(TARGETS ${_target_name}
    177       RUNTIME DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH}
    178       LIBRARY DESTINATION ${ORXONOX_LIBRARY_INSTALL_PATH}
    179       #ARCHIVE DESTINATION ${ORXONOX_ARCHIVE_INSTALL_PATH}
     203    IF(_arg_MODULE)
     204      INSTALL(TARGETS ${_target_name}
     205        RUNTIME DESTINATION ${ORXONOX_MODULE_INSTALL_PATH}
     206        LIBRARY DESTINATION ${ORXONOX_MODULE_INSTALL_PATH}
     207      )
     208    ELSE()
     209      INSTALL(TARGETS ${_target_name}
     210        RUNTIME DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH}
     211        LIBRARY DESTINATION ${ORXONOX_LIBRARY_INSTALL_PATH}
     212      )
     213    ENDIF()
     214  ENDIF()
     215
     216ENDFUNCTION(TU_ADD_TARGET)
     217
     218
     219# Creates a helper file with name <name_of_the_library>.module
     220# This helps finding dynamically loadable modules at runtime
     221
     222FUNCTION(ADD_MODULE _target)
     223  # We use the properties to get the name because the librarys name may differ from
     224  # the target name (for example orxonox <-> liborxonox)
     225
     226  GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
     227  GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
     228
     229  IF(CMAKE_CONFIGURATION_TYPES)
     230    FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
     231      SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
     232
     233      FILE(WRITE ${_module_filename})
     234
     235      INSTALL(
     236        FILES ${_module_filename}
     237        DESTINATION ${ORXONOX_MODULE_INSTALL_PATH}
     238        CONFIGURATIONS ${_config}
     239      )
     240    ENDFOREACH()
     241  ELSE()
     242    SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
     243
     244    FILE(WRITE ${_module_filename})
     245
     246    INSTALL(
     247      FILES ${_module_filename}
     248      DESTINATION ${ORXONOX_MODULE_INSTALL_PATH}
    180249    )
    181250  ENDIF()
    182 
    183 ENDFUNCTION(TU_ADD_TARGET)
     251ENDFUNCTION(ADD_MODULE)
Note: See TracChangeset for help on using the changeset viewer.