diff options
-rw-r--r-- | var/spack/repos/builtin/packages/cgal/package.py | 64 |
1 files changed, 57 insertions, 7 deletions
diff --git a/var/spack/repos/builtin/packages/cgal/package.py b/var/spack/repos/builtin/packages/cgal/package.py index c1030d42d0..a8f0e3aa9a 100644 --- a/var/spack/repos/builtin/packages/cgal/package.py +++ b/var/spack/repos/builtin/packages/cgal/package.py @@ -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 @@ -53,16 +60,32 @@ 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 @@ -70,7 +93,10 @@ class Cgal(CMakePackage): # 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") @@ -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", @@ -120,7 +164,13 @@ class Cgal(CMakePackage): 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 |