Skip to content

Make Python packages ('wheels') for multiple platforms (#223/1)

Ammar Nejati requested to merge makePythonWheel_I_i223 into main

The following changes carry out the first step described in issue #223 (closed).

The CI mechanism is modified to make a Python package for Linux, MacOS, and MS-Windows. The changes are kept minimal, as far as possible. The new CMake modules are placed in cmake/multipython folder.

  • In the root CMakeLists.txt, variables BA_PY_PACKAGE and BA_PY_PLATFORM are added to build a Python package.

    • BA_PY_PACKAGE = ON builds a Python package with the default Python platform, or a given Python platform (via BA_PY_PLATFORM).
    • If BA_PY_PLATFORM = <path/to/Python/platform> is provided, CMake tries to find a Python platform in the given path via configuration files, to build the Python package. If BA_PY_PLATFORM is given, there is no need to set BA_PY_PACKAGE = ON.
    • Example:
      cmake .. BA_PY_PACKAGE=ON
      cmake .. BA_PY_PLATFORM=/path/to/python38
  • multipython/FindCustomPython3 searches for a Python platform in the default paths or in a given path.

  • multipython/PyDirectories makes the required directories for the Python package under the build directory.

  • multipython/PyDependences finds the required Python dependencies and performs the required configuration.

  • multipython/MakePythonWheel makes the Python wheel.

  • Added proper RPATHs as hints to load the dependencies of the libraries at run-time (on Linux & MacOS). On MacOS, a shell script, devtools/deploy/mk_pypack_macos.sh, is used to gather the required external dependencies, correct the library ids and RPATHs and make the Python wheel. A similar script, devtools/deploy/mk_pypack_linux.sh, is used to make the Python wheel on Linux.

  • The files and directory structure which Python needs to build the 'wheel' are stored under Wrap/PythonPackage.

  • Removed the unnecessary dependence on Boost::regex which is added automatically by CMake FindBoost module.

  • The GitLab CI script is updated to build the Python package and keep it as an artifact.

Related to issue #223 (closed) and milestone %5

Edited by Ammar Nejati

Merge request reports

Loading