Changeset 861 for applications/doprava

Show
Ignore:
Timestamp:
03/08/10 19:21:14 (14 years ago)
Author:
prikryl
Message:

Define ELS_DIRECTORY and DLL_DIRECTORY.
Define copydll macro.
Delay load DLLs.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/doprava/CMakeLists.txt

    r840 r861  
    1111INCLUDE(SetBdmEnv) 
    1212 
     13if ( WIN32 ) 
     14  # Define where the DLLs will be copied after building them. This path has 
     15  # to be passed as a preprocessor definition when building AimsunDS so that 
     16  # the resulting executable will know where to look for DLL files. 
     17  set ( DLL_DIRECTORY "${CMAKE_SOURCE_DIR}/aimsun_bdm/dlls" ) 
     18  set ( ELS_DIRECTORY "${CMAKE_SOURCE_DIR}/aimsun_bdm/els3" ) 
     19  # Define macro for copying the DLLs to DLL_DIRECTORY 
     20  # This is not very pretty ... we need to use different DLL names 
     21  # for Debug and Release versions of the code and CMake does not offer 
     22  # any property or variable that would reflect the proper target library 
     23  # name. Hence, we have to use Visual Studio macros. Aaaarrrgggh.   
     24  macro ( copydll DLL_TARGET DLL_DIR ) 
     25    add_custom_command ( 
     26          TARGET ${DLL_TARGET} 
     27          POST_BUILD 
     28          COMMENT "Saving a copy of the ${DLL_TARGET} DLL to ${DLL_DIR} ..." 
     29          COMMAND echo md "${DLL_DIR}" 
     30          COMMAND ${CMAKE_COMMAND} -E make_directory "${DLL_DIR}" 
     31          COMMAND echo copy "$(TargetPath)" "${DLL_DIR}" 
     32          COMMAND ${CMAKE_COMMAND} -E copy "$(TargetPath)" "${DLL_DIR}" 
     33          VERBATIM 
     34          ) 
     35  endmacro ( copydll ) 
     36endif ( WIN32 ) 
     37 
    1338include_directories (${BDM_SOURCE_DIR}/bdm) 
    1439link_directories (${BDM_SOURCE_DIR}/bdm) 
     
    2045 
    2146IF(WIN32) 
    22 include_directories ( aimsun_bdm/eh_api aimsun_bdm/els3/include aimsun_bdm/vgs_api ) 
    23         # executable 
    24         EXEC(main_loop traffic_agents aimsun_bdm eh_api vgs_api) 
     47  include_directories ( aimsun_bdm/eh_api aimsun_bdm/els3/include aimsun_bdm/vgs_api ) 
     48  # executable 
     49  exec ( main_loop traffic_agents aimsun_bdm eh_api vgs_api ) 
     50  # Delay load the following DLL libraries. Some of them will not be linked at all, 
     51  # unfortunately we have no means to determine if we are building a Debug or Release 
     52  # version - have we have to specify all possible DLL versions. 
     53  set_property ( 
     54    TARGET main_loop 
     55    PROPERTY LINK_FLAGS "/DELAYLOAD:eh_api.dll /DELAYLOAD:eh_apid.dll /DELAYLOAD:vgs_api.dll /DELAYLOAD:vgs_apid.dll" 
     56    ) 
     57  target_link_libraries ( main_loop Delayimp.lib ) 
    2558ELSE(WIN32) 
    26         EXEC(main_loop aimsun_bdm traffic_agents ) 
     59  EXEC(main_loop aimsun_bdm traffic_agents ) 
    2760ENDIF(WIN32) 
    2861