Skip to content

Commit

Permalink
- support for boost threads added (required for hpcom)
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19602 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Marcus Walther committed Mar 17, 2014
1 parent b3a9199 commit 9769055
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
11 changes: 10 additions & 1 deletion SimulationRuntime/cpp/CMakeLists.txt
@@ -1,6 +1,13 @@
cmake_minimum_required (VERSION 2.6)

project(CppSolverInterface)
#add_definitions(-DANALYZATION_MODE)
#SET(ANALYZATION_MODE true)

IF(ANALYZATION_MODE)
message(STATUS "Using analyzation mode")
ENDIF(ANALYZATION_MODE)

# on windows boost,blas,lapack and sundial solvers from omdev is used else the installed versions are used
IF( WIN32 )
SET(ENV{BOOST_ROOT} $ENV{OMDEV}"/lib/3rdParty/boost-1_49/")
Expand Down Expand Up @@ -84,7 +91,9 @@ SET(SIMSTER_BUILD OFF)
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.45.0 COMPONENTS filesystem system serialization program_options REQUIRED)
find_package(Boost COMPONENTS filesystem system serialization program_options thread REQUIRED)
find_package(Threads REQUIRED)

# Lapack and Blas
find_package( BLAS )
find_package( LAPACK )
Expand Down
23 changes: 19 additions & 4 deletions SimulationRuntime/cpp/Core/Modelica/CMakeLists.txt
Expand Up @@ -2,7 +2,12 @@ cmake_minimum_required (VERSION 2.6)

project(${ModelicaName})

add_library(${ModelicaName} SHARED ModelicaSystem.cpp )
IF(ANALYZATION_MODE)
add_library(${ModelicaName} STATIC ModelicaSystem.cpp )
include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR})
ELSE(ANALYZATION_MODE)
add_library(${ModelicaName} SHARED ModelicaSystem.cpp )
ENDIF(ANALYZATION_MODE)

target_link_libraries (${ModelicaName} ${SystemName} ${ModelicaExternalCName} ${MathName})

Expand Down Expand Up @@ -46,14 +51,15 @@ list(GET Boost_SERIALIZATION_LIBRARY -1 Boost_SERIALIZATION_LIBRARY)
list(GET Boost_FILESYSTEM_LIBRARY -1 Boost_FILESYSTEM_LIBRARY)
list(GET Boost_SERIALIZATION_LIB -1 Boost_SERIALIZATION_LIB)
list(GET Boost_SYSTEM_LIBRARY -1 Boost_SYSTEM_LIBRARY)
list(GET Boost_THREAD_LIBRARY -1 Boost_THREAD_LIBRARY)
list(GET Boost_PROGRAM_OPTIONS_LIBRARY -1 Boost_PROGRAM_OPTIONS_LIBRARY)

IF(DEFINED ${CMAKE_BUILD_TYPE})

IF(CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
set (Boost_LIBRARIES_NEW "")
set (SKIP_ENTRY FALSE)

MESSAGE(STATUS ${Boost_LIBRARIES})
IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
foreach(f ${Boost_LIBRARIES})
IF(SKIP_ENTRY MATCHES FALSE)
Expand Down Expand Up @@ -85,8 +91,17 @@ IF(DEFINED ${CMAKE_BUILD_TYPE})
ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)

set (Boost_LIBRARIES ${Boost_LIBRARIES_NEW})
ENDIF(DEFINED ${CMAKE_BUILD_TYPE})
ENDIF(CMAKE_BUILD_TYPE)

SET(SUNDIALS_LIBS_ "")
foreach(lib ${SUNDIALS_LIBS})
set(SUNDIALS_LIBS_ "${SUNDIALS_LIBS_} ${lib}")
endforeach(lib ${SUNDIALS_LIBS})

SET(LAPACK_LIBRARIES_ "")
foreach(lib ${LAPACK_LIBRARIES})
set(LAPACK_LIBRARIES_ "${LAPACK_LIBRARIES_} ${lib}")
endforeach(lib ${LAPACK_LIBRARIES})
#end Fix

configure_file (
Expand Down
5 changes: 5 additions & 0 deletions SimulationRuntime/cpp/Core/Modelica/ModelicaConfig.inc.in
Expand Up @@ -5,8 +5,13 @@ BOOST_LIBRARIES = @Boost_LIBRARIES@
BOOST_FILESYSTEM_LIB = @Boost_FILESYSTEM_LIBRARY@
BOOST_SYSTEM_LIB = @Boost_SYSTEM_LIBRARY@
BOOST_SERIALIZATION_LIB = @Boost_SERIALIZATION_LIBRARY@
BOOST_THREAD_LIB = @Boost_THREAD_LIBRARY@
BOOST_PROGRAM_OPTIONS_LIB = @Boost_PROGRAM_OPTIONS_LIBRARY@

SUNDIALS_LIBS = @SUNDIALS_LIBS_@
SUNDIALS_INCLUDE= @SUNDIALS_INCLUDE_DIR@
LAPACK_LIBS = @LAPACK_LIBRARIES_@

MODELICA_SYSTEM_LIB_EXT = @MODELICA_SYSTEM_LIB_EXT@
FMI_ARCH_DIR = @FMI_ARCH_DIR@
LINUX_LIB_DL = @LINUX_LIB_DL@

0 comments on commit 9769055

Please sign in to comment.