NOTE: By default, this works only on Windows due to platform settings in file setup.py.
Requirements
- Visual Studio
- CMake (currently pyfmipp works only with CMake 3.x)
- Python: install packages
wheelandsetuptoolsusing pip:pip install wheel setuptools
-
build the FMI++ library (using CMake and Visual Studio)
- use commits starting from 10b4dbe
-
copy the libraries (FMI++, Boost, SUNDIALS, MSVC runtime):
- <fmipp-build-dir>\export\swig\fmippex.py : copy to <py-fmipp-dir>\fmipp\export
- <fmipp-build-dir>\import\swig\fmippim.py : copy to <py-fmipp-dir>\fmipp
- <fmipp-build-dir>\import\swig\Release_fmippim.pyd : copy to <py-fmipp-dir>\fmipp\lib
- <fmipp-build-dir>\import\swig\Release_fmippex.pyd : copy to <py-fmipp-dir>\fmipp\lib
- <fmipp-build-dir>\Release\fmippim.dll : copy to <py-fmipp-dir>\fmipp\lib
- <fmipp-build-dir>\Release\fmippex.dll : copy to <py-fmipp-dir>\fmipp\lib
- <fmipp-build-dir>\Release\fmi2.dll : copy to <py-fmipp-dir>\fmipp\export\bin
- <fmipp-build-dir>\Release\libfmipp_fmu_frontend.lib : copy to <py-fmipp-dir>\fmipp\export\bin
- <sundials-lib-dir>\sundials_cvode.dll : copy to <py-fmipp-dir>\fmipp\lib
- <boost-lib-dir>\boost_filesystem-.dll : copy to <py-fmipp-dir>\fmipp\lib
- MSVC runtime libraries (e.g., msvcp140.dll & vcruntime.dll) : copy to <py-fmipp-dir>\fmipp\lib
-
run
python setup.py bdist_wheel --python-tag <python_tag> -p <platform_tag>in the command line, where:<python_tag>is the python version used (e.g.cp39)<platform_tag>refers to the platform used (i.e.win32orwin_amd64)
NOTE: There are batch scripts available in subfolder release for automating the build for several configurations (win32/win_amd64, cp27/cp36/cp37).
NOTE: SUNDIALS version 3.1.2 is required.
- to install the wheel run:
pip install path\to\wheel\fmipp-<version>-<python_tag>-none-<platform_tag>.whl
NOTE: By default, this works only on Linux due to platform settings in file setup.py.
- make sure to have installed (e.g. via
apt-getoraptitude):- Python (package python-dev)
- pip (package python-pip)
- git (package git)
- install package
setuptoolsusingpip:
pip install setuptools
- download the FMI++ source code into subfolder source (./source/fmipp) using
git:
cd source
git clone https://github.com/fmipp/fmipp.git fmipp
rm -rf fmipp/.git
- to create the fmipp-<version>.tar.gz source distribution file run:
python3 setup.py sdist
- make sure to have installed (e.g. via
apt-getoraptitude):- SWIG (package swig)
- SUNDIALS (package libsundials-serial-dev, version == 3.1.2)
- Boost (package libboost-all-dev)
- to install the source distribution run:
python3 -m pip install /path/to/sdist/fmipp-<version>.tar.gz
Wheels are built on the PyPA manylinux2014 image (glibc 2.17, GCC 10), so they run on Ubuntu 20.04 and later, Debian 10 and later, and RHEL 7 and later. SUNDIALS 3.1.2 and Boost 1.72 are linked statically into the extensions. glibc and libstdc++ stay dynamic. A manylinux wheel does not need the distribution packages libsundials-dev or libboost-all-dev.
The build needs Docker and the FMI++ sources as a sibling directory of py-fmipp (the layout of this repository). From the repository root:
docker build -f py-fmipp/release/manylinux/Dockerfile -t fmipp-manylinux py-fmipp/release/manylinux
docker run --rm -v "<repo-root>:/io" fmipp-manylinux
Wheels for every CPython 3.10–3.13 present in the image are written to py-fmipp/dist. The image checks that the repaired wheels do not depend on libsundials or libboost, then runs the pytest suite.
For aarch64, build the image with --build-arg BASE_IMAGE=quay.io/pypa/manylinux2014_aarch64 and run it on an aarch64 host or under emulation.
- install twine via
pip install twine - run
twine upload dist\*
- run
pip install fmipp --prefer-binaries - to re-download the package instead of using a cached version, set the flag
--no-cache-dir
- A manylinux wheel does not need
libsundials-devorlibboost-all-dev. Runpip install fmipp. - Installing from the source distribution instead still needs SWIG, Boost (
libboost-all-dev), and SUNDIALS 3.1.2 (libsundials-serial-dev). Current Ubuntu releases do not ship that SUNDIALS version.