Skip to content

Commit c9691ae

Browse files
committed
[cmake] Update source FMU config.
- The source FMU handling code has been updated for the normal build since it was easier to change change it than to try and follow it. This changes reflect that for the CMake config.
1 parent 683c6a4 commit c9691ae

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

OMCompiler/SimulationRuntime/c/RuntimeSources.mo.cmake

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
11
encapsulated package RuntimeSources
22
constant String fmu_sources_dir = "/@SOURCE_FMU_SOURCES_DIR@";
33

4-
constant list<String> commonFiles={@SOURCE_FMU_COMMON_FILES@};
4+
constant list<String> simrt_c_sources={@SOURCE_FMU_COMMON_FILES@};
55

6-
constant list<String> commonHeaders={@SOURCE_FMU_COMMON_HEADERS@};
6+
constant list<String> simrt_c_headers={@SOURCE_FMU_COMMON_HEADERS@};
77

88
constant list<String> fmi1Files={"fmi-export/fmu1_model_interface.c.inc","fmi-export/fmu1_model_interface.h"};
99
constant list<String> fmi2Files={"fmi-export/fmu2_model_interface.c.inc","fmi-export/fmu2_model_interface.h", "fmi-export/fmu_read_flags.c.inc", "fmi-export/fmu_read_flags.h"};
1010

1111
constant list<String> defaultFileSuffixes={".c", "_functions.c", "_records.c", "_01exo.c", "_02nls.c", "_03lsy.c", "_04set.c", "_05evt.c", "_06inz.c", "_07dly.c", "_08bnd.c", "_09alg.c", "_10asr.c", "_11mix.c", "_12jac.c", "_13opt.c", "_14lnz.c", "_15syn.c", "_16dae.c", "_17inl.c", "_18spd.c", "_init_fmu.c", "_FMU.c"};
1212

13-
constant list<String> cvodeFiles={"sundials/cvode/cvode_ls.h",
14-
"sundials/cvode/cvode_proj.h",
15-
"sundials/cvode/cvode.h"};
1613

17-
constant list<String> sundialsFiles={"sundials/sundials/sundials_config.h",
18-
"sundials/sundials/sundials_dense.h",
19-
"sundials/sundials/sundials_direct.h",
20-
"sundials/sundials/sundials_iterative.h",
21-
"sundials/sundials/sundials_linearsolver.h",
22-
"sundials/sundials/sundials_matrix.h",
23-
"sundials/sundials/sundials_nonlinearsolver.h",
24-
"sundials/sundials/sundials_types.h",
25-
"sundials/sunlinsol/sunlinsol_dense.h",
26-
"sundials/sunmatrix/sunmatrix_dense.h",
27-
"sundials/sunnonlinsol/sunnonlinsol_fixedpoint.h"};
14+
constant list<String> sundials_headers={"../../cvode/cvode_ls.h",
15+
"../../cvode/cvode_proj.h",
16+
"../../cvode/cvode.h",
17+
"../../sundials/sundials_config.h",
18+
"../../sundials/sundials_dense.h",
19+
"../../sundials/sundials_direct.h",
20+
"../../sundials/sundials_iterative.h",
21+
"../../sundials/sundials_linearsolver.h",
22+
"../../sundials/sundials_matrix.h",
23+
"../../sundials/sundials_nonlinearsolver.h",
24+
"../../sundials/sundials_types.h",
25+
"../../sunlinsol/sunlinsol_dense.h",
26+
"../../sunmatrix/sunmatrix_dense.h",
27+
"../../sunnonlinsol/sunnonlinsol_fixedpoint.h",
28+
"../../nvector/nvector_serial.h",
29+
"../../sundials/sundials_nvector.h"};
2830

29-
constant list<String> nvectorFiles={"sundials/nvector/nvector_serial.h",
30-
"sundials/sundials/sundials_nvector.h"};
31+
constant list<String> simrt_c_sundials_sources={@SOURCE_FMU_CVODE_RUNTIME_FILES@};
3132

32-
constant list<String> external3rdPartyFiles=listAppend(listAppend(cvodeFiles,sundialsFiles), nvectorFiles);
33+
constant list<String> dgesv_headers={"./external_solvers/blaswrap.h", "./external_solvers/clapack.h", "./external_solvers/f2c.h"};
3334

