Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors committed Sep 2, 2015
2 parents 6c80f5f + c3cc02d commit 14b86ba
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 47 deletions.
2 changes: 1 addition & 1 deletion 3rdParty
Submodule 3rdParty updated 1 files
+3 −0 .gitignore
6 changes: 3 additions & 3 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -3055,9 +3055,9 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
# /DNOMINMAX - Define NOMINMAX (does what it says)
# /TP - Use C++ Compiler
!IF "$(PCH_FILE)" == ""
CFLAGS= $(SYSTEM_CFLAGS) /I"<%makefileParams.omhome%>/include/omc/cpp/" /I. <%makefileParams.includes%> /I"$(BOOST_INCLUDE)" /I"$(UMFPACK_INCLUDE)" /DNOMINMAX /TP /DNO_INTERACTIVE_DEPENDENCY <%additionalCFlags_MSVC%>
CFLAGS= $(SYSTEM_CFLAGS) /I"<%makefileParams.omhome%>/include/omc/cpp/" /I. <%makefileParams.includes%> /I"$(BOOST_INCLUDE)" /I"$(UMFPACK_INCLUDE)" /I"$(SUNDIALS_INCLUDE)" /DNOMINMAX /TP /DNO_INTERACTIVE_DEPENDENCY <%additionalCFlags_MSVC%>
!ELSE
CFLAGS= $(SYSTEM_CFLAGS) /I"<%makefileParams.omhome%>/include/omc/cpp/" /I. <%makefileParams.includes%> /I"$(BOOST_INCLUDE)" /I"$(UMFPACK_INCLUDE)" /DNOMINMAX /TP /DNO_INTERACTIVE_DEPENDENCY /Fp<%makefileParams.omhome%>/include/omc/cpp/Core/$(PCH_FILE) /YuCore/$(H_FILE) <%additionalCFlags_MSVC%>
CFLAGS= $(SYSTEM_CFLAGS) /I"<%makefileParams.omhome%>/include/omc/cpp/" /I. <%makefileParams.includes%> /I"$(BOOST_INCLUDE)" /I"$(UMFPACK_INCLUDE)" /I"$(SUNDIALS_INCLUDE)" /DNOMINMAX /TP /DNO_INTERACTIVE_DEPENDENCY /Fp<%makefileParams.omhome%>/include/omc/cpp/Core/$(PCH_FILE) /YuCore/$(H_FILE) <%additionalCFlags_MSVC%>
!ENDIF
CPPFLAGS =
# /ZI enable Edit and Continue debug info
Expand Down Expand Up @@ -3130,7 +3130,7 @@ case "gcc" then
EXEEXT=<%makefileParams.exeext%>
DLLEXT=<%makefileParams.dllext%>

CFLAGS_COMMON=<%extraCflags%> -Winvalid-pch $(SYSTEM_CFLAGS) -I"$(SCOREP_INCLUDE)" -I"$(OMHOME)/include/omc/cpp/" -I. <%makefileParams.includes%> -I"$(BOOST_INCLUDE)" -I"$(UMFPACK_INCLUDE)" <%makefileParams.includes ; separator=" "%> <%match sopt case SOME(s as SIMULATION_SETTINGS(__)) then s.cflags %> <%additionalCFlags_GCC%> <%extraCppFlags%>
CFLAGS_COMMON=<%extraCflags%> -Winvalid-pch $(SYSTEM_CFLAGS) -I"$(SCOREP_INCLUDE)" -I"$(OMHOME)/include/omc/cpp/" -I. <%makefileParams.includes%> -I"$(BOOST_INCLUDE)" -I"$(UMFPACK_INCLUDE)" -I"$(SUNDIALS_INCLUDE)" <%makefileParams.includes ; separator=" "%> <%match sopt case SOME(s as SIMULATION_SETTINGS(__)) then s.cflags %> <%additionalCFlags_GCC%> <%extraCppFlags%>

ifeq ($(USE_SCOREP),ON)
$(eval CC=scorep --user --nocompiler $(CC))
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Template/CodegenFMUCpp.tpl
Expand Up @@ -734,7 +734,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
CFLAGS_BASED_ON_INIT_FILE=<%extraCflags%>

