Commit 3cfca864 authored by David Fairbrother's avatar David Fairbrother
Browse files

Fix compilation error from extern template being removed

Clang-tidy must have though these were obselete (which they are on every platform
but OSX), so protect them with a macro and add them back
parent 63245576
......@@ -19,7 +19,20 @@
#define NO_IMPORT_ARRAY
#include <numpy/arrayobject.h>
namespace Mantid::PythonInterface::Converters::Impl {
namespace Mantid::PythonInterface::Converters {
#ifdef __APPLE__
extern template int NDArrayTypeIndex<bool>::typenum;
extern template int NDArrayTypeIndex<int>::typenum;
extern template int NDArrayTypeIndex<long>::typenum;
extern template int NDArrayTypeIndex<long long>::typenum;
extern template int NDArrayTypeIndex<unsigned int>::typenum;
extern template int NDArrayTypeIndex<unsigned long>::typenum;
extern template int NDArrayTypeIndex<unsigned long long>::typenum;
extern template int NDArrayTypeIndex<float>::typenum;
extern template int NDArrayTypeIndex<double>::typenum;
extern template int NDArrayTypeIndex<Mantid::Types::Core::DateAndTime>::typenum;
#endif
namespace Impl {
/**
* Returns a new numpy array with the a copy of the data from 1D vector with the
* exception of string elements where a Python list is produced
......@@ -151,4 +164,5 @@ INSTANTIATE_CLONEND(Types::Core::DateAndTime)
// Need further ND specialisation for bool
INSTANTIATE_CLONEND(bool)
///@endcond
} // namespace Mantid::PythonInterface::Converters::Impl
} // namespace Impl
} // namespace Mantid::PythonInterface::Converters
......@@ -31,7 +31,19 @@ template <typename T> void capsule_cleanup(PyObject *capsule) {
} // namespace
namespace Mantid::PythonInterface::Converters::Impl {
namespace Mantid::PythonInterface::Converters {
#ifdef __APPLE__
extern template int NDArrayTypeIndex<bool>::typenum;
extern template int NDArrayTypeIndex<int>::typenum;
extern template int NDArrayTypeIndex<long>::typenum;
extern template int NDArrayTypeIndex<long long>::typenum;
extern template int NDArrayTypeIndex<unsigned int>::typenum;
extern template int NDArrayTypeIndex<unsigned long>::typenum;
extern template int NDArrayTypeIndex<unsigned long long>::typenum;
extern template int NDArrayTypeIndex<float>::typenum;
extern template int NDArrayTypeIndex<double>::typenum;
#endif
namespace {
/**
* Flip the writable flag to ensure the array is read only
......@@ -48,6 +60,8 @@ void markReadOnly(PyArrayObject *arr) {
}
} // namespace
namespace Impl {
/**
* Defines the wrapWithNDArray specialization for C array types
*
......@@ -95,4 +109,5 @@ INSTANTIATE_WRAPNUMPY(unsigned long long)
INSTANTIATE_WRAPNUMPY(double)
INSTANTIATE_WRAPNUMPY(float)
///@endcond
} // namespace Mantid::PythonInterface::Converters::Impl
} // namespace Impl
} // namespace Mantid::PythonInterface::Converters
\ No newline at end of file
Supports Markdown
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