INTO-CPS-Association / unifmu

A universal mechanism for implementing Functional Mock-up Units (FMUs) in various languages
41 stars 4 forks source link

Understanding the compile mechanism #48

Closed ovenygren closed 7 months ago

ovenygren commented 2 years ago

Recently found this and it is a very interesting approach! Especially for one being new to the FMU concept altogether.

clegaard commented 2 years ago

Glad you find the work interesting!

If you look at the launch.toml file inside the FMU you should see the following:

linux = ["dotnet", "run", "backend.cs"]
macos = ["dotnet", "run", "backend.cs"]
windows = ["dotnet", "run", "backend.cs"]

You can modify this file to control how the FMU instance is executed. In this case it runs "dotnet run backend.cs" which will trigger a compile if it has not already been built and execute the resulting binary. If you already compiled your project you can modify the launch.toml to simply execute the binary.

Regarding debug vs release binaries, this is C# specific. I imagine there is a flag you can pass to the dotnet run command to have it do a release build.

The compilation step is only necessary for compiled languages such as C#, for an intrepreted language like python the launch.toml simply executes the backend.py using the systems python intrepreter

linux = ["python3", "backend.py"]
macos = ["python3", "backend.py"]
windows = ["python", "backend.py"]

Hope this helps!