Skip to content

Commit

Permalink
Updates for source-code FMUs
Browse files Browse the repository at this point in the history
Make it possible to compile source-code FMUs without setting include-
directives to the preprocessor. This required changes to most files
since they assume preprocessor flags were set.

The generated FMU now contains a list of the files to compile (in the
XML structure), in case the user does not have access to a make system.

Still missing is a config-file containing number of linear systems, etc.
This would make it possible to compile without configure-script at all.
The configure script should also look for the standard FMI includes
which should not need to be present in a source-code FMU.

Use a settings file for FMUs instead of preprocessor, stored inside the
generated FMU.

This allows automatic compilation of the sources, by a tool agnostic of
OpenModelica.

Belonging to [master]:
  - OpenModelica/OMCompiler#2989
  - OpenModelica/OpenModelica-testsuite#1149
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Mar 27, 2019
1 parent e13c1c3 commit 03a4ab6
Show file tree
Hide file tree
Showing 121 changed files with 522 additions and 545 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@
*.log
*.stamp
**/*.dylib.dSYM/
*.tmp

# autoconf
autom4te.cache/
Expand Down Expand Up @@ -153,9 +154,13 @@ Parser/ParModelica_Lexer.h
Parser/ParModelica_Lexer_BaseModelica_Lexer.c
Parser/ParModelica_Lexer_BaseModelica_Lexer.h

SimulationRuntime/c/RuntimeSources.mo
SimulationRuntime/**/test_files/*.jar
SimulationRuntime/cpp/build_msvc/
# Visual Studio 2015/2017 cache/options directory
SimulationRuntime/cpp/.vs/
SimulationRuntime/cpp/CMakeSettings.json
tags

*.plist
*clang_output*
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -2003,7 +2003,7 @@ external "builtin";
annotation(preferredView="text");
end mkdir;

function copy "copies the source file to the destined directory. Returns true if the file has been copied."
function copy "copies the source file to the destination file. Returns true if the file has been copied."
input String source;
input String destination;
output Boolean success;
Expand Down
49 changes: 45 additions & 4 deletions Compiler/SimCode/SimCodeMain.mo
Expand Up @@ -93,6 +93,7 @@ import HashTableCrIListArray;
import HashTableCrILst;
import HpcOmSimCodeMain;
import HpcOmTaskGraph;
import RuntimeSources;
import SerializeModelInfo;
import TaskSystemDump;
import SerializeInitXML;
Expand Down Expand Up @@ -510,7 +511,7 @@ algorithm
then ();

case "sfmi" equation
Tpl.tplNoret3(CodegenSparseFMI.translateModel, simCode, "2.0", "me");
Tpl.tplNoret(function CodegenSparseFMI.translateModel(in_a_FMUVersion="2.0", in_a_FMUType="me", in_a_sourceFiles={}), simCode);
then ();

case "C"
Expand Down Expand Up @@ -678,6 +679,8 @@ algorithm
String str, newdir, newpath, resourcesDir, dirname;
String fmutmp;
Boolean b;
list<String> allFiles, sourceFiles, defaultFiles, extraFiles, runtimeFiles, dgesvFiles;
SimCode.VarInfo varInfo;
case (SimCode.SIMCODE(),"C")
algorithm
fmutmp := simCode.fileNamePrefix + ".fmutmp";
Expand Down Expand Up @@ -722,15 +725,37 @@ algorithm
end if;
end if;
SimCodeUtil.resetFunctionIndex();
Tpl.tplNoret3(CodegenFMU.translateModel, simCode, FMUVersion, FMUType);
Tpl.closeFile(Tpl.tplCallWithFailError4(CodegenFMU.fmuMakefile,Config.simulationCodeTarget(),simCode,FMUVersion,SimCodeUtil.getFunctionIndex(),txt=Tpl.redirectToFile(Tpl.emptyTxt, simCode.fileNamePrefix+".fmutmp/sources/Makefile.in")));
varInfo := simCode.modelInfo.varInfo;
allFiles := {};
allFiles := listAppend(RuntimeSources.commonHeaders, listAppend(RuntimeSources.commonFiles, allFiles));
allFiles := listAppend(if FMUVersion=="1.0" then RuntimeSources.fmi1AllFiles else RuntimeSources.fmi2AllFiles, allFiles);
if varInfo.numLinearSystems > 0 then
allFiles := listAppend(RuntimeSources.lsFiles, allFiles);
end if;
if varInfo.numNonLinearSystems > 0 then
allFiles := listAppend(RuntimeSources.nlsFiles, allFiles);
end if;
if varInfo.numMixedSystems > 0 then
allFiles := listAppend(RuntimeSources.mixedFiles, allFiles);
end if;
dgesvFiles := if varInfo.numLinearSystems > 0 or varInfo.numNonLinearSystems > 0 then RuntimeSources.dgesvFiles else {};
defaultFiles := list(simCode.fileNamePrefix + f for f in RuntimeSources.defaultFileSuffixes);
runtimeFiles := list(f for f guard Util.endsWith(f, ".c") in allFiles);
sourceFiles := listAppend(defaultFiles, runtimeFiles);
Tpl.tplNoret(function CodegenFMU.translateModel(in_a_FMUVersion=FMUVersion, in_a_FMUType=FMUType, in_a_sourceFiles=sourceFiles), simCode);
extraFiles := SimCodeUtil.getFunctionIndex();
copyFiles(listAppend(dgesvFiles, allFiles), source=Settings.getInstallationDirectoryPath() + "/include/omc/c/", destination=fmutmp+"/sources/");
Tpl.closeFile(Tpl.tplCallWithFailErrorNoArg(function CodegenFMU.fmuMakefile(a_target=Config.simulationCodeTarget(), a_simCode=simCode, a_FMUVersion=FMUVersion, a_sourceFiles=listAppend(extraFiles, defaultFiles), a_dgesvObjectFiles=list(System.stringReplace(f,".c",".o") for f guard Util.endsWith(f, ".c") in dgesvFiles), a_runtimeObjectFiles=list(System.stringReplace(f,".c",".o") for f in runtimeFiles)),
txt=Tpl.redirectToFile(Tpl.emptyTxt, simCode.fileNamePrefix+".fmutmp/sources/Makefile.in")));
Tpl.closeFile(Tpl.tplCallWithFailError(CodegenFMU.settingsfile, simCode,
txt=Tpl.redirectToFile(Tpl.emptyTxt, simCode.fileNamePrefix+".fmutmp/sources/omc_simulation_settings.h")));
then ();
case (_,"Cpp")
equation
if(Flags.isSet(Flags.HPCOM)) then
Tpl.tplNoret3(CodegenFMUCppHpcom.translateModel, simCode, FMUVersion, FMUType);
else
Tpl.tplNoret3(CodegenFMUCpp.translateModel, simCode, FMUVersion, FMUType);
Tpl.tplNoret(function CodegenFMUCpp.translateModel(in_a_FMUVersion=FMUVersion, in_a_FMUType=FMUType, in_a_sourceFiles={}), simCode);
end if;
then ();
else
Expand Down Expand Up @@ -1357,5 +1382,21 @@ algorithm
Error.addMessage(Error.SERIALIZED_SIZE, {name, StringUtil.bytesToReadableUnit(sz), StringUtil.bytesToReadableUnit(raw_sz), StringUtil.bytesToReadableUnit(nonSharedStringSize)});
end serializeNotify;

protected function copyFiles
input list<String> files;
input String source, destination;
protected
String f2, d2;
algorithm
for f in files loop
f2 := destination+"/"+f;
d2 := System.dirname(f2);
if not System.directoryExists(d2) then
Error.assertion(Util.createDirectoryTree(d2), "Failed to create directory " + d2, sourceInfo());
end if;
Error.assertion(System.copyFile(source + "/" + f, f2), "Failed to copy file " + f + " from " + source + " to " + destination, sourceInfo());
end for;
end copyFiles;

annotation(__OpenModelica_Interface="backend");
end SimCodeMain;
5 changes: 3 additions & 2 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -1045,10 +1045,10 @@ template simulationFile(SimCode simCode, String guid, String isModelExchangeFMU)
<<
#define prefixedName_performSimulation <%symbolName(modelNamePrefixStr,"performSimulation")%>
#define prefixedName_updateContinuousSystem <%symbolName(modelNamePrefixStr,"updateContinuousSystem")%>
#include <simulation/solver/perform_simulation.c>
#include <simulation/solver/perform_simulation.c.inc>
#define prefixedName_performQSSSimulation <%symbolName(modelNamePrefixStr,"performQSSSimulation")%>
#include <simulation/solver/perform_qss_simulation.c>
#include <simulation/solver/perform_qss_simulation.c.inc>
>>
%>
Expand Down Expand Up @@ -5735,6 +5735,7 @@ end simulationLiteralsFile;
used in Compiler/Template/CodegenFMU.tpl"
::=
<<
#include "omc_simulation_settings.h"
#include "<%filePrefix%>_functions.h"
#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 2 additions & 0 deletions Compiler/Template/CodegenCFunctions.tpl
Expand Up @@ -166,6 +166,7 @@ template functionsFile(String filePrefix,
"Generates the contents of the main C file for the function case."
::=
<<
#include "omc_simulation_settings.h"
#include "<%filePrefix%>.h"
<% /* Note: The literals may not be part of the header due to separate compilation */
literals |> literal hasindex i0 fromindex 0 => literalExpConst(literal,i0) ; separator="\n";empty
Expand Down Expand Up @@ -3335,6 +3336,7 @@ end functionsParModelicaKernelsFile;
<<
/* Additional record code for <%filePrefix%> generated by the OpenModelica Compiler <%getVersionNr()%>. */

