Build the patched cddlib for CddMethod¶
CddMethod needs cddlib and its Python bindings, pycddlib, with two small patches that add
incremental halfspace updates and stable vertex ids. Both are vendored as git submodules
under mga-surveyor/vendor/cdd/, and the patches are applied automatically during the build.
You only need this for vertex_method="cdd"; the default BBMethod does not use cddlib.
Prerequisites: git, Python, uv, and a C compiler: MSVC on Windows (Visual Studio Build Tools with the “Desktop development with C++” workload), gcc or clang on Linux and macOS. CMake and vcpkg are fetched automatically.
Make sure the submodules are checked out:
git submodule update --init --recursive
Check that the base dependencies install, before starting the slow build:
cd mga-surveyor uv sync cd ..
Build GMP, cddlib and the patches:
python mga-surveyor/vendor/cdd/build.pyAt the end it prints environment variables (
INCLUDE/LIBon Windows,CPATH/LIBRARY_PATHon Linux and macOS). Set them in your shell before the next step.Install pycddlib against the build:
cd mga-surveyor uv sync --extra cdd
Check it:
uv run python -c "import cdd, cdd.gmp; cdd.polyhedron_append_halfspaces; cdd.gmp.polyhedron_append_halfspaces" uv run pytest tests/test_cdd_incremental.py tests/test_cdd_vertex_id_stability.py
Every step can be re-run safely, for example after pulling an updated patch.
Note
uv sync removes packages you did not ask for. Once pycddlib is installed, keep passing
--extra cdd to uv sync, or use uv run, which never removes anything.