Skip to content

Commit

Permalink
- added IDA-library support for static linked cpp-runtime
Browse files Browse the repository at this point in the history
- fixed static cpp-runtime linking on windows
- all static generated libraries have now the suffix "_static"
- changed all busy-waiting tests to n=1

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24516 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Marcus Walther committed Feb 11, 2015
1 parent 337c35c commit 9b1b9b8
Show file tree
Hide file tree
Showing 23 changed files with 120 additions and 117 deletions.
2 changes: 1 addition & 1 deletion Compiler/Template/CodegenCpp.tpl
Expand Up @@ -2368,7 +2368,7 @@ case "gcc" then
let libsStr = (makefileParams.libs |> lib => lib ;separator=" ")
let libsPos1 = if not dirExtra then libsStr //else ""
let libsPos2 = if dirExtra then libsStr // else ""
let staticLibs = '$(LIBOMCPPOMCFACTORY) $(LIBOMCPPSIMCONTROLLER) $(LIBOMCPPSIMULATIONSETTINGS) $(LIBOMCPPSYSTEM) $(LIBOMCPPDATAEXCHANGE) $(LIBOMCPPNEWTON) $(LIBOMCPPUMFPACK) $(LIBOMCPPKINSOL) $(LIBOMCPPCVODE) $(LIBOMCPPSOLVER) $(LIBOMCPPMATH) $(LIBOMCPPMODELICAUTILITIES) $(SUNDIALS_LIBS) $(UMFPACK_LIBS) $(LAPACK_LIBS)'
let staticLibs = '$(LIBOMCPPOMCFACTORY) $(LIBOMCPPSIMCONTROLLER) $(LIBOMCPPSIMULATIONSETTINGS) $(LIBOMCPPSYSTEM) $(LIBOMCPPDATAEXCHANGE) $(LIBOMCPPNEWTON) $(LIBOMCPPUMFPACK) $(LIBOMCPPIDA) $(LIBOMCPPKINSOL) $(LIBOMCPPCVODE) $(LIBOMCPPSOLVER) $(LIBOMCPPMATH) $(LIBOMCPPMODELICAUTILITIES) $(SUNDIALS_LIBS) $(UMFPACK_LIBS) $(LAPACK_LIBS)'
let staticIncludes = '-I"$(SUNDIALS_INCLUDE)" -I"$(SUNDIALS_INCLUDE)/kinsol" -I"$(SUNDIALS_INCLUDE)/nvector"'
let _extraCflags = match sopt case SOME(s as SIMULATION_SETTINGS(__)) then ""
let extraCflags = '<%_extraCflags%><% if Flags.isSet(Flags.GEN_DEBUG_SYMBOLS) then " -g"%>'
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Template/CodegenFMUCpp.tpl
Expand Up @@ -536,7 +536,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
SRC+= OMCpp<%modelName%>FMU.cpp
SRC+= OMCpp<%fileNamePrefix%>CalcHelperMain.cpp
SRC+= OMCpp<%fileNamePrefix%>AlgLoopMain.cpp
LIBS= -lOMCppSystem_static -lOMCppDataExchange_static -lOMCppOMCFactory $(BASE_LIB)
LIBS= -lOMCppSystem_FMU -lOMCppDataExchange_static -lOMCppOMCFactory $(BASE_LIB)
LIBS+= $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_SERIALIZATION_LIB)
LIBS+= $(LINUX_LIB_DL)

Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/Core/DataExchange/CMakeLists.txt
Expand Up @@ -19,7 +19,7 @@ IF(NOT BOOST_STATIC_LINKING)
ENDIF(NOT BOOST_STATIC_LINKING)

if (UNIX)
set_target_properties(${DataExchangeName}_static PROPERTIES COMPILE_FLAGS -fPIC)
set_target_properties(${DataExchangeName}_static PROPERTIES COMPILE_FLAGS -fPIC)
endif(UNIX)

install (TARGETS ${DataExchangeName} DESTINATION lib/omc/${LIBINSTALLEXT})
Expand Down
18 changes: 10 additions & 8 deletions SimulationRuntime/cpp/Core/Math/CMakeLists.txt
Expand Up @@ -3,18 +3,20 @@ cmake_minimum_required (VERSION 2.6)
project(${MathName})
# add the solver default implementation library
IF(RUNTIME_STATIC_LINKING)
add_library(${MathName} STATIC ArrayOperations.cpp Functions.cpp SparseMatrix.cpp FactoryExport.cpp)
add_library(${MathName}_static STATIC ArrayOperations.cpp Functions.cpp SparseMatrix.cpp FactoryExport.cpp)
IF(UNIX)
set_target_properties(${MathName}_static PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)
install (TARGETS ${MathName}_static DESTINATION lib/omc/${LIBINSTALLEXT})
ELSE(RUNTIME_STATIC_LINKING)
add_library(${MathName} SHARED ArrayOperations.cpp Functions.cpp SparseMatrix.cpp FactoryExport.cpp)
target_link_libraries (${MathName} ${Boost_LIBRARIES} ${SUITESPARSE_LIBRARIES} ${LAPACK_LIBRARIES})
IF(UNIX)
set_target_properties(${MathName} PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)
install (TARGETS ${MathName} DESTINATION lib/omc/${LIBINSTALLEXT})
ENDIF(RUNTIME_STATIC_LINKING)

target_link_libraries (${MathName} ${Boost_LIBRARIES} ${SUITESPARSE_LIBRARIES} ${LAPACK_LIBRARIES})
IF(UNIX)
set_target_properties(${MathName} PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)

install (TARGETS ${MathName} DESTINATION lib/omc/${LIBINSTALLEXT})

install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/Math/Functions.h
${CMAKE_SOURCE_DIR}/Include/Core/Math/ArrayOperations.h
${CMAKE_SOURCE_DIR}/Include/Core/Math/Utility.h
Expand Down
25 changes: 13 additions & 12 deletions SimulationRuntime/cpp/Core/Modelica/ModelicaLibraryConfig.inc.in
@@ -1,14 +1,15 @@
LIBOMCPPOMCFACTORY = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@OMCFactoryName@.a"
LIBOMCPPSIMCONTROLLER = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SimControllerName@.a"
LIBOMCPPSIMULATIONSETTINGS = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SimulationSettings@.a"
LIBOMCPPSYSTEM = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SystemName@.a"
LIBOMCPPOMCFACTORY = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@OMCFactoryName@_static.a"
LIBOMCPPSIMCONTROLLER = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SimControllerName@_static.a"
LIBOMCPPSIMULATIONSETTINGS = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SimulationSettings@_static.a"
LIBOMCPPSYSTEM = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SystemName@_static.a"
LIBOMCPPDATAEXCHANGE = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@DataExchangeName@_static.a"
LIBOMCPPNEWTON = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@NewtonName@.a"
LIBOMCPPKINSOL = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@KinsolName@.a"
LIBOMCPPUMFPACK = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@UmfPackName@.a"
LIBOMCPPCVODE = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@CVodeName@.a"
LIBOMCPPPEER = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@PeerName@.a"
LIBOMCPPSOLVER = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SolverName@.a"
LIBOMCPPMATH = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@MathName@.a"
LIBOMCPPNEWTON = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@NewtonName@_static.a"
LIBOMCPPKINSOL = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@KinsolName@_static.a"
LIBOMCPPUMFPACK = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@UmfPackName@_static.a"
LIBOMCPPIDA = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@IDAName@_static.a"
LIBOMCPPCVODE = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@CVodeName@_static.a"
LIBOMCPPPEER = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@PeerName@_static.a"
LIBOMCPPSOLVER = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SolverName@_static.a"
LIBOMCPPMATH = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@MathName@_static.a"
LIBOMCPPMODELICAUTILITIES = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@ModelicaUtilitiesName@.a"
LIBOMCPPEXTENSIONUTILITIES = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@ExtensionUtilitiesName@.a"
LIBOMCPPEXTENSIONUTILITIES = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@ExtensionUtilitiesName@_static.a"
7 changes: 3 additions & 4 deletions SimulationRuntime/cpp/Core/SimController/CMakeLists.txt
Expand Up @@ -4,16 +4,15 @@ project(${SimControllerName})