34-
constant list<String> dgesvFiles={@SOURCE_FMU_DGESV_FILES@};
35+
constant list<String> dgesv_sources={@SOURCE_FMU_DGESV_FILES@};
3536

36-
constant list<String> cvodeRuntimeFiles={"simulation/solver/cvode_solver.c",
37-
"simulation/solver/sundials_error.c"};
37+
constant list<String> cminpack_headers = {"./external_solvers/cminpack.h", "./external_solvers/minpack.h"};
3838

39-
constant list<String> lsFiles={@SOURCE_FMU_LS_FILES@};
39+
constant list<String> cminpack_sources = {@SOURCE_FMU_CMINPACK_FILES@};
4040

41-
constant list<String> nlsFiles={@SOURCE_FMU_CMINPACK_FILES@, @SOURCE_FMU_NLS_FILES@};
41+
constant list<String> simrt_linear_solver_sources={@SOURCE_FMU_LS_FILES@};
4242

43-
constant list<String> mixedFiles={@SOURCE_FMU_MIXED_FILES@};
43+
constant list<String> simrt_non_linear_solver_sources={@SOURCE_FMU_NLS_FILES@};
44+
45+
constant list<String> simrt_mixed_solver_sources={@SOURCE_FMU_MIXED_FILES@};
4446

4547
annotation(__OpenModelica_Interface="backend");
4648
end RuntimeSources;

OMCompiler/SimulationRuntime/c/cmake/source_code_fmu_config.cmake

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ set(SOURCE_FMU_COMMON_HEADERS \"./omc_inline.h\",\"./openmodelica_func.h\",\"./o
3131

3232
######################################################################################################################
3333
# Lapack files
34-
file(GLOB_RECURSE 3RD_DGESV_FILES ${OMCompiler_3rdParty_SOURCE_DIR}/dgesv/include/*.h
35-
${OMCompiler_3rdParty_SOURCE_DIR}/dgesv/blas/*.c
34+
file(GLOB_RECURSE 3RD_DGESV_FILES ${OMCompiler_3rdParty_SOURCE_DIR}/dgesv/blas/*.c
3635
${OMCompiler_3rdParty_SOURCE_DIR}/dgesv/lapack/*.c
3736
${OMCompiler_3rdParty_SOURCE_DIR}/dgesv/libf2c/*.c)
3837
install(FILES ${3RD_DGESV_FILES}
@@ -67,9 +66,7 @@ set(3RD_CMINPACK_FMU_FILES ${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/enorm_.c
6766
${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/qform_.c
6867
${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/dogleg_.c
6968
${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/r1updt_.c
70-
${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/r1mpyq_.c
71-
${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/cminpack.h
72-
${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/minpack.h)
69+
${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/r1mpyq_.c)
7370

7471
install(FILES ${3RD_CMINPACK_FMU_FILES}
7572
DESTINATION ${SOURCE_FMU_SOURCES_DIR}/external_solvers
@@ -106,3 +103,15 @@ foreach(source_file ${SOURCE_FMU_MIXED_FILES_LIST})
106103
endforeach()
107104
string(REPLACE ";" "," SOURCE_FMU_MIXED_FILES "${SOURCE_FMU_MIXED_FILES_LIST_QUOTED}")
108105

106+
107+
108+
######################################################################################################################
109+
## CVODE files
110+
set(SOURCE_FMU_CVODE_RUNTIME_FILES_LIST simulation/solver/cvode_solver.c simulation/solver/sundials_error.c)
111+
112+
foreach(source_file ${SOURCE_FMU_CVODE_RUNTIME_FILES_LIST})
113+
list(APPEND SOURCE_FMU_CVODE_RUNTIME_FILES_LIST_QUOTED \"${source_file}\")
114+
get_filename_component(DEST_DIR ${source_file} DIRECTORY)
115+
install(FILES ${source_file} DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR})
116+
endforeach()
117+
string(REPLACE ";" "," SOURCE_FMU_CVODE_RUNTIME_FILES "${SOURCE_FMU_CVODE_RUNTIME_FILES_LIST_QUOTED}")

0 commit comments

Comments
 (0)