#include "omc_simulation_settings.h"
#include "meta/meta_modelica.h"

#ifdef __cplusplus
Expand Down
84 changes: 44 additions & 40 deletions Compiler/Template/CodegenFMU.tpl
Expand Up @@ -56,7 +56,7 @@ import CodegenFMU1;
import CodegenFMU2;


template translateModel(SimCode simCode, String FMUVersion, String FMUType)
template translateModel(SimCode simCode, String FMUVersion, String FMUType, list<String> sourceFiles)
"Generates C code and Makefile for compiling a FMU of a
Modelica model."
::=
Expand Down Expand Up @@ -84,7 +84,7 @@ case sc as SIMCODE(modelInfo=modelInfo as MODELINFO(__)) then
let &fmuModelDescription += closeFile()
*/

let()= textFile(fmuModelDescriptionFile(simCode,guid,FMUVersion,FMUType), '<%fileNamePrefix%>.fmutmp/modelDescription.xml')
let()= textFile(fmuModelDescriptionFile(simCode, guid, FMUVersion, FMUType, sourceFiles), '<%fileNamePrefix%>.fmutmp/modelDescription.xml')

let()= textFile(fmudeffile(simCode,FMUVersion), '<%fileNamePrefix%>.fmutmp/sources/<%fileNamePrefix%>.def')
let()= textFile('# Dummy file so OMDEV Compile.bat works<%\n%>include Makefile<%\n%>', '<%fileNamePrefix%>.fmutmp/sources/<%fileNamePrefix%>.makefile')
Expand Down Expand Up @@ -177,15 +177,15 @@ end translateModel;
end match
end generateSimulationFiles;

