Skip to content
fmippPublic

About

FMI++ Python Interface

Resources

Stars

8 stars

Watchers

6 watching

Forks

Latest commit

 

History

91 Commits

Folders and files

Repository files navigation

Building wheels for Windows

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 wheel and setuptools using pip:
            pip install wheel setuptools
    

Building the wheel

  • 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. win32 or win_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.

Installation from local

  • to install the wheel run:
        pip install path\to\wheel\fmipp-<version>-<python_tag>-none-<platform_tag>.whl

Creating source distribution packages for Linux

NOTE: By default, this works only on Linux due to platform settings in file setup.py.

Requirements

  • make sure to have installed (e.g. via apt-get or aptitude):
    • Python (package python-dev)
    • pip (package python-pip)
    • git (package git)
  • install package setuptools using pip:
        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

Generating the source distribution package

  • to create the fmipp-<version>.tar.gz source distribution file run:
        python3 setup.py sdist

Installation from local

  • make sure to have installed (e.g. via apt-get or aptitude):
    • 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

Creating manylinux wheels

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.

Uploading to PyPI

  • install twine via pip install twine
  • run twine upload dist\*

Installation from PyPI

Windows

  • run pip install fmipp --prefer-binaries
  • to re-download the package instead of using a cached version, set the flag --no-cache-dir

Linux

  • A manylinux wheel does not need libsundials-dev or libboost-all-dev. Run pip 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.

About

FMI++ Python Interface

Resources

Stars

8 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages