Skip to content

Commit b3461ce

Browse files
committed
Specify sources dir for FMUs from outside.
- The C sources for source code FMUs can be found using the variable `RuntimeSources.fmu_sources_dir` This does not change much by itself yet. However, we can now specify the location at configure time. The reason it is added now is for the CMake configuration which puts the files in share/omc/c/sources. This way it works for both build systems (CMake and autconf).
1 parent 367de61 commit b3461ce

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

OMCompiler/Compiler/SimCode/SimCodeMain.mo

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,12 @@ algorithm
753753
end if;
754754
SimCodeUtil.resetFunctionIndex();
755755
varInfo := simCode.modelInfo.varInfo;
756+
// The C source files are installed to the folder specified by RuntimeSources.fmu_sources_dir. Copy them from there.
757+
copyFiles(RuntimeSources.commonFiles, source=Settings.getInstallationDirectoryPath() + RuntimeSources.fmu_sources_dir, destination=fmutmp+"/sources/");
758+
// The headers are in the include directory.
759+
copyFiles(RuntimeSources.commonHeaders, source=Settings.getInstallationDirectoryPath() + "/include/omc/c/", destination=fmutmp+"/sources/");
760+
756761
allFiles := {};
757-
allFiles := listAppend(RuntimeSources.commonHeaders, listAppend(RuntimeSources.commonFiles, allFiles));
758762
allFiles := listAppend(if FMUVersion=="1.0" then RuntimeSources.fmi1Files else RuntimeSources.fmi2Files, allFiles);
759763
if isSome(simCode.fmiSimulationFlags) then
760764
allFiles := listAppend(RuntimeSources.external3rdPartyFiles, allFiles);

OMCompiler/SimulationRuntime/c/RuntimeSources.mo.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
encapsulated package RuntimeSources
2+
constant String fmu_sources_dir = "/include/omc/c/";
23
constant list<String> commonFiles={COMMON_FILES};
34
constant list<String> commonHeaders={COMMON_HEADERS};
45
constant list<String> fmi1Files={"fmi-export/fmu1_model_interface.c.inc","fmi-export/fmu1_model_interface.h"};

0 commit comments

Comments
 (0)