Skip to content

Commit

Permalink
Refs #4399. Fix for Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Feb 16, 2012
1 parent 55e9bd0 commit 10dddf2
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
4 changes: 3 additions & 1 deletion Code/Mantid/Framework/PythonInterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ add_subdirectory ( mantid )
set ( TEST_FILES
test/cpp/PythonObjectInstantiatorTest.h
test/cpp/PySequenceToVectorConverterTest.h
test/cpp/NDArrayToVectorConverterTest.h
# test/cpp/NDArrayToVectorConverterTest.h
)

if ( CXXTEST_FOUND )
Expand Down Expand Up @@ -110,6 +110,7 @@ set ( PYTEST_HELPERS test/python/testhelpers.py )

# python unit tests
if (PYUNITTEST_FOUND)
if ( UNIX )
pyunittest_add_test ( VanillaPythonInterfaceTest.py ${TEST_PY_FILES} )
# Helpers
set ( VANILLA_TEST_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/VanillaPythonInterfaceTest )
Expand All @@ -130,6 +131,7 @@ if (PYUNITTEST_FOUND)
add_dependencies ( FrameworkTests VanillaPythonInterfaceTest.py )
# Add to the 'UnitTests' group in VS
set_property ( TARGET VanillaPythonInterfaceTest.py PROPERTY FOLDER "UnitTests" )
endif()
endif ()

###########################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
*/
#include "MantidKernel/System.h"
#include <boost/python/detail/prefix.hpp> // Safe include of Python.h

// See http://docs.scipy.org/doc/numpy/reference/c-api.array.html#PY_ARRAY_UNIQUE_SYMBOL
#define PY_ARRAY_UNIQUE_SYMBOL KERNEL_ARRAY_API
#define NO_IMPORT_ARRAY
#include <numpy/ndarrayobject.h>
#include <numpy/ndarraytypes.h>

namespace Mantid
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
#include "MantidPythonInterface/kernel/Registry/PropertyValueHandler.h"
#include <boost/python/numeric.hpp>

namespace Mantid
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include "MantidPythonInterface/kernel/Converters/NDArrayTypeIndex.h"
#include <boost/python/extract.hpp>

//#define PY_ARRAY_UNIQUE_SYMBOL KERNEL_ARRAY_API
#define NO_ARRAY_IMPORT
#include <numpy/ndarrayobject.h>

namespace Mantid
{
namespace PythonInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace Mantid
void SequenceTypeHandler<ContainerType>::set(Kernel::IPropertyManager* alg, const std::string &name,
boost::python::object value)
{
using boost::python::numeric::array;
using boost::python::len;
typedef typename ContainerType::value_type DestElementType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
#define NDARRAYTOVECTORCONVETERTEST_H_

#include "MantidPythonInterface/kernel/Converters/NDArrayToVectorConverter.h"
#include <boost/python/detail/prefix.hpp> // Include Python.h safely
#define PY_ARRAY_UNIQUE_SYMBOL KERNEL_ARRAY_API
#include <numpy/ndarrayobject.h> // _import_array

#include <boost/python/list.hpp>
#include <boost/python/extract.hpp>
Expand Down Expand Up @@ -33,8 +30,8 @@ class NDArrayToVectorConverterTest : public CxxTest::TestSuite

NDArrayToVectorConverterTest()
{
_import_array(); // Import the numpy module for this process
boost::python::numeric::array::set_module_and_type("numpy", "ndarray");
//_import_array(); // Import the numpy module for this process
//boost::python::numeric::array::set_module_and_type("numpy", "ndarray");
}

void test_construction_succeeds_with_a_numpy_array()
Expand Down Expand Up @@ -71,7 +68,7 @@ class NDArrayToVectorConverterTest : public CxxTest::TestSuite
{
std::vector<Py_ssize_t> dims;
boost::python::numeric::array testArray = create2DArray(dims);
const size_t nelements = PyArray_SIZE(testArray.ptr());
const size_t nelements = 40;
std::vector<double> cvector;
TS_ASSERT_THROWS_NOTHING(cvector = NumpyToVectorDouble(testArray)());
TS_ASSERT_EQUALS(cvector.size(), nelements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "MantidPythonInterface/kernel/PythonObjectInstantiator.h"

#include "MantidKernel/ConfigService.h"

#include <boost/python/object.hpp>
#include <boost/python/numeric.hpp>

// ---------- Test world initialization ---------------------------------

Expand Down

0 comments on commit 10dddf2

Please sign in to comment.