Changeset e8d0d2d in OpenModelica


Ignore:
Timestamp:
2022-06-30T20:22:09+02:00 (21 months ago)
Author:
GitHub <noreply@…>
Branches:
maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, master
Children:
1cb99ba, 4aed892b
Parents:
9ff426e4
git-author:
Mahder Gebremedhin <mahge@…> (06/30/22 20:22:09)
git-committer:
GitHub <noreply@…> (06/30/22 20:22:09)
Message:

Fix for CPP-runtime when boost is not in system directories. (#9174)

  • Make sure CPP runtime libraries can find boost headers even when boost is not installed in system directories.

We do this by linking Boost:boost (which provides access to the header
only libraries, e.g., ublas) with OMCppConfig (omc::simrt::cpp::config)

All CPP-runtime libraries link to OMCppConfig. This means all of them
will get access to boost headers transitively.

  • Make sure the ParModAuto library can find boost headers even when boost is not installed in system directories.

For this one we can link to Boost::graph (Boost::boost would have worked
equally fine)

Location:
OMCompiler/SimulationRuntime
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/SimulationRuntime/ParModelica/auto/CMakeLists.txt

    r12e1781 re8d0d2d  
    44set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/auto)
    55
    6 find_package(Boost REQUIRED COMPONENTS graph chrono)
     6find_package(Boost COMPONENTS graph chrono REQUIRED)
    77
    88set(PARMODAUTO_SOURCES om_pm_equation.cpp om_pm_interface.cpp om_pm_model.cpp pm_utility.cpp)
     
    1919target_link_libraries(ParModelicaAuto PUBLIC omc::simrt::runtime)
    2020target_link_libraries(ParModelicaAuto PUBLIC omc::3rd::tbb)
     21target_link_libraries(ParModelicaAuto PUBLIC Boost::graph)
     22
    2123target_compile_definitions(ParModelicaAuto PRIVATE USE_FLOW_SCHEDULER)
    2224
  • OMCompiler/SimulationRuntime/cpp/Core/CMakeLists.txt

    r934e149 re8d0d2d  
    244244
    245245#####################################################################################################
    246 find_package(Boost COMPONENTS filesystem REQUIRED)
    247 
    248246# OMCppSimulationSettings
    249247set(OMC_SIMRT_CPP_CORE_SIM_SETTINGS_SOURCES SimulationSettings/GlobalSettings.cpp
  • OMCompiler/SimulationRuntime/cpp/SimCoreFactory/CMakeLists.txt

    rd9b9ced9 re8d0d2d  
    33#####################################################################################################
    44# OMCppOMCFactory
    5 find_package(Boost COMPONENTS program_options filesystem REQUIRED)
    6 find_package(Threads REQUIRED)
    7 
    8 
    95set(OMC_SIMRT_CPP_SIMCOREFACTORY_OMCFACTORY_SOURCES OMCFactory/OMCFactory.cpp)
    106
  • OMCompiler/SimulationRuntime/cpp/cmake_3.14.cmake

    rd632ee4a re8d0d2d  
    22project(SimRT_CPP)
    33
    4 add_definitions(-DOMC_BUILD)
     4# add_definitions(-DOMC_BUILD)
    55
    66# CPP libs should be installed to in lib/<arch>/omc/cpp/ for now.
     
    1212
    1313
    14 # An interface library for providing common include directories for all the CPP libs.
     14# Boost and a threading library are required for the CPP-runtime.
     15find_package(Boost COMPONENTS program_options filesystem REQUIRED)
     16find_package(Threads REQUIRED)
     17
     18
     19# An interface library for providing common include directories and other settings
     20# for all the CPP-runtime libraries.
    1521add_library(OMCppConfig INTERFACE)
    1622add_library(omc::simrt::cpp::config ALIAS OMCppConfig)
    1723
     24# Make the current source directory, current binary directory (contains generated files), and
     25# the Include/ directory available to all libraries that link to OMCppConfig (which means all CPP-runtime libs)
    1826target_include_directories(OMCppConfig INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
    1927target_include_directories(OMCppConfig INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
    2028target_include_directories(OMCppConfig INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Include)
     29
     30# Make boost headers transitively available to all CPP-runtime libraries
     31# (note that they all link to 'OMCppConfig' a.k.a 'omc::simrt::cpp::config')
     32target_link_libraries(OMCppConfig INTERFACE Boost::boost)
     33
     34# This should be defined for all CPP-runtime library compilations.
     35# Signifies that we are building the source code (instead of consuming, say the headers ...).
     36target_compile_definitions(OMCppConfig INTERFACE OMC_BUILD)
    2137
    2238
Note: See TracChangeset for help on using the changeset viewer.