Skip to content

Compatibility with CGAL 6

I'd like to contribute these minimal changes I've found are necessary to support CGAL 6, which was just recently released:

  • Build with std=c++17 (I understand this will be the default starting with v2412, so it should be okay)
  • Patch this bug:
patch src/OpenFOAM/db/IOstreams/memory/ISpanStream.H <<EOF
@@ -119,10 +119,10 @@ public:
         #if __cplusplus >= 201703L
         //- Construct (shallow copy) from std::string_view content
         explicit ispanstream(std::string_view s)
-        {
+        :
             buffer_type(const_cast<char*>(s.data()), s.size()),
-            stream_type(static_cast<buffer_type*>(this));
-        }
+            stream_type(static_cast<buffer_type*>(this))
+        {}
         #endif
 
         //- Construct (shallow copy) from span character content
EOF
  • Patch these files:
sed -i '' 's|boost::optional|std::optional|' applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
sed -i '' 's|boost::optional|std::optional|' applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C
sed -i '' 's|boost::get|std::get_if|' applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C

After doing these, OpenFOAM will build with CGAL 6.0 (although it will still emit a couple of deprecation warnings).

If CGAL <= 5 is also to be supported, then the last patches must be conditional on the version of CGAL.