IF(RUNTIME_STATIC_LINKING)
include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR}/kinsol ${SUNDIALS_INCLUDE_DIR})
add_library(${SimControllerName} STATIC Configuration.cpp FactoryExport.cpp Initialization.cpp SimController.cpp SimManager.cpp)
target_link_libraries( ${SimControllerName} ${SystemName} ${OMCFactoryName} ${ExtensionUtilitiesName}${ModelicaUtilitiesName} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} )
add_library(${SimControllerName}_static STATIC Configuration.cpp FactoryExport.cpp Initialization.cpp SimController.cpp SimManager.cpp)
install (TARGETS ${SimControllerName}_static DESTINATION lib/omc/${LIBINSTALLEXT})
ELSE(RUNTIME_STATIC_LINKING)
add_library(${SimControllerName} SHARED Configuration.cpp FactoryExport.cpp Initialization.cpp SimController.cpp SimManager.cpp)
target_link_libraries( ${SimControllerName} ${OMCFactoryName} ${ExtensionUtilitiesName} ${ModelicaUtilitiesName} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} )
install (TARGETS ${SimControllerName} DESTINATION lib/omc/${LIBINSTALLEXT})
ENDIF(RUNTIME_STATIC_LINKING)


install (TARGETS ${SimControllerName} DESTINATION lib/omc/${LIBINSTALLEXT})

install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/SimController/ISimData.h
${CMAKE_SOURCE_DIR}/Include/Core/SimController/ISimController.h
${CMAKE_SOURCE_DIR}/Include/Core/SimController/SimController.h
Expand Down
10 changes: 5 additions & 5 deletions SimulationRuntime/cpp/Core/SimulationSettings/CMakeLists.txt
Expand Up @@ -4,14 +4,14 @@ project(${SimulationSettings})
# add the solver default implementation library
IF(RUNTIME_STATIC_LINKING)
include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR})
add_library(${SimulationSettings} STATIC GlobalSettings.cpp Factory.cpp FactoryExport.cpp )
add_library(${SimulationSettings}_static STATIC GlobalSettings.cpp Factory.cpp FactoryExport.cpp)
install (TARGETS ${SimulationSettings}_static DESTINATION lib/omc/${LIBINSTALLEXT})
ELSE(RUNTIME_STATIC_LINKING)
add_library(${SimulationSettings} SHARED GlobalSettings.cpp Factory.cpp FactoryExport.cpp )
add_library(${SimulationSettings} SHARED GlobalSettings.cpp Factory.cpp FactoryExport.cpp)
target_link_libraries( ${SimulationSettings} ${OMCFactoryName} ${Boost_LIBRARIES})
install (TARGETS ${SimulationSettings} DESTINATION lib/omc/${LIBINSTALLEXT})
ENDIF(RUNTIME_STATIC_LINKING)
target_link_libraries( ${SimulationSettings} ${OMCFactoryName} ${Boost_LIBRARIES})


install (TARGETS ${SimulationSettings} DESTINATION lib/omc/${LIBINSTALLEXT})
install (FILES "config/GlobalSettings.xml"
DESTINATION share/omc/runtime/cpp/config)
install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/SimulationSettings/IGlobalSettings.h
Expand Down
9 changes: 5 additions & 4 deletions SimulationRuntime/cpp/Core/Solver/CMakeLists.txt
Expand Up @@ -4,14 +4,15 @@ project(${SolverName})