FMU_CFLAGS=$(SYSTEM_CFLAGS:-O0=$(SIM_OR_DYNLOAD_OPT_LEVEL))
CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) -Winvalid-pch $(FMU_CFLAGS) -DRUNTIME_STATIC_LINKING -I"$(OMHOME)/include/omc/cpp" -I"$(UMFPACK_INCLUDE)" -I"$(BOOST_INCLUDE)" <%makefileParams.includes ; separator=" "%> <%additionalCFlags_GCC%>
CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) -Winvalid-pch $(FMU_CFLAGS) -DRUNTIME_STATIC_LINKING -I"$(OMHOME)/include/omc/cpp" -I"$(UMFPACK_INCLUDE)" -I"$(SUNDIALS_INCLUDE)" -I"$(BOOST_INCLUDE)" <%makefileParams.includes ; separator=" "%> <%additionalCFlags_GCC%>

ifeq ($(USE_LOGGER),ON)
$(eval CFLAGS=$(CFLAGS) -DUSE_LOGGER)
Expand Down
35 changes: 33 additions & 2 deletions Makefile.common
Expand Up @@ -25,7 +25,7 @@ INSTALL_MANDIR = ${DESTDIR}${datadir}/man/
INSTALL_JAVADIR = ${DESTDIR}${datadir}/omc/java
INSTALL_LOCALEDIR = ${DESTDIR}${datadir}/locale

.PHONY : interactive omc release all mkbuilddirs fmi test install-dirs susan susan_all susgen sustst install-openturns runtimeCPPinstall CMinpack metis Cdaskr boehm-gc
.PHONY : interactive omc release all mkbuilddirs fmi test install-dirs susan susan_all susgen sustst install-openturns runtimeCPPinstall CMinpack metis Cdaskr boehm-gc $(MINGW_EXTRA_LIBS)

mkbuilddirs:
@echo Making build directories under $(OMBUILDDIR)
Expand Down Expand Up @@ -53,7 +53,7 @@ mkbuilddirs:

release: omc

bootstrap-dependencies: graphstream $(BOOTSTRAP_FMIL_DEP)
bootstrap-dependencies: graphstream $(BOOTSTRAP_FMIL_DEP) $(MINGW_EXTRA_LIBS)
# NOTE: OpenModelicaBootstrappingHeader.h has to be regenerated without any other process writing to so/etc or you get bus errors
$(MAKE) -f $(defaultMakefileTarget) -C Compiler OpenModelicaBootstrappingHeader.h OMBUILDDIR=$(OMBUILDDIR)
$(MAKE) -f $(defaultMakefileTarget) -C Compiler/runtime install OMBUILDDIR=$(OMBUILDDIR)
Expand Down Expand Up @@ -394,6 +394,37 @@ $(OMBUILDDIR)/share/omc/java/org.omc.graphstream.jar: mkbuilddirs
graphstream-clean:
if test -f 3rdParty/graphstream/Makefile; then $(MAKE) -C 3rdParty/graphstream/ clean; fi