template fmuModelDescriptionFile(SimCode simCode, String guid, String FMUVersion, String FMUType)
template fmuModelDescriptionFile(SimCode simCode, String guid, String FMUVersion, String FMUType, list<String> sourceFiles)
"Generates code for ModelDescription file for FMU target."
::=
match simCode
case SIMCODE(__) then
<<
<?xml version="1.0" encoding="UTF-8"?>
<%
if isFMIVersion20(FMUVersion) then CodegenFMU2.fmiModelDescription(simCode,guid,FMUType)
if isFMIVersion20(FMUVersion) then CodegenFMU2.fmiModelDescription(simCode, guid, FMUType, sourceFiles)
else CodegenFMU1.fmiModelDescription(simCode,guid,FMUType)
%>
>>
Expand Down Expand Up @@ -224,9 +224,9 @@ case SIMCODE(__) then
#include "simulation/solver/initialization/initialization.h"
#include "simulation/solver/events.h"
<%if isFMIVersion20(FMUVersion) then
'#include "fmu2_model_interface.h"'
'#include "fmi2/fmu2_model_interface.h"'
else
'#include "fmu1_model_interface.h"'%>
'#include "fmi1/fmu1_model_interface.h"'%>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -271,13 +271,13 @@ case SIMCODE(__) then
<<
extern void <%symbolName(modelNamePrefix(simCode),"setupDataStruc")%>(DATA *data, threadData_t *threadData);
#define fmu2_model_interface_setupDataStruc <%symbolName(modelNamePrefix(simCode),"setupDataStruc")%>
#include "fmu2_model_interface.c"
#include "fmi2/fmu2_model_interface.c.inc"
>>
else
<<
extern void <%symbolName(modelNamePrefix(simCode),"setupDataStruc")%>(DATA *data, threadData_t *threadData);
#define fmu1_model_interface_setupDataStruc <%symbolName(modelNamePrefix(simCode),"setupDataStruc")%>
#include "fmu1_model_interface.c"
#include "fmi1/fmu1_model_interface.c.inc"
>>
%>
Expand Down Expand Up @@ -1147,8 +1147,8 @@ match platform
<<
<%fileNamePrefix%>_FMU: nozip
<%\t%>cd .. && rm -f ../<%fileNamePrefix%>.fmu && zip -r ../<%fmuTargetName%>.fmu *
nozip: $(MAINOBJ) <%fileNamePrefix%>_functions.h <%fileNamePrefix%>_literals.h $(OFILES) $(RUNTIMEFILES)
<%\t%>$(CXX) -shared -I. -o <%modelNamePrefix%>$(DLLEXT) $(MAINOBJ) $(RUNTIMEFILES) $(OFILES) $(CPPFLAGS) <%dirExtra%> <%libsPos1%> <%libsPos2%> $(CFLAGS) $(LDFLAGS) -llis -Wl,--kill-at
nozip: <%fileNamePrefix%>_functions.h <%fileNamePrefix%>_literals.h $(OFILES) $(RUNTIMEFILES)
<%\t%>$(CXX) -shared -I. -o <%modelNamePrefix%>$(DLLEXT) $(RUNTIMEFILES) $(OFILES) $(CPPFLAGS) <%dirExtra%> <%libsPos1%> <%libsPos2%> $(CFLAGS) $(LDFLAGS) -llis -Wl,--kill-at
<%\t%>mkdir.exe -p ../binaries/<%platform%>
<%\t%>dlltool -d <%fileNamePrefix%>.def --dllname <%fileNamePrefix%>$(DLLEXT) --output-lib <%fileNamePrefix%>.lib --kill-at
<%\t%>cp <%fileNamePrefix%>$(DLLEXT) <%fileNamePrefix%>.lib <%fileNamePrefix%>_FMU.libs ../binaries/<%platform%>/
Expand All @@ -1160,16 +1160,16 @@ match platform
<<
<%fileNamePrefix%>_FMU: nozip
<%\t%>cd .. && rm -f ../<%fileNamePrefix%>.fmu && zip -r ../<%fmuTargetName%>.fmu *
nozip: $(MAINOBJ) <%fileNamePrefix%>_functions.h <%fileNamePrefix%>_literals.h $(OFILES) $(RUNTIMEFILES)
nozip: <%fileNamePrefix%>_functions.h <%fileNamePrefix%>_literals.h $(OFILES) $(RUNTIMEFILES)
<%\t%>mkdir -p ../binaries/$(FMIPLATFORM)
ifeq (@LIBTYPE_DYNAMIC@,1)
<%\t%>$(LD) -o <%modelNamePrefix%>$(DLLEXT) $(MAINOBJ) $(OFILES) $(RUNTIMEFILES) <%dirExtra%> <%libsPos1%> <%libsPos2%> $(LDFLAGS)
<%\t%>$(LD) -o <%modelNamePrefix%>$(DLLEXT) $(OFILES) $(RUNTIMEFILES) <%dirExtra%> <%libsPos1%> <%libsPos2%> $(LDFLAGS)
<%\t%>cp <%fileNamePrefix%>$(DLLEXT) <%fileNamePrefix%>_FMU.libs ../binaries/$(FMIPLATFORM)/
endif
<%\t%>head -n20 Makefile > ../resources/$(FMIPLATFORM).summary
ifeq (@LIBTYPE_STATIC@,1)
<%\t%>rm -f <%modelNamePrefix%>.a
<%\t%>$(AR) -rsu <%modelNamePrefix%>.a $(MAINOBJ) $(OFILES) $(RUNTIMEFILES)
<%\t%>$(AR) -rsu <%modelNamePrefix%>.a $(OFILES) $(RUNTIMEFILES)
<%\t%>cp <%fileNamePrefix%>.a <%fileNamePrefix%>_FMU.libs ../binaries/$(FMIPLATFORM)/
endif
<%\t%>$(MAKE) distclean
Expand All @@ -1180,29 +1180,42 @@ match platform
>>
end getPlatformString2;