# add the solver default implementation library
IF(RUNTIME_STATIC_LINKING)
message(STATUS "Building Solver for analyzation")
include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR})
add_library(${SolverName} STATIC SolverDefaultImplementation.cpp SolverSettings.cpp SystemStateSelection.cpp FactoryExport.cpp SimulationMonitor.cpp )
add_library(${SolverName}_static STATIC SolverDefaultImplementation.cpp SolverSettings.cpp SystemStateSelection.cpp FactoryExport.cpp SimulationMonitor.cpp )
install (TARGETS ${SolverName}_static DESTINATION lib/omc/${LIBINSTALLEXT})
ELSE(RUNTIME_STATIC_LINKING)
add_library(${SolverName} SHARED SolverDefaultImplementation.cpp SolverSettings.cpp SystemStateSelection.cpp FactoryExport.cpp SimulationMonitor.cpp )
target_link_libraries (${SolverName} ${MathName} ${Boost_LIBRARIES} ${ExtensionUtilitiesName})
install (TARGETS ${SolverName} DESTINATION lib/omc/${LIBINSTALLEXT})
ENDIF(RUNTIME_STATIC_LINKING)
target_link_libraries (${SolverName} ${MathName} ${Boost_LIBRARIES} ${ExtensionUtilitiesName})
install (TARGETS ${SolverName} DESTINATION lib/omc/${LIBINSTALLEXT})

install (FILES
${CMAKE_SOURCE_DIR}/Include/Core/Solver/IAlgLoopSolver.h
${CMAKE_SOURCE_DIR}/Include/Core/Solver/ILinSolverSettings.h
Expand Down
32 changes: 17 additions & 15 deletions SimulationRuntime/cpp/Core/System/CMakeLists.txt
Expand Up @@ -11,28 +11,30 @@ set(BASE_LIB "" CACHE INTERNAL "" )


# add the system default implementation library
# add a static library with the system default implementation for generating c++ fmu targets
add_library(${SystemName}_FMU STATIC AlgLoopDefaultImplementation.cpp AlgLoopSolverFactory.cpp EventHandling.cpp DiscreteEvents.cpp ContinuousEvents.cpp SystemDefaultImplementation.cpp)
set_target_properties(${SystemName}_FMU PROPERTIES COMPILE_DEFINITIONS "DRUNTIME_STATIC_LINKING")
include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR}/kinsol ${SUNDIALS_INCLUDE_DIR})
if (UNIX)
set_target_properties(${SystemName}_FMU PROPERTIES COMPILE_FLAGS -fPIC)
endif(UNIX)
install (TARGETS ${SystemName}_FMU DESTINATION lib/omc/${LIBINSTALLEXT})

IF(RUNTIME_STATIC_LINKING)
add_library(${SystemName} STATIC AlgLoopDefaultImplementation.cpp AlgLoopSolverFactory.cpp EventHandling.cpp DiscreteEvents.cpp ContinuousEvents.cpp SystemDefaultImplementation.cpp FactoryExport.cpp )
add_library(${SystemName}_static STATIC AlgLoopDefaultImplementation.cpp AlgLoopSolverFactory.cpp EventHandling.cpp DiscreteEvents.cpp ContinuousEvents.cpp SystemDefaultImplementation.cpp FactoryExport.cpp)
set_target_properties(${SystemName}_static PROPERTIES COMPILE_DEFINITIONS "DRUNTIME_STATIC_LINKING")
include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR}/kinsol ${SUNDIALS_INCLUDE_DIR})
target_link_libraries (${SystemName} ${Boost_LIBRARIES} ${LAPACK_LIBRARIES} ${OMCFactoryName} )
if (UNIX)
set_target_properties(${SystemName} PROPERTIES COMPILE_FLAGS -fPIC)
endif(UNIX)
if (UNIX)
set_target_properties(${SystemName}_static PROPERTIES COMPILE_FLAGS -fPIC)
endif(UNIX)
install (TARGETS ${SystemName}_static DESTINATION lib/omc/${LIBINSTALLEXT})
ELSE(RUNTIME_STATIC_LINKING)
add_library(${SystemName} SHARED AlgLoopDefaultImplementation.cpp AlgLoopSolverFactory.cpp EventHandling.cpp DiscreteEvents.cpp ContinuousEvents.cpp SystemDefaultImplementation.cpp FactoryExport.cpp)
target_link_libraries (${SystemName} ${Boost_LIBRARIES} ${LAPACK_LIBRARIES} ${OMCFactoryName} )
ENDIF(RUNTIME_STATIC_LINKING)

