From ab6021553606b213d479d8229a354802734dcb55 Mon Sep 17 00:00:00 2001 From: Philippe Faist Date: Wed, 22 Feb 2017 12:55:11 -0800 Subject: [PATCH] some fixes for python-related tests --- CMakeLists.txt | 10 +++++++--- test/CMakeLists.txt | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8a6616c..1790271b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,16 +267,20 @@ if(TOMOGRAPHER_ENABLE_TESTS) find_package(LAPACK REQUIRED) #endif(NOT LAPACK_FOUND) + + option(TOMOGRAPHER_TEST_SETUPPY_BUILD "Add tests for python module built separately with setup.py bdist_egg" off) + + EnsureCXX11StdThisThreadSleepForAvailable() # find the python executable -- used to run the tests for the python interface - find_package(PythonInterp REQUIRED) + if(BUILD_TOMOPY OR TOMOGRAPHER_TEST_SETUPPY_BUILD) + find_package(PythonInterp REQUIRED) + endif() # Enable testing for the project enable_testing() - option(TOMOGRAPHER_TEST_SETUPPY_BUILD "Add tests for python module built separately with setup.py bdist_egg" off) - message(STATUS "Will build tomographer tests. Use `make test' or `ctest' to run the tests.") add_subdirectory(test) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9a779cf1..07c48f27 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -49,11 +49,12 @@ else() endif() # we need to access the expected output patterns. Trailing slash needed. -set(TOMOGRAPHER_TEST_PATTERNS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/patterns/" +file(RELATIVE_PATH REL_TEST_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/" "${CMAKE_CURRENT_SOURCE_DIR}/") +set(TOMOGRAPHER_TEST_PATTERNS_DIR "${REL_TEST_SOURCE_DIR}/patterns/" CACHE STRING "path to the expected test results patterns") add_definitions(-DTOMOGRAPHER_TEST_PATTERNS_DIR="${TOMOGRAPHER_TEST_PATTERNS_DIR}") # we need to access some data. Trailing slash needed. -set(TOMOGRAPHER_TEST_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data/" +set(TOMOGRAPHER_TEST_DATA_DIR "${REL_TEST_SOURCE_DIR}/data/" CACHE STRING "path to data files required by some tests") add_definitions(-DTOMOGRAPHER_TEST_DATA_DIR="${TOMOGRAPHER_TEST_DATA_DIR}")