Skip to content

Commit b9f58eb

Browse files
committed
Change sundials install directory.
- Sundials will be installed in `<install_dir>/include/omc` instead of `<install_dir>/include/omc/c` Note the c. - More libraries should be fixed like this. Ipopt is already done some time ago. Figured that now is as good a time as any to fix sundials.
1 parent 923be1b commit b9f58eb

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

OMCompiler/Compiler/SimCode/SimCodeMain.mo

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ algorithm
686686
Boolean b;
687687
Boolean needSundials = false;
688688
String fileprefix;
689-
String install_include_dir, install_fmu_sources_dir, fmu_tmp_sources_dir;
689+
String install_include_omc_dir, install_include_omc_c_dir, install_fmu_sources_dir, fmu_tmp_sources_dir;
690690
list<String> sourceFiles, model_desc_src_files;
691691
list<String> dgesv_sources, simrt_c_sundials_sources, simrt_linear_solver_sources, simrt_non_linear_solver_sources;
692692
list<String> simrt_mixed_solver_sources, fmi_export_files, model_gen_files, model_all_gen_files, shared_source_files;
@@ -758,12 +758,13 @@ algorithm
758758
varInfo := simCode.modelInfo.varInfo;
759759

760760

761-
install_include_dir := Settings.getInstallationDirectoryPath() + "/include/omc/c/";
761+
install_include_omc_dir := Settings.getInstallationDirectoryPath() + "/include/omc/";
762+
install_include_omc_c_dir := install_include_omc_dir + "c/";
762763
install_fmu_sources_dir := Settings.getInstallationDirectoryPath() + RuntimeSources.fmu_sources_dir;
763764
fmu_tmp_sources_dir := fmutmp + "/sources/";
764765

765-
// The simrt c headers are in the include directory.
766-
copyFiles(RuntimeSources.simrt_c_headers, source=install_include_dir, destination=fmu_tmp_sources_dir);
766+
// The simrt c headers are in the include/omc/c directory.
767+
copyFiles(RuntimeSources.simrt_c_headers, source=install_include_omc_c_dir, destination=fmu_tmp_sources_dir);
767768
// The simrt C source files are installed to the folder specified by RuntimeSources.fmu_sources_dir. Copy them from there.
768769
copyFiles(RuntimeSources.simrt_c_sources, source=install_fmu_sources_dir, destination=fmu_tmp_sources_dir);
769770

@@ -780,7 +781,7 @@ algorithm
780781
// instead of just checking if flags are set only?
781782
if isSome(simCode.fmiSimulationFlags) then
782783
// The sundials headers are in the include directory.
783-
copyFiles(RuntimeSources.sundials_headers, source=install_include_dir, destination=fmu_tmp_sources_dir);
784+
copyFiles(RuntimeSources.sundials_headers, source=install_include_omc_dir, destination=fmu_tmp_sources_dir);
784785
copyFiles(RuntimeSources.simrt_c_sundials_sources, source=install_fmu_sources_dir, destination=fmu_tmp_sources_dir);
785786
simrt_c_sundials_sources := RuntimeSources.simrt_c_sundials_sources;
786787
else
@@ -801,7 +802,7 @@ algorithm
801802
// and then then they are installed to include/omc/c/fmi-export for some reason. The source, install, and source fmu location
802803
// for these files should be made consistent. For now to avoid modifing things a lot they are left as they are and copied here.
803804
fmi_export_files := if FMUVersion == "1.0" then RuntimeSources.fmi1Files else RuntimeSources.fmi2Files;
804-
copyFiles(fmi_export_files, source=install_include_dir, destination=fmu_tmp_sources_dir);
805+
copyFiles(fmi_export_files, source=install_include_omc_c_dir, destination=fmu_tmp_sources_dir);
805806

806807
System.writeFile(fmutmp+"/sources/isfmi" + (if FMUVersion=="1.0" then "1" else "2"), "");
807808