# add a static library with the system default implementation for generating c++ fmu targets
add_library(${SystemName}_static STATIC AlgLoopDefaultImplementation.cpp AlgLoopSolverFactory.cpp EventHandling.cpp DiscreteEvents.cpp ContinuousEvents.cpp SystemDefaultImplementation.cpp )

target_link_libraries (${SystemName}_static ${Boost_LIBRARIES} ${LAPACK_LIBRARIES})
if (UNIX)
set_target_properties(${SystemName}_static PROPERTIES COMPILE_FLAGS -fPIC)
endif(UNIX)
install (TARGETS ${SystemName} DESTINATION lib/omc/${LIBINSTALLEXT})
ENDIF(RUNTIME_STATIC_LINKING)

install (TARGETS ${SystemName} DESTINATION lib/omc/${LIBINSTALLEXT})
install (TARGETS ${SystemName}_static DESTINATION lib/omc/${LIBINSTALLEXT})
#IF (NOT ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") OR MSVC))
#install (TARGETS ${BasiLibName} DESTINATION lib/omc/${LIBINSTALLEXT})
#ENDIF (NOT ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") OR MSVC))
Expand Down
6 changes: 0 additions & 6 deletions SimulationRuntime/cpp/Core/System/FactoryExport.h
Expand Up @@ -6,12 +6,6 @@
#define BOOST_EXTENSION_EVENTHANDLING_DECL
#define BOOST_EXTENSION_ALGLOOPDEFAULTIMPL_DECL

#elif defined(RUNTIME_STATIC_LINKING) && (defined(OMC_BUILD) || defined(SIMSTER_BUILD))

#define BOOST_EXTENSION_SYSTEM_DECL
#define BOOST_EXTENSION_EVENTHANDLING_DECL
#define BOOST_EXTENSION_ALGLOOPDEFAULTIMPL_DECL

#elif defined(OMC_BUILD) || defined(SIMSTER_BUILD)

#define BOOST_EXTENSION_SYSTEM_DECL BOOST_EXTENSION_EXPORT_DECL
Expand Down
27 changes: 17 additions & 10 deletions SimulationRuntime/cpp/Core/Utils/extension/CMakeLists.txt
Expand Up @@ -2,20 +2,27 @@ CMAKE_MINIMUM_REQUIRED (VERSION 2.6)

project(${ExtensionUtilitiesName})
IF(RUNTIME_STATIC_LINKING)
add_library(${ExtensionUtilitiesName} STATIC measure_time.cpp measure_time_rdtsc.cpp measure_time_scorep.cpp)
add_library(${ExtensionUtilitiesName}_static STATIC measure_time.cpp measure_time_rdtsc.cpp measure_time_scorep.cpp)
IF(NOT BOOST_STATIC_LINKING)
target_link_libraries (${ExtensionUtilitiesName}_static ${Boost_LIBRARIES})
ENDIF(NOT BOOST_STATIC_LINKING)
IF(UNIX)
set_target_properties(${ExtensionUtilitiesName}_static PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)

install (TARGETS ${ExtensionUtilitiesName}_static DESTINATION lib/omc/${LIBINSTALLEXT})
ELSE(RUNTIME_STATIC_LINKING)
add_library(${ExtensionUtilitiesName} SHARED measure_time.cpp measure_time_rdtsc.cpp measure_time_scorep.cpp)
ENDIF(RUNTIME_STATIC_LINKING)

