vtkmdiy: Support only including the serialization headers of diy

This commit is contained in:
Robert Maynard 2019-02-08 11:40:29 -05:00
parent 4e1fd2892c
commit 74acc2a7bb
5 changed files with 41 additions and 3 deletions

@ -22,6 +22,6 @@
#include <vtkm/cont/TypeString.h>
#include <vtkm/thirdparty/diy/diy.h>
#include <vtkm/thirdparty/diy/serialization.h>
#endif // vtk_m_cont_Serialization_h

@ -33,7 +33,7 @@
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/cont/VariantArrayHandle.h>
#include <vtkm/thirdparty/diy/diy.h>
#include <vtkm/thirdparty/diy/serialization.h>
namespace vtkm
{

@ -24,7 +24,7 @@
#include <vtkm/cont/VariantArrayHandle.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/thirdparty/diy/diy.h>
#include <vtkm/thirdparty/diy/serialization.h>
#include <random>

@ -66,5 +66,6 @@ if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
install(FILES
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Configure.h
${CMAKE_CURRENT_SOURCE_DIR}/diy.h
${CMAKE_CURRENT_SOURCE_DIR}/serialization.h
DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${kit_dir}/)
endif()

37
vtkm/thirdparty/diy/serialization.h vendored Normal file

@ -0,0 +1,37 @@
#ifndef vtk_m_thirdparty_diy_serialization_h
#define vtk_m_thirdparty_diy_serialization_h
#include <vtkm/thirdparty/diy/Configure.h>
#if VTKM_USE_EXTERNAL_DIY
#define VTKM_DIY_INCLUDE(header) <diy/header>
#else
#define VTKM_DIY_INCLUDE(header) <vtkmdiy/include/vtkmdiy/header>
#define diy vtkmdiy // mangle namespace diy (see below comments)
#endif
// clang-format off
VTKM_THIRDPARTY_PRE_INCLUDE
#include VTKM_DIY_INCLUDE(serialization.hpp)
#undef VTKM_DIY_INCLUDE
VTKM_THIRDPARTY_POST_INCLUDE
// clang-format on
// When using an external DIY
// We need to alias the diy namespace to
// vtkmdiy so that VTK-m uses it properly
#if VTKM_USE_EXTERNAL_DIY
namespace vtkmdiy = ::diy;
#else
// The aliasing approach fails for when we
// want to us an internal version since
// the diy namespace already points to the
// external version. Instead we use macro
// replacement to make sure all diy classes
// are placed in vtkmdiy placed
#undef diy // mangle namespace diy
#endif
#endif