Opened 9 years ago
Last modified 6 years ago
#3950 new enhancement
Cross compilation of FMUs under Windows — at Version 1
Reported by: | Rüdiger Franke | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Build Environment | Version: | |
Keywords: | Cc: | Adrian Pop |
Description (last modified by )
Recently a 64bit Windows version of OpenModelica was introduced. A separate 32bit version is still needed for the export of 32bit FMUs. This should be covered with cross compilation instead.
Cross compilation already works under Linux, including an extended
CevalScriptBackend.buildModelFMU(className = "MyModel", platforms = {"i686-w64-mingw32"})
where platforms
is a list of "static", "dynamic" and target triplets, like 32 bit windows in the example. Moreover the OMEdit configuration of FMI export was extended for cross compilation (Tools -> Options -> FMI). The C runtime implements cross compilation of minimal FMUs including source code; the Cpp runtime implements export of full FMUs using pre-compiled runtime libs for the respective target platform.
If cross compilation shall work like under Linux then we need:
- compilers with the name i686-w64-mingw32-gcc and i686-w64-mingw32-g++ (OMEdit and the FMU makefiles would expect it)
- static versions of libgcc and libstdc++ (and possibly libwinpthread) along with these compilers
- call the Cpp FMU makefile with a triplet argument TARGET_TRIPLET=i686-w64-mingw32 (this happens automatically if checked in OMEdit, calling CevalScriptBackend.buildModelFMU with platforms argument)
- an additional version of the Cpp runtime *_static libs generated with this compiler and placed in the directory "$(OMHOME)/lib/$(TARGET_TRIPLET)/omc/cpp"
The concept of the target triplet might be extended to msvc. Then msvc libs would not be placed in subdirectories of the gcc libs anymore, like
$(OMHOME)/lib/omc/cpp/msvc
but besides the gcc libs using another TARGET_TRIPLET, like
$(OMHOME)/lib/$(TARGET_TRIPLET_FOR_MSVC)/omc/cpp