IF(NOT BOOST_STATIC_LINKING)
target_link_libraries (${ExtensionUtilitiesName} ${Boost_LIBRARIES})
ENDIF(NOT BOOST_STATIC_LINKING)
IF(NOT BOOST_STATIC_LINKING)
target_link_libraries (${ExtensionUtilitiesName} ${Boost_LIBRARIES})
ENDIF(NOT BOOST_STATIC_LINKING)
IF(UNIX)
set_target_properties(${ExtensionUtilitiesName} PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)

IF(UNIX)
set_target_properties(${ExtensionUtilitiesName} PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)
install (TARGETS ${ExtensionUtilitiesName} DESTINATION lib/omc/${LIBINSTALLEXT})
ENDIF(RUNTIME_STATIC_LINKING)

install (TARGETS ${ExtensionUtilitiesName} DESTINATION lib/omc/${LIBINSTALLEXT})

install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/Utils/extension/measure_time.hpp
${CMAKE_SOURCE_DIR}/Include/Core/Utils/extension/measure_time_rdtsc.hpp
Expand Down
6 changes: 0 additions & 6 deletions SimulationRuntime/cpp/Include/Core/Modelica/FactoryExport.h
Expand Up @@ -6,12 +6,6 @@
#define BOOST_EXTENSION_EVENTHANDLING_DECL
#define BOOST_EXTENSION_ALGLOOPDEFAULTIMPL_DECL

#elif defined(RUNTIME_STATIC_LINKING) && (defined(OMC_BUILD) || defined(SIMSTER_BUILD))

#define BOOST_EXTENSION_SYSTEM_DECL
#define BOOST_EXTENSION_EVENTHANDLING_DECL
#define BOOST_EXTENSION_ALGLOOPDEFAULTIMPL_DECL

#elif defined(OMC_BUILD) || defined(SIMSTER_BUILD)

#define BOOST_EXTENSION_SYSTEM_DECL BOOST_EXTENSION_EXPORT_DECL
Expand Down
Expand Up @@ -4,7 +4,11 @@
#define BOOST_EXTENSION_MONITOR_DECL
#endif

class BOOST_EXTENSION_MONITOR_DECL SimulationMonitor
#ifdef RUNTIME_STATIC_LINKING
class SimulationMonitor
#else
class BOOST_EXTENSION_MONITOR_DECL SimulationMonitor
#endif
{
public:
SimulationMonitor();
Expand Down
Expand Up @@ -29,7 +29,11 @@ enum OUTPUT
SIMINFO = 0x00000040 ///< Write out simulation info (e.g. number of steps)
};

#ifdef RUNTIME_STATIC_LINKING
class AlgLoopDefaultImplementation
#else
class BOOST_EXTENSION_ALGLOOPDEFAULTIMPL_DECL AlgLoopDefaultImplementation
#endif
{
public:
AlgLoopDefaultImplementation();
Expand Down
7 changes: 6 additions & 1 deletion SimulationRuntime/cpp/Include/Core/System/EventHandling.h
Expand Up @@ -9,7 +9,12 @@ Holds an event queue to handle all events occured at the same time

class ContinuousEvents;
class DiscreteEvents;
class BOOST_EXTENSION_EVENTHANDLING_DECL EventHandling

#ifdef RUNTIME_STATIC_LINKING
class EventHandling
#else
class BOOST_EXTENSION_EVENTHANDLING_DECL EventHandling
#endif
{
public:
EventHandling();
Expand Down
Expand Up @@ -45,7 +45,11 @@ class InitVars
boost::unordered_map<T*, T> _start_values;
};

#ifdef RUNTIME_STATIC_LINKING
class SystemDefaultImplementation: public virtual PreVariables
#else
class BOOST_EXTENSION_SYSTEM_DECL SystemDefaultImplementation: public virtual PreVariables
#endif
{
public:
SystemDefaultImplementation(IGlobalSettings* globalSettings);
Expand Down
18 changes: 7 additions & 11 deletions SimulationRuntime/cpp/SimCoreFactory/OMCFactory/CMakeLists.txt
Expand Up @@ -5,27 +5,23 @@ project(${OMCFactoryName})
IF(RUNTIME_STATIC_LINKING)
message(STATUS "Building OMCFactory in analyzation mode")
# add the system default implementation library
add_library(${OMCFactoryName} STATIC OMCFactory.cpp StaticOMCFactory.cpp)
add_library(${OMCFactoryName}_static STATIC OMCFactory.cpp StaticOMCFactory.cpp)
#LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/../../../../build/lib/omc/${LIBINSTALLEXT})
include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR}/kinsol ${SUNDIALS_INCLUDE_DIR})

