Skip to content

OpenModelica/openmodelica-crossbuild

Repository files navigation

OpenModelica Cross Compile Docker Image

Build Docker Image Publish Docker Image

The Docker image used to cross compile OpenModelica FMUs from Linux to target platforms and create multi-platform FMUs.

Toolchains

Toolchain file OS C Note
i686-linux-gnu x86-64 Linux 32-bit i686-linux-gnu-gcc
x86_64-linux-gnu x86-64 Linux 64-bit gcc -m64
aarch64-linux-gnu AArch64 Linux 64-bit aarch64-linux-gnu-gcc
arm-linux-gnueabi ARM Linux 32-bit arm-linux-gnueabi-gcc
arm-linux-gnueabihf ARM Linux 32-bit arm-linux-gnueabihf-gcc hard-float
i686-w64-mingw32 x86-64 Windows 32-bit i686-w64-mingw32-gcc MINGW
x86_64-w64-mingw32 x86-64 Windows 64-bit x86_64-w64-mingw32-gcc MINGW

Versioning

The cross compilation image is versioned together with the version number of OpenModelica. So OpenModelica v1.26.0 expects to use this image with tag v1.26.0 for cross compiling Linux and Windows.

Build

export TAG=v1.26.0
docker build --pull --no-cache --tag crossbuild:$TAG .

Example usage inside container

Windows 32-bit

cd path/to/FMU/sources/
cmake -S . -B build_win32 -DCMAKE_TOOLCHAIN_FILE=/opt/cmake/toolchain/i686-w64-mingw32.cmake
cmake --build build_win32 --target create_fmu

Windows 64-bit

cd path/to/FMU/sources/
cmake -S . -B build_win64 -DCMAKE_TOOLCHAIN_FILE=/opt/cmake/toolchain/x86_64-w64-mingw32.cmake
cmake --build build_win64 --target create_fmu

Linux 32-bit

cd path/to/FMU/sources/
cmake  -S . -B build_linux32 -DCMAKE_TOOLCHAIN_FILE=/opt/cmake/toolchain/i686-linux-gnu.cmake
cmake --build build_linux32 --target create_fmu

Linux 64-bit

cd path/to/FMU/sources/
cmake  -S . -B build_linux64 -DCMAKE_TOOLCHAIN_FILE=/opt/cmake/toolchain/x86_64-linux-gnu.cmake
cmake --build build_linux64 --target create_fmu

Upload

Release Versions

The publish.yml workflow will build, sign and upload the Docker image to GitHub container registry for each release.

Development Versions

The build.yml workflow uploads all tested image versions to GitHub container registry.

Verifying Signature

Caution

Only download and run images you trust.

You can use cosign to verify the keyless signature from publish.yml:

export TAG=v1.26.0
cosign verify ghcr.io/openmodelica/crossbuild:$TAG \
       --certificate-identity=https://github.com/OpenModelica/openmodelica-crossbuild/.github/workflows/publish.yml@refs/tags/$TAG \
       --certificate-oidc-issuer=https://token.actions.githubusercontent.com

License

This repository is part of OpenModelica and licensed with OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8, see ./OSMC-License.txt.

About

OpenModelica FMU cross-compilation Docker Image.

Topics

Resources

Stars

Watchers

Forks

Packages