Skip to content

Commit

Permalink
VTK: update to master and add mangling
Browse files Browse the repository at this point in the history
Mangling VTK uses an inline namespace to change the VTK symbols in the
binary so as to allow multiple VTK binaries to coexist
  • Loading branch information
CharlesGueunet authored and Julien Fausty committed Jul 20, 2023
1 parent da5e837 commit ff57a33
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,7 @@ if( ENABLE_VTK )
set( VTK_DIR "${CMAKE_INSTALL_PREFIX}/vtk" )
set( VTK_URL "${TPL_MIRROR_DIR}/VTK-59d89108f4.tar.gz" )


message( STATUS "Building VTK found at ${VTK_URL}" )

# Depending on the platfor, the install directory could be 'lib' or 'lib64'.
Expand All @@ -1093,6 +1094,12 @@ if( ENABLE_VTK )
# I'm no cmake expert and I do not know if there was a better way to deal with it.
set( VTK_CMAKE_INSTALL_LIBDIR "lib" )

# This compile option will enclose all of the VTK library within a vtk_geosx namespace.
# This mangling is needed in order to ensure that the VTK included with geosx does
# not interfere with another VTK version that may be linked dynamically at runtime
# (when using ParaView's Catalyst implementation for example).
set( VTK_ABI_NAMESPACE_NAME "vtk_geosx" )

if( ENABLE_MPI )
set( VTK_C_COMPILER ${MPI_C_COMPILER} )
set( VTK_CXX_COMPILER ${MPI_CXX_COMPILER} )
Expand All @@ -1111,7 +1118,6 @@ endif( ENABLE_MPI )
PREFIX ${PROJECT_BINARY_DIR}/vtk
URL ${VTK_URL}
INSTALL_DIR ${VTK_DIR}
PATCH_COMMAND patch -p0 < ${TPL_MIRROR_DIR}/vtkXMLReader-fpe.patch
BUILD_COMMAND ${TPL_BUILD_COMMAND}
INSTALL_COMMAND "${TPL_INSTALL_COMMAND}"
PATCH_COMMAND patch -p1 < ${TPL_MIRROR_DIR}/VTK-ABI.patch
Expand Down Expand Up @@ -1140,7 +1146,8 @@ endif( ENABLE_MPI )
-D VTK_MODULE_ENABLE_VTK_IOXML=YES
-D VTK_MODULE_ENABLE_VTK_IOLegacy=YES
-D VTK_BUILD_TESTING=OFF
-D VTK_LEGACY_REMOVE=ON )
-D VTK_LEGACY_REMOVE=ON
-D VTK_ABI_NAMESPACE_NAME=${VTK_ABI_NAMESPACE_NAME} )

list( APPEND build_list vtk )
endif( ENABLE_VTK )
Expand Down
3 changes: 3 additions & 0 deletions tplMirror/VTK-59d89108f4.tar.gz
Git LFS file not shown
65 changes: 65 additions & 0 deletions tplMirror/VTK-ABI.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
diff --git a/Common/Core/vtkValueFromString.cxx b/Common/Core/vtkValueFromString.cxx
index 9e619a87a5..93ca79486d 100644
--- a/Common/Core/vtkValueFromString.cxx
+++ b/Common/Core/vtkValueFromString.cxx
@@ -203,6 +203,8 @@ const char* ParseInt(const char* it, const char* end, bool minus_sign, int base,
}
}

+VTK_ABI_NAMESPACE_BEGIN
+
// Overload for integers
template <typename T,
typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, bool>::type =
diff --git a/Filters/Core/vtkFieldDataToDataSetAttribute.cxx b/Filters/Core/vtkFieldDataToDataSetAttribute.cxx
index 9a8b23c67b..d8a451eca8 100644
--- a/Filters/Core/vtkFieldDataToDataSetAttribute.cxx
+++ b/Filters/Core/vtkFieldDataToDataSetAttribute.cxx
@@ -28,6 +28,7 @@

#include <set>

+VTK_ABI_NAMESPACE_BEGIN
vtkStandardNewMacro(vtkFieldDataToDataSetAttribute);

//------------------------------------------------------------------------------
diff --git a/Rendering/LICOpenGL2/vtkCompositeSurfaceLICMapper.cxx b/Rendering/LICOpenGL2/vtkCompositeSurfaceLICMapper.cxx
index 6b00e7ff0f..b8d879ac9b 100644
--- a/Rendering/LICOpenGL2/vtkCompositeSurfaceLICMapper.cxx
+++ b/Rendering/LICOpenGL2/vtkCompositeSurfaceLICMapper.cxx
@@ -54,6 +54,8 @@

#include "vtkSurfaceLICInterface.h"

+VTK_ABI_NAMESPACE_BEGIN
+
vtkStandardNewMacro(vtkCompositeSurfaceLICMapper);
//------------------------------------------------------------------------------
vtkCompositeSurfaceLICMapper::vtkCompositeSurfaceLICMapper() = default;
diff --git a/Rendering/OpenGL2/vtkOpenGLBatchedPolyDataMapper.cxx b/Rendering/OpenGL2/vtkOpenGLBatchedPolyDataMapper.cxx
index d46b537d33..1ea50351bf 100644
--- a/Rendering/OpenGL2/vtkOpenGLBatchedPolyDataMapper.cxx
+++ b/Rendering/OpenGL2/vtkOpenGLBatchedPolyDataMapper.cxx
@@ -42,7 +42,6 @@
#include "vtkUnsignedIntArray.h"
#include <sstream>

-VTK_ABI_NAMESPACE_BEGIN
namespace
{
template <typename T>
@@ -64,6 +63,8 @@ private:

} // end anonymous namespace

+VTK_ABI_NAMESPACE_BEGIN
+
//------------------------------------------------------------------------------
vtkStandardNewMacro(vtkOpenGLBatchedPolyDataMapper);

@@ -1643,3 +1644,5 @@ int vtkOpenGLBatchedPolyDataMapper::CanUseTextureMapForColoring(vtkDataObject*)

return 1;
}
+
+VTK_ABI_NAMESPACE_END

0 comments on commit ff57a33

Please sign in to comment.