Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Modify build system to allow generation of wheels and Debian packages #119

Open
wants to merge 4 commits into
base: master2
Choose a base branch
from

Conversation

m-weigand
Copy link

Hi,

or internal use we wanted to distribute CPlantBox either via Python wheels or using Debian packages, and I could not find any information on that in the code. Therefore, I thought our changes might be interesting to other users of CPlantBox. However, feel free to close the PR or suggest relevant changes in case you want to keep (some) of these changes.

In order to generate the packages, some changes to the build system were required - I'm not completely sure if these changes have any unintended side effects for other general use cases of CPlantBox (i.e., I had to revert the target location of the .so files back to their default).

Anyway, the current state allows the generation of wheels and Debian packages, as tested on a Debian bookworm and an old Debian 10.13 (Buster) installation. Please also note that wheels could directly be uploaded to pypi.org, enabling to install CPlantBox easily via an pip install cplantbox for supported architectures/interpreters.

Build instructions

Starting in a clean virtualenv:

pip install build wheel ninja

I had some problems with the pybind11 version, but 2.4 and 2.11.1 finally worked:

cd src/external/
rm -rf pybind11
# for older systems (i.e. Debian 10.13)
git clone --depth 1 -b v2.4 https://github.com/pybind/pybind11.git
# Debian Bookworm worked with:
git clone --depth 1 -b v2.11.1 https://github.com/pybind/pybind11.git

Wheels are then built with:

python setup.py bdist_wheel
or
python -m build --wheel

Debian packaging

# on Debian ookworm
pip install stdeb
# for Debian Buster:
pip install stdeb==0.9.1
pip install setuptools==40.8.0

The Debian packages are then generated using:

python3 setup.py --command-packages=stdeb.command bdist_deb

output is located in deb_dist/

build directory.

This allows building CPlantBox in a separate build directory:

    cd CPlantBox
    mkdir build
    cd build
    cmake ..
    make -j 4
… into the BINARY dir, but in their respective default subdirs (required for Python packaging)
in a clean virtualenv, run:

pip install ninja wheel build

and then build wheel with:

python setup.py bdist_wheel

python -m build --wheel

final wheel can be found in dist/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant