Skip to content

Commit

Permalink
Fix with OpenCascade 7.8.0. (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
thierry-FreeBSD authored Mar 10, 2024
1 parent 680aff9 commit f0ecafb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugins/occt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ if("${OpenCASCADE_VERSION}" VERSION_LESS "7.5.0")
message(FATAL_ERROR "Plugin: OpenCASCADE: ${OpenCASCADE_VERSION} is not supported by F3D, please update your OpenCASCADE installation.")
endif()

if((NOT TARGET "TKSTEP") AND (NOT TARGET "TKIGES") AND (NOT TARGET "TKMesh"))
if("${OpenCASCADE_VERSION}" VERSION_LESS "7.8.0")
if((NOT TARGET "TKSTEP") AND (NOT TARGET "TKIGES") AND (NOT TARGET "TKMesh"))
message(FATAL_ERROR "Plugin: OpenCASCADE does not contain required modules")
endif()
endif()

if((NOT TARGET "TKDESTEP") AND (NOT TARGET "TKDEIGES") AND (NOT TARGET "TKMesh"))
message(FATAL_ERROR "Plugin: OpenCASCADE does not contain required modules")
endif()

Expand All @@ -27,8 +33,14 @@ option(F3D_PLUGIN_OCCT_COLORING_SUPPORT "Enable coloring support in occt plugin"
mark_as_advanced(F3D_PLUGIN_OCCT_COLORING_SUPPORT)

if(F3D_PLUGIN_OCCT_COLORING_SUPPORT)
if (NOT (TARGET "TKXDESTEP") OR NOT (TARGET "TKXDEIGES"))
if("${OpenCASCADE_VERSION}" VERSION_LESS "7.8.0")
if (NOT (TARGET "TKXDESTEP") OR NOT (TARGET "TKXDEIGES"))
message(FATAL_ERROR "occt plugin: TKXDESTEP and TKXDEIGES OCCT modules are not found. Turn off F3D_PLUGIN_OCCT_COLORING_SUPPORT or enable them in your OpenCascade build.")
endif()
else()
if (NOT (TARGET "TKXSDRAWSTEP") OR NOT (TARGET "TKXSDRAWIGES"))
message(FATAL_ERROR "occt plugin: TKXSDRAWSTEP and TKXSDRAWIGES OCCT modules are not found. Turn off F3D_PLUGIN_OCCT_COLORING_SUPPORT or enable them in your OpenCascade build.")
endif()
endif()
endif()

Expand Down
5 changes: 5 additions & 0 deletions plugins/occt/module/vtkF3DOCCTReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#if F3D_PLUGIN_OCCT_XCAF
#include <IGESCAFControl_Reader.hxx>
#include <STEPCAFControl_Reader.hxx>
#include <Standard_Version.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDataStd_Name.hxx>
#include <TDocStd_Document.hxx>
Expand Down Expand Up @@ -487,7 +488,11 @@ class vtkF3DOCCTReader::vtkInternals
int GetHash(const TDF_Label& label)
{
TopoDS_Shape aShape;
#if OCC_VERSION_HEX < 0x070800
return this->ShapeTool->GetShape(label, aShape) ? aShape.HashCode(INT_MAX) : 0;
#else
return this->ShapeTool->GetShape(label, aShape) ? std::hash<TopoDS_Shape>{}(aShape) : 0;
#endif
}

//----------------------------------------------------------------------------
Expand Down

0 comments on commit f0ecafb

Please sign in to comment.