Changeset 10624 for code/trunk/cmake/tools
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/cmake/tools/FindVLD.cmake
r10209 r10624 28 28 FIND_LIBRARY(VLD_LIBRARY 29 29 NAMES vld 30 PATH_SUFFIXES "Visual Leak Detector/lib/Win32" 30 PATH_SUFFIXES "Visual Leak Detector/lib/Win32" "../../lib/Win32" 31 31 ) 32 32 -
code/trunk/cmake/tools/TargetUtilities.cmake
r10267 r10624 35 35 # NO_SOURCE_GROUPS: Don't create msvc source groups 36 36 # 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 37 40 # WIN32: Inherited from ADD_EXECUTABLE (executables only) 38 41 # PCH_NO_DEFAULT: Do not make precompiled header files default if … … 77 80 78 81 MACRO(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}) 80 84 ENDMACRO(ORXONOX_ADD_LIBRARY) 81 85 82 86 MACRO(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}) 84 89 85 90 # When using Visual Studio we want to use the output directory as working … … 329 334 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix 330 335 ) 331 ADD_MODULE (${_target_name})336 ADD_MODULE_OR_PLUGIN(${_target_name} ${CMAKE_MODULE_OUTPUT_DIRECTORY} ${MODULE_INSTALL_DIRECTORY} ${ORXONOX_MODULE_EXTENSION}) 332 337 # Ensure that the main program depends on the module 333 338 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}) 334 348 ENDIF() 335 349 … … 372 386 IF(_arg_MODULE) 373 387 SET(_rpath "${MODULE_RPATH}") 388 ELSEIF(_arg_PLUGIN) 389 SET(_rpath "${PLUGIN_RPATH}") 374 390 ELSE() 375 391 SET(_rpath "${LIBRARY_RPATH}") … … 411 427 RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY} 412 428 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} 413 434 ) 414 435 ELSE() … … 428 449 CONFIGURATIONS ${_config} 429 450 ) 451 ELSEIF(_arg_PLUGIN) 452 INSTALL(FILES ${_location_we}.pdb 453 DESTINATION ${PLUGIN_INSTALL_DIRECTORY} 454 CONFIGURATIONS ${_config} 455 ) 430 456 ELSE() 431 457 INSTALL(FILES ${_location_we}.pdb … … 441 467 442 468 443 # Creates a helper file with name <name_of_the_library> ${ORXONOX_MODULE_EXTENSION}444 # This helps finding dynamically loadable modules at runtime445 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 472 FUNCTION(ADD_MODULE_OR_PLUGIN _target_name _output_dir _install_dir _extension) 447 473 # We use the properties to get the name because the librarys name may differ from 448 474 # the target name (for example orxonox <-> liborxonox) … … 451 477 CMAKE_POLICY(SET CMP0026 OLD) # we only use the file's name, not its actual location, so the old policy is fine 452 478 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) 455 481 IF (POLICY CMP0026) 456 482 CMAKE_POLICY(POP) # set policy back to original settings … … 459 485 IF(CMAKE_CONFIGURATION_TYPES) 460 486 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}) 464 490 465 491 INSTALL( 466 FILES ${_ module_filename}467 DESTINATION ${ MODULE_INSTALL_DIRECTORY}492 FILES ${_helper_filename} 493 DESTINATION ${_install_dir} 468 494 CONFIGURATIONS ${_config} 469 495 ) 470 496 ENDFOREACH() 471 497 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}) 475 501 476 502 INSTALL( 477 FILES ${_ module_filename}478 DESTINATION ${ MODULE_INSTALL_DIRECTORY}503 FILES ${_helper_filename} 504 DESTINATION ${_install_dir} 479 505 ) 480 506 ENDIF() 481 ENDFUNCTION(ADD_MODULE )507 ENDFUNCTION(ADD_MODULE_OR_PLUGIN)
Note: See TracChangeset
for help on using the changeset viewer.