# Matlab toolbox of functions from BDM cmake_minimum_required(VERSION 2.6) PROJECT(doprava) # Link it to BDM SET(BDM_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../library") SET(CMAKE_MODULE_PATH "${BDM_SOURCE_DIR}/system") # Load BDM environment INCLUDE(SetBdmEnv) if ( WIN32 ) # Define where the DLLs will be copied after building them. This path has # to be passed as a preprocessor definition when building AimsunDS so that # the resulting executable will know where to look for DLL files. set ( DLL_DIRECTORY "${CMAKE_SOURCE_DIR}/aimsun_bdm/dlls" ) set ( ELS_DIRECTORY "${CMAKE_SOURCE_DIR}/aimsun_bdm/els3" ) # Define macro for copying the DLLs to DLL_DIRECTORY # This is not very pretty ... we need to use different DLL names # for Debug and Release versions of the code and CMake does not offer # any property or variable that would reflect the proper target library # name. Hence, we have to use Visual Studio macros. Aaaarrrgggh. macro ( copydll DLL_TARGET DLL_DIR ) add_custom_command ( TARGET ${DLL_TARGET} POST_BUILD COMMENT "Saving a copy of the ${DLL_TARGET} DLL to ${DLL_DIR} ..." COMMAND echo md "${DLL_DIR}" COMMAND ${CMAKE_COMMAND} -E make_directory "${DLL_DIR}" COMMAND echo copy "$(TargetPath)" "${DLL_DIR}" COMMAND ${CMAKE_COMMAND} -E copy "$(TargetPath)" "${DLL_DIR}" VERBATIM ) endmacro ( copydll ) endif ( WIN32 ) include_directories (${BDM_SOURCE_DIR}/bdm) link_directories (${BDM_SOURCE_DIR}/bdm) add_subdirectory (aimsun_bdm) link_directories (./aimsun_bdm ./aimsun_bdm/eh_api ./aimsun_bdm/vgs_api) add_library(traffic_agents traffic_agent.cpp traffic_agent.h traffic_agent_offset.ppp traffic_agent_offset.h) IF(WIN32) include_directories ( aimsun_bdm/eh_api aimsun_bdm/els3/include aimsun_bdm/vgs_api ) # executable exec ( main_loop traffic_agents aimsun_bdm eh_api vgs_api ) # Delay load the following DLL libraries. Some of them will not be linked at all, # unfortunately we have no means to determine if we are building a Debug or Release # version - have we have to specify all possible DLL versions. set_property ( TARGET main_loop PROPERTY LINK_FLAGS "/DELAYLOAD:eh_api.dll /DELAYLOAD:eh_apid.dll /DELAYLOAD:vgs_api.dll /DELAYLOAD:vgs_apid.dll" ) target_link_libraries ( main_loop Delayimp.lib ) ELSE(WIN32) EXEC(main_loop aimsun_bdm traffic_agents ) ENDIF(WIN32)