Skip to content

[cgal] Make GMP/MPFR an optional default feature #53269

Description

Is your feature request related to a problem? Please describe.

The cgal port currently depends unconditionally on gmp and mpfr.
CGAL itself supports a Boost.Multiprecision exact-number backend, so consumers
that only need CGAL's exact predicates cannot currently remove these two native
dependencies through manifest features.

CGAL documents Boost.Multiprecision as an alternative exact-number backend:
https://doc.cgal.org/latest/Manual/thirdparty.html#thirdpartyBoostMp

Proposed solution

Make GMP/MPFR an optional default feature of the cgal port:

  • add a feature such as gmp;
  • include that feature in default-features, preserving the port's current
    behavior;
  • move the gmp and mpfr dependencies into that feature; and
  • when the feature is disabled, configure CGAL with:
    • CGAL_DISABLE_GMP=ON
    • CGAL_CMAKE_EXACT_NT_BACKEND=BOOST_BACKEND

A Boost-only manifest consumer could then use:

{
  "dependencies": [
    {
      "name": "cgal",
      "default-features": false
    }
  ]
}

The existing default would continue to install and select GMP/MPFR, so this
should be backward compatible for current consumers.

Validation

I tested this port shape against vcpkg baseline
9e593bb18ea69cc5095e012465dcd675a822ed0d with CGAL 6.2 and Boost 1.91
on arm64 macOS.

The no-default-feature configuration:

  • installed CGAL without gmp or mpfr in the dependency graph;
  • compiled with CGAL_DISABLE_GMP and without CGAL_USE_GMP /
    CGAL_USE_MPFR;
  • passed an EPICK probe covering an almost-coplanar orientation and
    co-spherical 3D Delaunay insertion;
  • linked without GMP or MPFR dynamic libraries; and
  • passed a downstream project's 127-test suite and produced byte-identical
    canonical reference fixtures versus the default CGAL backend.

This validation is currently limited to arm64 macOS; the normal vcpkg CI
matrix would still be needed for the port change.

I would be happy to prepare a PR if maintainers agree with the feature shape
(including the preferred feature name).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions