Skip to content

Commit

Permalink
Add parmodauto to OMCompiler's CMake compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mahge committed Oct 30, 2020
1 parent 20b24c4 commit 06f5b5f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 40 deletions.
2 changes: 1 addition & 1 deletion OMCompiler/SimulationRuntime/CMakeLists.txt
@@ -1,6 +1,6 @@

omc_add_subdirectory(c)
# omc_add_subdirectory(ParModelica)
omc_add_subdirectory(ParModelica)
#ADD_SUBDIRECTORY(cpp)
#ADD_SUBDIRECTORY(fmi)
#ADD_SUBDIRECTORY(interactive)
Expand Down
55 changes: 16 additions & 39 deletions OMCompiler/SimulationRuntime/ParModelica/auto/CMakeLists.txt
@@ -1,47 +1,24 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
cmake_minimum_required(VERSION 3.14)

PROJECT(ParModelicaAuto)
project(ParModelicaAuto)

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}")
find_package(Boost REQUIRED COMPONENTS graph chrono)

if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
SET(TBB_ARCHITECTURE intel64)
elseif( CMAKE_SIZEOF_VOID_P EQUAL 4 )
SET(TBB_ARCHITECTURE ia32)
set(PARMODAUTO_SOURCES om_pm_equation.cpp om_pm_interface.cpp om_pm_model.cpp pm_utility.cpp)

add_library(ParModelicaAuto STATIC)
target_sources(ParModelicaAuto PRIVATE ${PARMODAUTO_SOURCES})
if(WIN32)
target_sources(ParModelicaAuto PRIVATE pm_win_timer.cpp)
else()
MESSAGE(FATAL "Unknown Compiler Architecture")
target_sources(ParModelicaAuto PRIVATE pm_posix_timer.cpp)
endif()

FIND_PACKAGE(TBB REQUIRED)
FIND_PACKAGE(PugiXML REQUIRED)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system)

SET(PARMODELICA_SRC om_pm_equation.cpp
om_pm_interface.cpp
om_pm_model.cpp
pm_utility.cpp)

SET(PARMODELICA_TEST_SRC test_task_graph.cpp)

IF(UNIX)
SET(PARMODELICA_SRC ${PARMODELICA_SRC} pm_posix_timer.cpp)
ELSE(UNIX)
SET(PARMODELICA_SRC ${PARMODELICA_SRC} pm_win_timer.cpp)
ENDIF(UNIX)

IF(MSVC)
ADD_DEFINITIONS("/DNOMINMAX")
ENDIF()

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${PUGIXML_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(../../c)

ADD_LIBRARY(ParModelicaAuto ${PARMODELICA_SRC})

ADD_EXECUTABLE(ParModelicaAutoTest ${PARMODELICA_TEST_SRC})

TARGET_LINK_LIBRARIES(ParModelicaAutoTest ParModelicaAuto ${TBB_LIBRARY} ${PUGIXML_LIBRARY} ${Boost_SYSTEM_LIBRARY})
target_link_libraries(ParModelicaAuto PUBLIC omc::simrt::runtime)
target_link_libraries(ParModelicaAuto PUBLIC omc::3rd::tbb)
target_compile_definitions(ParModelicaAuto PRIVATE USE_FLOW_SCHEDULER)

add_executable(ParModelicaAutoTest)
target_sources(ParModelicaAutoTest PRIVATE test_task_graph.cpp)
target_link_libraries(ParModelicaAutoTest ParModelicaAuto ParModelicaAuto)

0 comments on commit 06f5b5f

Please sign in to comment.