template fmuMakefile(String target, SimCode simCode, String FMUVersion, list<String> extraFiles)
template settingsfile(SimCode simCode)
::=
match simCode
case SIMCODE(modelInfo=MODELINFO(varInfo=varInfo as VARINFO(__)), delayedExps=DELAYED_EXPRESSIONS(maxDelayedIndex=maxDelayedIndex)) then
<<
#if !defined(OMC_SIM_SETTINGS_CMDLINE)
#define OMC_SIM_SETTINGS_CMDLINE
#define OMC_NUM_LINEAR_SYSTEMS <%varInfo.numLinearSystems%>
#define OMC_NUM_NONLINEAR_SYSTEMS <%varInfo.numNonLinearSystems%>
#define OMC_NUM_MIXED_SYSTEMS <%varInfo.numMixedSystems%>
#define OMC_NDELAY_EXPRESSIONS <%maxDelayedIndex%>
#define OMC_NVAR_STRING <%varInfo.numStringAlgVars%>
<% if Flags.isSet(Flags.FMU_EXPERIMENTAL) then '#define FMU_EXPERIMENTAL 1'%>
#define OMC_MODEL_PREFIX "<%modelNamePrefix(simCode)%>"
#define OMC_MINIMAL_RUNTIME 1
#define OMC_FMI_RUNTIME 1
#endif
>>
end settingsfile;