# build lpsolve
lpsolve: 3rdParty/lpsolve/Makefile
$(MAKE) -C 3rdParty/lpsolve/ install CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)"
3rdParty/lpsolve/Makefile: 3rdParty/lpsolve/configure.ac
(cd 3rdParty/lpsolve && autoreconf -vif && ./configure --prefix=`pwd`/build "--host=$(host)" CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)")
clean-lpsolve:
rm -rf 3rdParty/lpsolve/build
# build sqlite3
sqlite3: 3rdParty/sqlite3/Makefile
$(MAKE) -C 3rdParty/sqlite3/ install CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)"
3rdParty/sqlite3/Makefile: 3rdParty/sqlite3/configure.ac
(cd 3rdParty/sqlite3 && autoreconf -vif && automake --add-missing && ./configure --prefix=`pwd`/build "--host=$(host)" CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)")
clean-sqlite3:
rm -rf 3rdParty/sqlite3/build
# build sundials
sundials: 3rdParty/sundials/CMakeLists.txt
mkdir -p 3rdParty/sundials/build
cd 3rdParty/sundials/build && $(CMAKE) .. -G $(CMAKE_TARGET) -DCMAKE_VERBOSE_MAKEFILE:Bool=ON -DCMAKE_INSTALL_PREFIX=`pwd`
$(MAKE) -C 3rdParty/sundials/build install
# adrpo: do not copy the headers as they are not needed!
mkdir -p $(OMBUILDDIR)/include/omc/c/sundials
(cp -pufr 3rdParty/sundials/build/include/* $(OMBUILDDIR)/include/omc/c/sundials)
# copy the libs to the build/lib/omc directory
(cp -puf 3rdParty/sundials/build/lib/* $(builddir_lib_omc))
# copy the dlls to the build bin directory
(cp -puf 3rdParty/sundials/build/lib/*.dll $(builddir_bin))
clean-sundials:
if test -d 3rdParty/sundials/build ; then cd 3rdParty/sundials/build && make clean ; fi
rm -rf $(OMBUILDDIR)/include/omc/cpp/sundials
rm -f $(builddir_lib_omc)/libsundials*

sanity-check: omc
$(OMBUILDDIR)/bin/omc Examples/SanityCheck.mos

Expand Down
45 changes: 36 additions & 9 deletions Makefile.omdev.mingw
Expand Up @@ -35,6 +35,7 @@ OPENCL = Yes
LINK = cp -rl
AR = ar
# LIBGC configuration is different for Windows (this file) and Linux (Makefile.in)
MINGW_EXTRA_LIBS=sundials
LIBGC_EXTRA_CONFIGURATION=--enable-threads=posix --enable-munmap=1 --disable-parallel-mark
MSL321_CONFIG_EXTRA_FLAGS=--enable-static --disable-shared
LIBFMILIB=libfmilib.a
Expand Down Expand Up @@ -134,14 +135,11 @@ omdev_extra_dlls: install-openturns
mkdir -p $(builddir_lib)/omc/libexec/
(cp -pufr $(OMDEV)/tools/xsltproc $(builddir_lib)/omc/libexec/)
(cp -pufr $(OMDEV)/tools/gnuplot $(builddir_lib)/omc/libexec/)
(cp -puf $(OMDEV)/lib/3rdParty/Sundials/lib/release/mingw/libsundials_kinsol.a $(builddir_lib)/omc/)
(cp -puf $(OMDEV)/lib/3rdParty/Sundials/lib/release/mingw/libsundials_nvecserial.a $(builddir_lib)/omc/)
(cp -puf $(OMDEV)/lib/lis/liblis.la $(builddir_lib)/omc/)
(cp -puf $(OMDEV)/lib/lis/liblis.a $(builddir_lib)/omc/)

copycppheader:
echo Copying needed header files to the $(OMBUILDDIR)/include/omc/cpp directory
(cp -pufr $(OMDEV)/lib/3rdParty/Sundials/include $(OMBUILDDIR)/include/omc/cpp)
(mkdir -p $(OMBUILDDIR)/include/omc/cpp/boost)
(cp -puf $(BOOST_PATH)/boost/*.hpp $(OMBUILDDIR)/include/omc/cpp/boost)
(cp -pufr $(BOOST_PATH)/boost/algorithm $(OMBUILDDIR)/include/omc/cpp/boost)
Expand Down Expand Up @@ -289,14 +287,45 @@ Umfpack_msvc:
(cp -puf 3rdParty/SuiteSparse/install_msvc/lib/omc/*.lib $(OMBUILDDIR)/lib/omc/msvc/)
(cp -pur 3rdParty/SuiteSparse/install_msvc/include/omc/c/suitesparse/Include/ $(OMBUILDDIR)/include/omc/msvc/suitesparse)

runtimeCPPmsvcinstall: mkbuilddirs CMinpack_msvc copycppheader
# build sundials
sundials_msvc: 3rdParty/sundials/CMakeLists.txt
rm -f $(OMBUILDDIR)/lib/omc/msvc/sundials*
rm -f $(OMBUILDDIR)/bin/sundials*
rm -rf 3rdParty/sundials/build_msvc
mkdir -p $(OMBUILDDIR)/lib/omc/msvc/
# Goto build msvc directory
test -d 3rdParty/sundials
mkdir -p 3rdParty/sundials/build_msvc

# Create batch file, that builds with CMake and Visual Studio
test -f """${VS100COMNTOOLS}/../../VC/vcvarsall.bat"""
echo 'Building sundials with MSVC'
echo @echo on > 3rdParty/sundials/build_msvc/build.bat
echo call '"%VS100COMNTOOLS%\\..\\..\\VC\\vcvarsall.bat"' >> 3rdParty/sundials/build_msvc/build.bat
echo echo Calling CMake >> 3rdParty/sundials/build_msvc/build.bat
echo '%OMDEV%\\bin\\cmake\\bin\\cmake -DCMAKE_VERBOSE_MAKEFILE:Bool=ON -DBUILD_STATIC_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=. ../ -G "NMake Makefiles"' >> 3rdParty/sundials/build_msvc/build.bat
echo echo Building sundials >> 3rdParty/sundials/build_msvc/build.bat
echo @echo on >> 3rdParty/sundials/build_msvc/build.bat
echo set MAKE= >> 3rdParty/sundials/build_msvc/build.bat
echo set MAKEFLAGS= >> 3rdParty/sundials/build_msvc/build.bat
echo nmake /f Makefile install >> 3rdParty/sundials/build_msvc/build.bat

# Change into directory and run batch file
cd ./3rdParty/sundials/build_msvc; echo "change to 3rdParty/sundials/build_msvc";\
cmd /c build.bat

# copy dll to lib and bin folder
mkdir -p $(OMBUILDDIR)/include/omc/msvc/sundials
(cp -puf 3rdParty/sundials/build_msvc/include/* $(OMBUILDDIR)/include/omc/msvc/sundials)
(cp -puf 3rdParty/sundials/build_msvc/lib/* $(OMBUILDDIR)/lib/omc/msvc/)
(cp -puf 3rdParty/sundials/build_msvc/lib/*.dll $(OMBUILDDIR)/bin)

runtimeCPPmsvcinstall: mkbuilddirs CMinpack_msvc sundials_msvc copycppheader
$(MAKE) -C SimulationRuntime/cpp/ -f Makefile.omdev.mingw runtimeCPPmsvc OMBUILDDIR=$(OMBUILDDIR)
# mkdir -p $(OMBUILDDIR)/lib/omc/msvc/ && cp -p ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100/*.lib $(OMBUILDDIR)/lib/omc/msvc/
cp -p ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100/*.dll $(OMBUILDDIR)/bin/
cp -p $(BOOST_PATH)/lib/*vc*.dll $(OMBUILDDIR)/bin/
cp -p $(BOOST_PATH)/lib/*vc*.lib $(OMBUILDDIR)/lib/omc/cpp/msvc

simulationruntimecmsvc: mkbuilddirs Umfpack_msvc CMinpack_msvc fmil_msvc
simulationruntimecmsvc: mkbuilddirs Umfpack_msvc CMinpack_msvc fmil_msvc sundials_msvc
test -f """${VS100COMNTOOLS}/../../VC/vcvarsall.bat"""
mkdir -p $(OMBUILDDIR)/include/omc/msvc/
mkdir -p $(OMBUILDDIR)/lib/omc/msvc/debug
Expand Down Expand Up @@ -332,9 +361,7 @@ simulationruntimecmsvc: mkbuilddirs Umfpack_msvc CMinpack_msvc fmil_msvc
echo 'Copy the needed .lib/.dll files from OMDev to $(OMBUILDDIR)/lib/omc'
cp -p ${OMDEV}/lib/libf2c/*.lib $(OMBUILDDIR)/lib/omc/msvc/release/
cp -p ${OMDEV}/lib/libf2c/debug/*.lib $(OMBUILDDIR)/lib/omc/msvc/debug/
cp -p ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100/*.lib $(OMBUILDDIR)/lib/omc/msvc/
cp -p ${OMDEV}/lib/expat-win32-msvc/*.lib $(OMBUILDDIR)/lib/omc/msvc/
cp -p ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100/*.dll $(OMBUILDDIR)/bin/
cp -p ${OMDEV}/lib/lapack-win32-msvc/*.lib $(OMBUILDDIR)/lib/omc/msvc/
cp -p $(OMDEV)/lib/lis/*.lib $(OMBUILDDIR)/lib/omc/msvc/
cp -p $(OMDEV)/lib/pthread/*.* $(OMBUILDDIR)/lib/omc/msvc/
Expand Down
46 changes: 24 additions & 22 deletions SimulationRuntime/c/CMakeLists.txt
Expand Up @@ -21,19 +21,33 @@ INCLUDE_DIRECTORIES(${OMDEV}/lib/expat-win32-msvc ${OMDEV}/include/lis ${OMDEV}/
link_directories(${OMDEV}/lib/expat-win32-msvc)
link_directories(${OMDEV}/lib/lapack-win32-msvc)

IF(MSVC)
SET(Sundials_Path ${OMCTRUNCHOME}/OMCompiler/3rdParty/sundials/build_msvc)
ELSEIF(MSVC)
SET(Sundials_Path ${OMCTRUNCHOME}/OMCompiler/3rdParty/sundials/build)
ENDIF(MSVC)

MESSAGE(STATUS "Sundials path:")
MESSAGE(STATUS "${Sundials_Path}")

# SUNDIALS Header
FIND_PATH(SUNDIALS_INCLUDE_DIR sundials/sundials_config.h /usr/include /usr/local/include $ENV{INCLUDE} ${OMDEV}/lib/3rdParty/Sundials/include)
FIND_PATH(SUNDIALS_INCLUDE_DIR sundials/sundials_config.h /usr/include /usr/local/include $ENV{INCLUDE} ${Sundials_Path}/include)

# SUNDIALS Libraires
FIND_LIBRARY(SUNDIALS_LIBRARY_CVODE NAMES sundials_cvode PATHS /usr/lib /usr/local/lib $ENV{LIB} ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100)
FIND_LIBRARY(SUNDIALS_LIBRARY_IDA NAMES sundials_ida PATHS /usr/lib /usr/local/lib $ENV{LIB} ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100)
FIND_LIBRARY(SUNDIALS_LIBRARY_NVEC NAMES sundials_nvecserial PATHS /usr/lib /usr/local/lib $ENV{LIB} ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100)
FIND_LIBRARY(SUNDIALS_KINSOL NAMES sundials_kinsol PATHS /usr/lib /usr/local/lib $ENV{LIB} ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100)
MESSAGE(STATUS "Sundials include:")
MESSAGE(STATUS "${SUNDIALS_INCLUDE_DIR}")

FIND_LIBRARY(SUNDIALS_LIBRARY_CVODED NAMES sundials_cvoded PATHS /usr/lib /usr/local/lib $ENV{LIB} ${OMDEV}/lib/3rdParty/Sundials/lib/debug/vc100)
FIND_LIBRARY(SUNDIALS_LIBRARY_IDAD NAMES sundials_idad PATHS /usr/lib /usr/local/lib $ENV{LIB} ${OMDEV}/lib/3rdParty/Sundials/lib/debug/vc100)
FIND_LIBRARY(SUNDIALS_LIBRARY_NVECD NAMES sundials_nvecseriald PATHS /usr/lib /usr/local/lib $ENV{LIB} ${OMDEV}/lib/3rdParty/Sundials/lib/debug/vc100)
FIND_LIBRARY(SUNDIALS_KINSOLD NAMES sundials_kinsold PATHS /usr/lib /usr/local/lib $ENV{LIB} ${OMDEV}/lib/3rdParty/Sundials/lib/debug/vc100)
# SUNDIALS Libraires
if(MSVC)
FIND_LIBRARY(SUNDIALS_LIBRARY_CVODE NAMES sundials_cvode PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib)
FIND_LIBRARY(SUNDIALS_LIBRARY_IDA NAMES sundials_ida PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib)
FIND_LIBRARY(SUNDIALS_LIBRARY_NVEC NAMES sundials_nvecserial PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib)
FIND_LIBRARY(SUNDIALS_KINSOL NAMES sundials_kinsol PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib)
else(MSVC)
FIND_LIBRARY(SUNDIALS_LIBRARY_CVODE NAMES libsundials_cvode PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib)
FIND_LIBRARY(SUNDIALS_LIBRARY_IDA NAMES libsundials_ida PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib)
FIND_LIBRARY(SUNDIALS_LIBRARY_NVEC NAMES libsundials_nvecserial PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib)
FIND_LIBRARY(SUNDIALS_KINSOL NAMES libsundials_kinsol PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib)
endif(MSVC)

IF(SUNDIALS_INCLUDE_DIR)

Expand All @@ -51,18 +65,6 @@ ENDIF(SUNDIALS_LIBRARY_CVODE AND
SUNDIALS_LIBRARY_NVEC AND
SUNDIALS_KINSOL)

if(SUNDIALS_LIBRARY_CVODED AND
SUNDIALS_LIBRARY_IDAD AND
SUNDIALS_LIBRARY_NVECD AND
SUNDIALS_KINSOLD)

SET(SUNDIALS_DEBUG_LIBRARIES ${SUNDIALS_LIBRARY_CVODED} ${SUNDIALS_LIBRARY_IDAD} ${SUNDIALS_LIBRARY_NVECD} ${SUNDIALS_KINSOLD})

ENDIF(SUNDIALS_LIBRARY_CVODED AND
SUNDIALS_LIBRARY_IDAD AND
SUNDIALS_LIBRARY_NVECD AND
SUNDIALS_KINSOLD)

ENDIF(SUNDIALS_INCLUDE_DIR)

# Defines for Visual Studio
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/Makefile.omdev.mingw
Expand Up @@ -19,7 +19,7 @@ FC = g77
#include the sundials, ipopt from OMDev and the top_builddir for revision.h
CONFIG_CFLAGS = -O2 -falign-functions -msse2 -mfpmath=sse \
-I$(OMDEV)/lib/3rdParty/Ipopt/include/ \
-I$(OMDEV)/lib/3rdParty/Sundials/include \
-I$(top_builddir)/OMCompiler/3rdParty/sundials/build/include \
-I$(OMDEV)/include/lis -I$(top_builddir)/ -I$(builddir_inc)/ \
-Wall -Wno-unused-variable

Expand Down
26 changes: 19 additions & 7 deletions SimulationRuntime/cpp/CMakeLists.txt
Expand Up @@ -181,14 +181,20 @@ IF(WIN32)
SET(MICO_LIB_HOME $ENV{OMDEV}/lib/mico-msys-mingw/)
SET(MICO_INCLUDE_HOME $ENV{OMDEV}/include/mico-msys-mingw/)
#set sundials solvers include and library directories
SET(SUNDIALS_INLCUDE_HOME $ENV{OMDEV}/lib/3rdParty/Sundials/include)

IF(MSVC)
SET(SUNDIALS_LIBRARY_RELEASE_HOME $ENV{OMDEV}/lib/3rdParty/Sundials/lib/release/vc100)
SET(Sundials_Path "${CMAKE_SOURCE_DIR}/../../3rdParty/sundials/build_msvc")
ELSEIF(MINGW)
SET(SUNDIALS_LIBRARY_RELEASE_HOME $ENV{OMDEV}/lib/3rdParty/Sundials/lib/release/mingw/dlls)
SET(Sundials_Path "${CMAKE_SOURCE_DIR}/../../3rdParty/sundials/build")
ENDIF(MSVC)

SET(SUNDIALS_INLCUDE_HOME ${Sundials_Path}/include)
SET(SUNDIALS_LIBRARY_RELEASE_HOME ${Sundials_Path}/lib)

MESSAGE(STATUS "Sundials include:")
MESSAGE(STATUS "${SUNDIALS_INLCUDE_HOME}")
MESSAGE(STATUS "Sundials library:")
MESSAGE(STATUS "${SUNDIALS_LIBRARY_RELEASE_HOME}")

SET(INSTALL_OMDEV_LIBS ON)
ENDIF(WIN32)

Expand Down Expand Up @@ -367,7 +373,13 @@ IF(USE_SUNDIALS)
MESSAGE(FATAL_ERROR "Could not find libsundials_cvodes!")
ENDIF()

# FIND_LIBRARY(SUNDIALS_ARKODE_LIB "sundials_arkode" PATHS ${SUNDIALS_LIBRARY_RELEASE_HOME} $ENV{SUNDIALS_ROOT}/lib)
FIND_LIBRARY(SUNDIALS_CVODE_LIB "sundials_cvode" PATHS ${SUNDIALS_LIBRARY_RELEASE_HOME} $ENV{SUNDIALS_ROOT}/lib)
include_directories(${SUNDIALS_INCLUDE_DIR}/cvode ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR})
IF(NOT SUNDIALS_CVODES_LIB)
MESSAGE(FATAL_ERROR "Could not find libsundials_cvodes!")
ENDIF()

# FIND_LIBRARY(SUNDIALS_ARKODE_LIB "sundials_arkode" PATHS ${SUNDIALS_LIBRARY_RELEASE_HOME} $ENV{SUNDIALS_ROOT}/lib)
# IF(NOT SUNDIALS_ARKODE_LIB)
# MESSAGE(FATAL_ERROR "Could not find libsundials_ARKODE!")
# ENDIF()
Expand All @@ -382,10 +394,10 @@ IF(USE_SUNDIALS)
IF(NOT SUNDIALS_KINSOL_LIB)
MESSAGE(FATAL_ERROR "Could not find libsundials_kinsol!")
ENDIF()
SET(SUNDIALS_LIBRARIES ${SUNDIALS_NVECSERIAL_LIB} ${SUNDIALS_CVODES_LIB} ${SUNDIALS_IDA_LIB} ${SUNDIALS_KINSOL_LIB} ${SUNDIALS_ARKODE_LIB})
SET(SUNDIALS_LIBRARIES ${SUNDIALS_NVECSERIAL_LIB} ${SUNDIALS_CVODE_LIB} ${SUNDIALS_CVODES_LIB} ${SUNDIALS_IDA_LIB} ${SUNDIALS_KINSOL_LIB} ${SUNDIALS_ARKODE_LIB})

MESSAGE(STATUS "Sundials Libraries:")
MESSAGE(STATUS "${SUNDIALS_LIBS}")
MESSAGE(STATUS "${SUNDIALS_LIBRARIES}")
ADD_DEFINITIONS(-DPMC_USE_SUNDIALS)

# On Windows we need to install those libraries along with the SimManager
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/Core/Modelica/CMakeLists.txt
Expand Up @@ -114,7 +114,7 @@ IF(WIN32)
SET(Boost_LIBS_ "$(OMHOME)/bin")
SET(Boost_INCLUDE_ "$(OMHOME)/include/omc/cpp")
SET(SUNDIALS_LIBS_ "$(OMHOME)/bin")
SET(SUNDIALS_INCLUDE_DIR_ "$(OMHOME)/include/omc/cpp")
SET(SUNDIALS_INCLUDE_DIR_ "$(OMHOME)/include/omc/cpp/sundials")
SET(LAPACK_LIBS_ "$(OMHOME)/bin")
ELSE(WIN32)
IF("${Boost_LIBRARY_DIR}" STREQUAL "")
Expand Down
2 changes: 2 additions & 0 deletions SimulationRuntime/cpp/Solver/CVode/CMakeLists.txt
Expand Up @@ -10,6 +10,8 @@ add_precompiled_header(${CVodeName}_static Include/Core/Modelica.h )
set_target_properties(${CVodeName}_static PROPERTIES COMPILE_DEFINITIONS "RUNTIME_STATIC_LINKING")
install (TARGETS ${CVodeName}_static DESTINATION ${LIBINSTALLEXT})

MESSAGE(STATUS "Sundials Libraries used for linking:")
MESSAGE(STATUS "${SUNDIALS_LIBRARIES}")
add_library(${CVodeName} SHARED CVode.cpp CVodeSettings.cpp FactoryExport.cpp )
target_link_libraries (${CVodeName} ${SolverName} ${ExtensionUtilitiesName} ${Boost_LIBRARIES} ${SUNDIALS_LIBRARIES})
add_precompiled_header(${CVodeName} Include/Core/Modelica.h )
Expand Down

0 comments on commit 14b86ba

Please sign in to comment.