Skip to content

Commit

Permalink
cgal: update depends versions for 6.0.1 (spack#47516)
Browse files Browse the repository at this point in the history
* This extends PR spack#47285 to properly include some of the required version constrains of cgal 6 incl C++ standard. It also adds the new no-gmp backend as a variant.

* fix style

* disable cgal@6 +demo variant as the demos require qt6 which is not in spack

* disable the gmp variant until clarity on how its supposed to work is provided. bound shared and header_only variants to relevant versions

* Fix missing msvc compiler limit, fix variant left in

* Add more comments. Better describe the gmp variant. Remove testing code

* fix style
  • Loading branch information
Chrismarsh authored Nov 19, 2024
1 parent 50970f8 commit 853f70e
Showing 1 changed file with 57 additions and 7 deletions.
64 changes: 57 additions & 7 deletions var/spack/repos/builtin/packages/cgal/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,21 @@ class Cgal(CMakePackage):

depends_on("cxx", type="build") # generated

variant("shared", default=True, description="Enables the build of shared libraries")
# @5: is header only and doesn't build shared libs
variant(
"shared", default=True, description="Enables the build of shared libraries", when="@:4.14"
)

variant(
"build_type",
default="Release",
description="The build type to build",
values=("Debug", "Release"),
)
variant("header_only", default=False, description="Install in header only mode")

# header only is the default and only option for 5+
# https://doc.cgal.org/latest/Manual/installation.html
variant("header_only", default=False, description="Install in header only mode", when="@:4.13")

# ---- See "7 CGAL Libraries" at:
# https://doc.cgal.org/latest/Manual/installation.html
Expand All @@ -53,24 +60,43 @@ class Cgal(CMakePackage):
# https://cs.nyu.edu/exact/core_pages/svn-core.html
variant("core", default=False, description="Build the CORE library for algebraic numbers")
variant("imageio", default=False, description="Build utilities to read/write image files")
variant("demos", default=False, description="Build CGAL demos")
variant("demos", default=False, description="Build CGAL demos", when="@:5")
variant("eigen", default=True, description="Build with Eigen support")

depends_on("cmake@2.8.11:", type="build")
# Starting with cgal 6, GMP/MPFR are no longer mandatory and Core library
# is based on on Boost.Multiprecision. However, either GMP backend or Boost
# backend can be used. Downstream cmake users must also set -DCGAL_DISABLE_GMP=1
# or the macro CMAKE_OVERRIDDEN_DEFAULT_ENT_BACKEND if GMP is disabled.
# This variant doesn't change how cgal is installed, but it does change spack to
# not depend on gmp & mpfr.
# More details here https://github.com/CGAL/cgal/issues/8606
variant("gmp", default=True, description="Enable the GMP backend", when="@6:")

# Upper bound follows CGAL's @6: CMakeLists.txt
depends_on("cmake@3.12:3.29", type="build", when="@6:")
depends_on("cmake@2.8.11:", type="build", when="@:5")

# Essential Third Party Libraries
depends_on("boost+exception+math+random+container", when="@5.0:")
depends_on("boost@1.72.0:+exception+math+random+container", when="@6:")
depends_on("boost+thread+system", when="@:5.0")
depends_on("gmp")
depends_on("mpfr")

depends_on("gmp", when="@:5")
depends_on("mpfr", when="@:5")

depends_on("gmp", when="@6: +gmp")
depends_on("mpfr", when="@6: +gmp")

# Required for CGAL_ImageIO
# depends_on('opengl', when='+imageio') # not yet in Spack
depends_on("zlib-api")

# Optional to build CGAL_Qt5 (demos)
# depends_on('opengl', when='+demos') # not yet in Spack
depends_on("qt@5:", when="+demos")
depends_on("qt@5:", when="@:5 +demos")

# Demos are now based on qt6, but at the moment qt6 is not in spack
# depends_on("qt@6:", when="@6: +demos")

# Optional Third Party Libraries
depends_on("eigen", when="+eigen")
Expand All @@ -84,6 +110,24 @@ class Cgal(CMakePackage):
# depends_on('esbtl')
# depends_on('intel-tbb')

# @6: requires C++17 or later. The table gives tested
# compilers, so use the lwoer limit of that as the bounds
# https://www.cgal.org/2024/10/22/cgal601/
with when("@6:"):
# Gnu g++ 11.4.0 or later (on Linux or macOS)
conflicts("%gcc @:11.3.0", when="platform=darwin")
conflicts("%gcc @:11.3.0", when="platform=linux")

# LLVM Clang version 15.0.7 or later (on Linux)
conflicts("%clang @:15.0.6", when="platform=linux")

# Apple Clang compiler versions 10.0.1, 12.0.5, and 15.0.0 (on macOS)
# (10+ has C++17 support)
conflicts("%apple-clang @:10.0.0", when="platform=darwin")

# Visual C++ 15.9 or later
conflicts("%msvc @:15.8", when="platform=windows")

conflicts(
"~header_only",
when="@:4.9",
Expand Down Expand Up @@ -120,7 +164,13 @@ def cmake_args(self):
cmake_args.append("-DWITH_CGAL_ImageIO:BOOL=%s" % variant_bool("+imageio"))
cmake_args.append("-DWITH_CGAL_Qt5:BOOL=%s" % variant_bool("+demos"))

if spec.satisfies("@6:"):
cmake_args.append("-DCXX_STANDARD=17")

if spec.satisfies("@4.9:"):
cmake_args.append("-DCGAL_HEADER_ONLY:BOOL=%s" % variant_bool("+header_only"))

if spec.satisfies("~gmp"):
cmake_args.append("-DCGAL_DISABLE_GMP:BOOL=1")

return cmake_args

0 comments on commit 853f70e

Please sign in to comment.