From 299fdbafdf0338d6e277796035b5cc233369fd66 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Thu, 15 May 2025 10:44:36 +0200 Subject: [PATCH] occ version test for v8.0 --- libsrc/occ/occ_utils.hpp | 8 +++++++- libsrc/occ/python_occ_shapes.cpp | 12 ++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libsrc/occ/occ_utils.hpp b/libsrc/occ/occ_utils.hpp index 12a89693..3277e170 100644 --- a/libsrc/occ/occ_utils.hpp +++ b/libsrc/occ/occ_utils.hpp @@ -1,6 +1,12 @@ #ifndef FILE_OCC_UTILS_INCLUDED #define FILE_OCC_UTILS_INCLUDED +#define NETGEN_OCC_VERSION_AT_LEAST(MAYOR, MINOR) \ + MAYOR > OCC_VERSION_MAYOR || \ + (MAYOR == OCC_VERSION_MAYOR && MINOR >= OCC_VERSION_MINOR) +#define NETGEN_OCC_VERSION_AT_LEAST_MAYOR(MAYOR) \ + NETGEN_OCC_VERSION_AT_LEAST(MAYOR, 0) + #include // #pragma clang diagnostic push @@ -21,7 +27,7 @@ #include "meshing.hpp" -#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4 +#if NETGEN_OCC_VERSION_AT_LEAST(7, 4) #define OCC_HAVE_DUMP_JSON #endif diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 553a835f..b502ae0a 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -14,9 +14,9 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" -#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6 +#if NETGEN_OCC_VERSION_AT_LEAST(7, 6) #include -#endif // OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4 +#endif // NETGEN_OCC_VERSION_AT_LEAST(7, 6) #include #include #include @@ -865,16 +865,16 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) { if(binary) { -#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6 +#if NETGEN_OCC_VERSION_AT_LEAST(7, 6) BinTools_FormatVersion v = version ? BinTools_FormatVersion(*version) : BinTools_FormatVersion_CURRENT; BinTools::Write(shape, filename.c_str(), withTriangles, withNormals, v); -# else // OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6 +# else // NETGEN_OCC_VERSION_AT_LEAST(7, 6) throw Exception("Binary BREP export not supported in this version of OpenCascade"); -#endif // OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6 +#endif // NETGEN_OCC_VERSION_AT_LEAST(7, 6) } else { -#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6 +#if NETGEN_OCC_VERSION_AT_LEAST(7, 6) TopTools_FormatVersion v = version ? (TopTools_FormatVersion)(*version) : TopTools_FormatVersion_CURRENT; BRepTools::Write(shape, filename.c_str(), withTriangles, withNormals, v); #else // OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6