occ version test for v8.0

This commit is contained in:
Christopher Lackner 2025-05-15 10:44:36 +02:00
parent 3d3eecba3c
commit 299fdbafdf
2 changed files with 13 additions and 7 deletions

View File

@ -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 <variant>
// #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

View File

@ -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 <BinTools_ShapeWriter.hxx>
#endif // OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4
#endif // NETGEN_OCC_VERSION_AT_LEAST(7, 6)
#include <BOPAlgo_Builder.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRepAlgoAPI_Common.hxx>
@ -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