From 74acc2a7bb8784c797d43e2d2bf1c60541992419 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 8 Feb 2019 11:40:29 -0500 Subject: [PATCH] vtkmdiy: Support only including the serialization headers of diy --- vtkm/cont/Serialization.h | 2 +- vtkm/cont/testing/Testing.h | 2 +- vtkm/cont/testing/TestingSerialization.h | 2 +- vtkm/thirdparty/diy/CMakeLists.txt | 1 + vtkm/thirdparty/diy/serialization.h | 37 ++++++++++++++++++++++++ 5 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 vtkm/thirdparty/diy/serialization.h diff --git a/vtkm/cont/Serialization.h b/vtkm/cont/Serialization.h index b6a05eb04..434cf146e 100644 --- a/vtkm/cont/Serialization.h +++ b/vtkm/cont/Serialization.h @@ -22,6 +22,6 @@ #include -#include +#include #endif // vtk_m_cont_Serialization_h diff --git a/vtkm/cont/testing/Testing.h b/vtkm/cont/testing/Testing.h index 2c229c72f..9fe8af51e 100644 --- a/vtkm/cont/testing/Testing.h +++ b/vtkm/cont/testing/Testing.h @@ -33,7 +33,7 @@ #include #include -#include +#include namespace vtkm { diff --git a/vtkm/cont/testing/TestingSerialization.h b/vtkm/cont/testing/TestingSerialization.h index 7f4170ad8..52caab9e2 100644 --- a/vtkm/cont/testing/TestingSerialization.h +++ b/vtkm/cont/testing/TestingSerialization.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include diff --git a/vtkm/thirdparty/diy/CMakeLists.txt b/vtkm/thirdparty/diy/CMakeLists.txt index 8625e777b..d1d3e7a32 100644 --- a/vtkm/thirdparty/diy/CMakeLists.txt +++ b/vtkm/thirdparty/diy/CMakeLists.txt @@ -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() diff --git a/vtkm/thirdparty/diy/serialization.h b/vtkm/thirdparty/diy/serialization.h new file mode 100644 index 000000000..0b74fd07e --- /dev/null +++ b/vtkm/thirdparty/diy/serialization.h @@ -0,0 +1,37 @@ +#ifndef vtk_m_thirdparty_diy_serialization_h +#define vtk_m_thirdparty_diy_serialization_h + +#include + +#if VTKM_USE_EXTERNAL_DIY +#define VTKM_DIY_INCLUDE(header) +#else +#define VTKM_DIY_INCLUDE(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