template fmuMakefile(String target, SimCode simCode, String FMUVersion, list<String> sourceFiles, list<String> runtimeObjectFiles, list<String> dgesvObjectFiles)
"Generates the contents of the makefile for the simulation case. Copy libexpat & correct linux fmu"
::=
let common =
match simCode
case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simulationSettingsOpt = sopt) then
<<
MAINFILE=<%fileNamePrefix%>_FMU.c
MAINOBJ=<%fileNamePrefix%>_FMU.o
CFILES=<%fileNamePrefix%>.c <%fileNamePrefix%>_functions.c <%fileNamePrefix%>_records.c \
<%fileNamePrefix%>_01exo.c <%fileNamePrefix%>_02nls.c <%fileNamePrefix%>_03lsy.c <%fileNamePrefix%>_04set.c <%fileNamePrefix%>_05evt.c <%fileNamePrefix%>_06inz.c <%fileNamePrefix%>_07dly.c \
<%fileNamePrefix%>_08bnd.c <%fileNamePrefix%>_09alg.c <%fileNamePrefix%>_10asr.c <%fileNamePrefix%>_11mix.c <%fileNamePrefix%>_12jac.c <%fileNamePrefix%>_13opt.c <%fileNamePrefix%>_14lnz.c \
<%fileNamePrefix%>_15syn.c <%fileNamePrefix%>_16dae.c <%fileNamePrefix%>_17inl.c <%fileNamePrefix%>_init_fmu.c<%extraFiles |> f => ' <%f%>'%>
CFILES=<%sourceFiles ; separator=" "%>
OFILES=$(CFILES:.c=.o)
GENERATEDFILES=$(MAINFILE) <%fileNamePrefix%>_FMU.makefile <%fileNamePrefix%>_literals.h <%fileNamePrefix%>_model.h <%fileNamePrefix%>_includes.h <%fileNamePrefix%>_functions.h <%fileNamePrefix%>_11mix.h <%fileNamePrefix%>_12jac.h <%fileNamePrefix%>_13opt.h <%fileNamePrefix%>_init_fmu.c <%fileNamePrefix%>_info.c $(CFILES) <%fileNamePrefix%>_FMU.libs

# FIXME: before you push into master...
RUNTIMEDIR=include
OMC_MINIMAL_RUNTIME=1
OMC_FMI_RUNTIME=1
include $(RUNTIMEDIR)/Makefile.objs
RUNTIMEDIR=.
ifneq ($(NEED_DGESV),)
DGESV_OBJS = <%dgesvObjectFiles ; separator = " "%>
endif
ifneq ($(NEED_RUNTIME),)
RUNTIMEFILES=$(FMI_ME_OBJS:%=$(RUNTIMEDIR)/%.o)
RUNTIMEFILES=<%runtimeObjectFiles ; separator = " "%> $(DGESV_OBJS)
endif
>>
match getGeneralTarget(target)
Expand Down Expand Up @@ -1281,7 +1294,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
rm -rf <%fmudirname%>

