forked from AmbaPant/mantid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PythonInterfaceCppTestInitialization.h
34 lines (30 loc) · 1.2 KB
/
PythonInterfaceCppTestInitialization.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidPythonInterface/core/Testing/PythonInterpreterGlobalFixture.h"
#ifdef _WIN32
#include "MantidPythonInterface/kernel/kernel.h"
#endif
/**
* Import Numpy C API on Windows. This is a noop on other platforms.
* See MantidPythonInterface/kernel/kernel.h for the full details
* of why this is required.
*/
class ImportNumpyCAPI : CxxTest::GlobalFixture {
bool setUpWorld() override {
#ifdef _WIN32
kernel_dll_import_numpy_capi_for_unittest();
#endif
return true;
}
};
//------------------------------------------------------------------------------
// We rely on cxxtest only including this file once so that the following
// statements do not cause multiple-definition errors.
//------------------------------------------------------------------------------
static PythonInterpreterGlobalFixture PYTHON_INTERPRETER;
static ImportNumpyCAPI IMPORT_NUMPY_C_API_KERNEL;