install (TARGETS ${OMCFactoryName}_static DESTINATION lib/omc/${LIBINSTALLEXT})
if (UNIX)
target_link_libraries( ${OMCFactoryName} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} ${NewtonName} ${KinsolName} ${CVodeName} ${UmfPackName} ${SimControllerName} ${CMAKE_DL_LIBS})
else (UNIX)
target_link_libraries( ${OMCFactoryName} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} ${NewtonName} ${KinsolName} ${CVodeName} ${UmfPackName} ${SimControllerName})
set_target_properties(${OMCFactoryName}_static PROPERTIES COMPILE_FLAGS -fPIC)
endif(UNIX)
ELSE(RUNTIME_STATIC_LINKING)
# add the system default implementation library
add_library(${OMCFactoryName} STATIC OMCFactory.cpp)
target_link_libraries( ${OMCFactoryName} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
install (TARGETS ${OMCFactoryName} DESTINATION lib/omc/${LIBINSTALLEXT})
if (UNIX)
set_target_properties(${OMCFactoryName} PROPERTIES COMPILE_FLAGS -fPIC)
endif(UNIX)
ENDIF(RUNTIME_STATIC_LINKING)

if (UNIX)
set_target_properties(${OMCFactoryName} PROPERTIES COMPILE_FLAGS -fPIC)
endif(UNIX)

install (TARGETS ${OMCFactoryName} DESTINATION lib/omc/${LIBINSTALLEXT})

IF(RUNTIME_STATIC_LINKING)
install (FILES
${CMAKE_SOURCE_DIR}/Include/SimCoreFactory/Policies/FactoryConfig.h
Expand Down
7 changes: 4 additions & 3 deletions SimulationRuntime/cpp/Solver/CVode/CMakeLists.txt
Expand Up @@ -5,15 +5,16 @@ include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvect

# add the solver default implementation library
IF(RUNTIME_STATIC_LINKING)
add_library(${CVodeName} STATIC CVode.cpp CVodeSettings.cpp FactoryExport.cpp )
target_link_libraries (${CVodeName} ${SolverName} ${ExtensionUtilitiesName} ${Boost_LIBRARIES} ${SUNDIALS_LIBS} ${SolverName})
add_library(${CVodeName}_static STATIC CVode.cpp CVodeSettings.cpp FactoryExport.cpp)
install (TARGETS ${CVodeName}_static DESTINATION lib/omc/${LIBINSTALLEXT})
ELSE(RUNTIME_STATIC_LINKING)
add_library(${CVodeName} SHARED CVode.cpp CVodeSettings.cpp FactoryExport.cpp )
target_link_libraries (${CVodeName} ${SolverName} ${ExtensionUtilitiesName} ${Boost_LIBRARIES} ${SUNDIALS_LIBS})
install (TARGETS ${CVodeName} DESTINATION lib/omc/${LIBINSTALLEXT})
ENDIF(RUNTIME_STATIC_LINKING)
#target_link_libraries( Euler ${Boost_serialization_LIBRARY})

install (TARGETS ${CVodeName} DESTINATION lib/omc/${LIBINSTALLEXT})

#install (FILES "../Interfaces/EulerSettings.xml"
# DESTINATION bin/config)

Expand Down

0 comments on commit 9b1b9b8

Please sign in to comment.