<%fileNamePrefix%>$(DLLEXT): $(MAINOBJ) $(CFILES)
$(CXX) /Fe<%fileNamePrefix%>$(DLLEXT) $(MAINFILE) <%fileNamePrefix%>_FMU.c $(CFILES) $(CFLAGS) $(LDFLAGS)
$(CXX) /Fe<%fileNamePrefix%>$(DLLEXT) <%fileNamePrefix%>_FMU.c <%fileNamePrefix%>_FMU.c $(CFILES) $(CFLAGS) $(LDFLAGS)
>>
end match
case "gcc" then
Expand Down Expand Up @@ -1310,13 +1323,8 @@ case SIMCODE(modelInfo=MODELINFO(varInfo=varInfo as VARINFO(__)), delayedExps=DE
FMIPLATFORM=@FMIPLATFORM@
# Note: Simulation of the fmu with dymola does not work with -finline-small-functions (enabled by most optimization levels)
CPPFLAGS=@CPPFLAGS@
OMC_NUM_LINEAR_SYSTEMS=<%varInfo.numLinearSystems%>
OMC_NUM_NONLINEAR_SYSTEMS=<%varInfo.numNonLinearSystems%>
OMC_NUM_MIXED_SYSTEMS=<%varInfo.numMixedSystems%>
OMC_NDELAY_EXPRESSIONS=<%maxDelayedIndex%>
OMC_NVAR_STRING=<%varInfo.numStringAlgVars%>

override CPPFLAGS += -Iinclude/ -Iinclude/fmi<%if isFMIVersion20(FMUVersion) then "2" else "1"%> -I. <%makefileParams.includes ; separator=" "%> <% if Flags.isSet(Flags.FMU_EXPERIMENTAL) then '-DFMU_EXPERIMENTAL'%> -DOMC_MODEL_PREFIX=<%modelNamePrefix(simCode)%> -DOMC_NUM_MIXED_SYSTEMS=<%varInfo.numMixedSystems%> -DOMC_NUM_LINEAR_SYSTEMS=<%varInfo.numLinearSystems%> -DOMC_NUM_NONLINEAR_SYSTEMS=<%varInfo.numNonLinearSystems%> -DOMC_NDELAY_EXPRESSIONS=<%maxDelayedIndex%> -DOMC_NVAR_STRING=<%varInfo.numStringAlgVars%>
override CPPFLAGS += <%makefileParams.includes ; separator=" "%>

<%common%>

Expand All @@ -1334,19 +1342,15 @@ template fmuSourceMakefile(SimCode simCode, String FMUVersion)
::=
match simCode
case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simulationSettingsOpt = sopt) then
let includedir = '<%fileNamePrefix%>.fmutmp/sources/include/'
let includedir = '<%fileNamePrefix%>.fmutmp/sources/'
let mkdir = match makefileParams.platform case "win32" case "win64" then '"mkdir.exe"' else 'mkdir'
<<
# FIXME: before you push into master...
RUNTIMEDIR=<%makefileParams.omhome%>/include/omc/c/
OMC_MINIMAL_RUNTIME=1
OMC_FMI_RUNTIME=1
include $(RUNTIMEDIR)/Makefile.objs
#COPY_RUNTIMEFILES=$(FMI_ME_OBJS:%= && (OMCFILE=% && cp $(RUNTIMEDIR)/$$OMCFILE.c $$OMCFILE.c))

fmu:
<%\t%>rm -f <%fileNamePrefix%>.fmutmp/sources/<%fileNamePrefix%>_init.xml<%/*Already translated to .c*/%>
<%\t%>cp -a <%makefileParams.omhome%>/include/omc/c/* <%includedir%>
<%\t%>cp -a <%makefileParams.omhome%>/share/omc/runtime/c/fmi/buildproject/* <%fileNamePrefix%>.fmutmp/sources
<%\t%>cp -a <%fileNamePrefix%>_FMU.libs <%fileNamePrefix%>.fmutmp/sources/
<%\n%>
Expand Down Expand Up @@ -3021,7 +3025,7 @@ case SIMCODE(modelInfo = MODELINFO(functions = functions, varInfo = vi as VARINF
simulationSettingsOpt = SOME(s as SIMULATION_SETTINGS(__)), makefileParams = makefileParams as MAKEFILE_PARAMS(__))
then
<<
#include <simulation_data.h>
#include "simulation_data.h"

OMC_DISABLE_OPT<%/* This function is very simple and doesn't need to be optimized. GCC/clang spend way too much time looking at it. */%>
void <%symbolName(modelNamePrefix(simCode),"read_input_fmu")%>(MODEL_DATA* modelData, SIMULATION_INFO* simulationInfo)
Expand Down

0 comments on commit 03a4ab6

Please sign in to comment.