OMCompiler/Makefile.common

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,10 @@ $(builddir_lib_omc)/libsundials_ida.a: 3rdParty/sundials-5.4.0/CMakeLists.txt
617617
$(MAKE) -C 3rdParty/sundials-5.4.0/build install
618618
# Test SUNDIALS but allow it to fail
619619
#-$(MAKE) -C 3rdParty/sundials-5.4.0/build test test_install || echo "WARNING: SUNDIALS test failing, continuing any way"
620-
mkdir -p $(OMBUILDDIR)/include/omc/c/sundials
620+
mkdir -p $(builddir_inc)/sundials
621621
# adrpo: do not copy the headers as they are not needed!
622-
(cp -pfr 3rdParty/sundials-5.4.0/build/include/* $(OMBUILDDIR)/include/omc/c/sundials)
623-
cp 3rdParty/sundials-5.4.0/src/kinsol/kinsol_impl.h $(OMBUILDDIR)/include/omc/c/sundials/kinsol/
622+
(cp -pfr 3rdParty/sundials-5.4.0/build/include/* $(builddir_inc)/sundials)
623+
cp 3rdParty/sundials-5.4.0/src/kinsol/kinsol_impl.h $(builddir_inc)/sundials/kinsol/
624624
# copy the libs to the build/lib/omc directory
625625
find 3rdParty/sundials-5.4.0/build/lib* -not -type d -exec cp -apf {} $(builddir_lib_omc) ";"
626626

OMCompiler/SimulationRuntime/OMSICpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ IF(USE_SUNDIALS)
554554
SET(SUNDIALS_INLCUDE_HOME "${CMAKE_SOURCE_DIR}/../../3rdParty/sundials-5.4.0/build_msvc/include/")
555555
SET(SUNDIALS_LIBRARY_RELEASE_HOME "${CMAKE_SOURCE_DIR}/../../3rdParty/sundials-5.4.0/build_msvc/lib/")
556556
ELSE(MSVC)
557-
SET(SUNDIALS_INLCUDE_HOME ${CMAKE_INSTALL_PREFIX}/include/omc/c/sundials)
557+
SET(SUNDIALS_INLCUDE_HOME ${CMAKE_INSTALL_PREFIX}/include/omc/sundials)
558558
SET(SUNDIALS_LIBRARY_RELEASE_HOME ${CMAKE_INSTALL_PREFIX}/${LIB_OMC})
559559
ENDIF(MSVC)
560560

OMCompiler/SimulationRuntime/c/Makefile.common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LIBSIMULATIONFMI=libSimulationRuntimeFMI.a
1515
OMC_MINIMAL_RUNTIME=
1616
INCLUDE_NONFMI=-I. -I$(builddir_inc)/c
1717

18-
CPPFLAGS = -I$(OMC_CONFIG_INC) -I$(top_builddir)/Compiler/runtime -I$(top_builddir)/3rdParty/gc/include -I$(top_builddir)/3rdParty/FMIL/install/include/ -I$(top_builddir)/3rdParty/lis-1.4.12/include/ -I$(builddir_inc)/c/sundials/ -I$(builddir_inc)/c/suitesparse/ $(CONFIG_CPPFLAGS) -DGC_REDIRECT_TO_LOCAL -DLINK_SUNDIALS_STATIC
18+
CPPFLAGS = -I$(OMC_CONFIG_INC) -I$(top_builddir)/Compiler/runtime -I$(top_builddir)/3rdParty/gc/include -I$(top_builddir)/3rdParty/FMIL/install/include/ -I$(top_builddir)/3rdParty/lis-1.4.12/include/ -I$(builddir_inc)/sundials/ -I$(builddir_inc)/c/suitesparse/ $(CONFIG_CPPFLAGS) -DGC_REDIRECT_TO_LOCAL -DLINK_SUNDIALS_STATIC
1919
override CFLAGS += $(CPPFLAGS) $(CONFIG_CFLAGS) $(EXTRA_CFLAGS)
2020
# CXXFLAGS can include everything as before. For FMI we need to use relative paths since
2121
# automatic builds might not add the -I., etc

OMCompiler/SimulationRuntime/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ IF(USE_SUNDIALS)
547547
SET(SUNDIALS_INLCUDE_HOME "${CMAKE_SOURCE_DIR}/../../3rdParty/sundials-5.4.0/build_msvc/include/")
548548
SET(SUNDIALS_LIBRARY_RELEASE_HOME "${CMAKE_SOURCE_DIR}/../../3rdParty/sundials-5.4.0/build_msvc/lib/")
549549
ELSE(MSVC)
550-
SET(SUNDIALS_INLCUDE_HOME ${CMAKE_INSTALL_PREFIX}/include/omc/c/sundials)
550+
SET(SUNDIALS_INLCUDE_HOME ${CMAKE_INSTALL_PREFIX}/include/omc/sundials)
551551
SET(SUNDIALS_LIBRARY_RELEASE_HOME ${CMAKE_INSTALL_PREFIX}/${LIBINSTALLEXT}/..)
552552
ENDIF(MSVC)
553553

0 commit comments

Comments
 (0)