Commit f20040e0 authored by David Gobbi's avatar David Gobbi
Browse files

Add VTK_USE_EXTERN_TEMPLATE in vtkConfigure.h

By adding this, we can avoid repeating the compiler checks every time
we want to declare an extern template.
parent 4ef267b1
Pipeline #24336 passed with stage
......@@ -305,7 +305,7 @@ extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long long);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned short);
#pragma warning (pop)
#elif !defined(__MINGW32__)
#elif defined(VTK_USE_EXTERN_TEMPLATE)
extern template class vtkAOSDataArrayTemplate<char>;
extern template class vtkAOSDataArrayTemplate<double>;
extern template class vtkAOSDataArrayTemplate<float>;
......
......@@ -161,6 +161,12 @@
# define VTK_DELETE_FUNCTION
#endif
/** extern template declarations for C++11
*/
#if __cplusplus >= 201103L && !defined(_MSC_VER) && !defined(__MINGW32__)
#define VTK_USE_EXTERN_TEMPLATE
#endif
/** std::auto_ptr is deprecated in C++11 and will be removed in C++17
* use std::unique_ptr in C++11 and later compilers.
*/
......
......@@ -261,7 +261,7 @@ extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long long);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned short);
#pragma warning (pop)
#elif !defined(__MINGW32__)
#elif defined(VTK_USE_EXTERN_TEMPLATE)
extern template class vtkSOADataArrayTemplate<char>;
extern template class vtkSOADataArrayTemplate<double>;
extern template class vtkSOADataArrayTemplate<float>;
......
......@@ -21,7 +21,7 @@ more efficient and flexible that the original PyArg_ParseTuple() code,
resulting in wrapper code that is faster and more compact.
-----------------------------------------------------------------------*/
// Keep vtkPythonArgs.h from declaring "externs" for what we define here
// Keep vtkPythonArgs.h from declaring externs for templates we instantiate
#define VTK_PYTHON_ARGS_CXX
#include "vtkPythonArgs.h"
......
......@@ -824,8 +824,7 @@ PyObject *vtkPythonArgs::BuildBytes(const char *a, int n)
vtkForPythonArrayTypeMacro(unsigned long long)
// Forward declare the Array class template over all types:
#if !defined(VTK_PYTHON_ARGS_CXX) && \
!defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(VTK_USE_EXTERN_TEMPLATE) && !defined(VTK_PYTHON_ARGS_CXX)
#define vtkForPythonArrayTypeMacro(type) \
extern template class vtkPythonArgs::Array<type>;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment