Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/cmake/tools/FindVLD.cmake

    r10209 r10624  
    2828FIND_LIBRARY(VLD_LIBRARY
    2929  NAMES vld
    30   PATH_SUFFIXES "Visual Leak Detector/lib/Win32"
     30  PATH_SUFFIXES "Visual Leak Detector/lib/Win32" "../../lib/Win32"
    3131)
    3232
  • code/trunk/cmake/tools/TargetUtilities.cmake

    r10267 r10624  
    3535 #      NO_SOURCE_GROUPS:  Don't create msvc source groups
    3636 #      MODULE:            For dynamic module libraries (libraries only)
     37 #      PLUGIN:            For dynamic plugin libraries (libraries only)
     38 #                         Plugins are a special kind of modules that can be
     39 #                         loaded and unloaded during runtime on demand
    3740 #      WIN32:             Inherited from ADD_EXECUTABLE (executables only)
    3841 #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
     
    7780
    7881MACRO(ORXONOX_ADD_LIBRARY _target_name)
    79   TU_ADD_TARGET(${_target_name} LIBRARY "MODULE" ${ARGN})
     82  SET(_additional_switches MODULE PLUGIN)
     83  TU_ADD_TARGET(${_target_name} LIBRARY "${_additional_switches}" ${ARGN})
    8084ENDMACRO(ORXONOX_ADD_LIBRARY)
    8185
    8286MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
    83   TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
     87  SET(_additional_switches WIN32)
     88  TU_ADD_TARGET(${_target_name} EXECUTABLE "${_additional_switches}" ${ARGN})
    8489 
    8590  # When using Visual Studio we want to use the output directory as working
     
    329334      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
    330335    )
    331     ADD_MODULE(${_target_name})
     336    ADD_MODULE_OR_PLUGIN(${_target_name} ${CMAKE_MODULE_OUTPUT_DIRECTORY} ${MODULE_INSTALL_DIRECTORY} ${ORXONOX_MODULE_EXTENSION})
    332337    # Ensure that the main program depends on the module
    333338    SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE INTERNAL "")
     339  ENDIF()
     340
     341  # Configure plugins
     342  IF (_arg_PLUGIN)
     343    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
     344      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} # Windows
     345      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} # Unix
     346    )
     347    ADD_MODULE_OR_PLUGIN(${_target_name} ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} ${PLUGIN_INSTALL_DIRECTORY} ${ORXONOX_PLUGIN_EXTENSION})
    334348  ENDIF()
    335349
     
    372386    IF(_arg_MODULE)
    373387      SET(_rpath "${MODULE_RPATH}")
     388    ELSEIF(_arg_PLUGIN)
     389      SET(_rpath "${PLUGIN_RPATH}")
    374390    ELSE()
    375391      SET(_rpath "${LIBRARY_RPATH}")
     
    411427        RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
    412428        LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
     429      )
     430    ELSEIF(_arg_PLUGIN)
     431      INSTALL(TARGETS ${_target_name}
     432        RUNTIME DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
     433        LIBRARY DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
    413434      )
    414435    ELSE()
     
    428449            CONFIGURATIONS ${_config}
    429450          )
     451        ELSEIF(_arg_PLUGIN)
     452          INSTALL(FILES ${_location_we}.pdb
     453            DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
     454            CONFIGURATIONS ${_config}
     455          )
    430456        ELSE()
    431457          INSTALL(FILES ${_location_we}.pdb
     
    441467
    442468
    443 # Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
    444 # This helps finding dynamically loadable modules at runtime
    445 
    446 FUNCTION(ADD_MODULE _target)
     469# Creates a helper file with name <name_of_the_library>.<extension>
     470# This helps finding dynamically loadable modules or plugins at runtime
     471
     472FUNCTION(ADD_MODULE_OR_PLUGIN _target_name _output_dir _install_dir _extension)
    447473  # We use the properties to get the name because the librarys name may differ from
    448474  # the target name (for example orxonox <-> liborxonox)
     
    451477    CMAKE_POLICY(SET CMP0026 OLD) # we only use the file's name, not its actual location, so the old policy is fine
    452478  ENDIF()
    453   GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
    454   GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
     479  GET_TARGET_PROPERTY(_target_loc ${_target_name} LOCATION)
     480  GET_FILENAME_COMPONENT(_target_filename ${_target_loc} NAME_WE)
    455481  IF (POLICY CMP0026)
    456482    CMAKE_POLICY(POP) # set policy back to original settings
     
    459485  IF(CMAKE_CONFIGURATION_TYPES)
    460486    FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
    461       SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
    462 
    463       FILE(WRITE ${_module_filename})
     487      SET(_helper_filename ${_output_dir}/${_config}/${_target_filename}${_extension})
     488
     489      FILE(WRITE ${_helper_filename} ${_target_name})
    464490
    465491      INSTALL(
    466         FILES ${_module_filename}
    467         DESTINATION ${MODULE_INSTALL_DIRECTORY}
     492        FILES ${_helper_filename}
     493        DESTINATION ${_install_dir}
    468494        CONFIGURATIONS ${_config}
    469495      )
    470496    ENDFOREACH()
    471497  ELSE()
    472     SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
    473 
    474     FILE(WRITE ${_module_filename})
     498    SET(_helper_filename ${_output_dir}/${_target_filename}${_extension})
     499
     500    FILE(WRITE ${_helper_filename} ${_target_name})
    475501
    476502    INSTALL(
    477       FILES ${_module_filename}
    478       DESTINATION ${MODULE_INSTALL_DIRECTORY}
     503      FILES ${_helper_filename}
     504      DESTINATION ${_install_dir}
    479505    )
    480506  ENDIF()
    481 ENDFUNCTION(ADD_MODULE)
     507ENDFUNCTION(ADD_MODULE_OR_PLUGIN)
Note: See TracChangeset for help on using the changeset viewer.