CMakeLists.txt   CMakeLists.txt 
INCLUDE_DIRECTORIES(${VIGRANUMPY_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${VIGRANUMPY_INCLUDE_DIRS})
SET(TEST_SCRIPTS SET(TEST_SCRIPTS
test_arraytypes.py test_arraytypes.py
test_impex.py test_impex.py
test1.py test1.py
test2.py test2.py
test3.py) test3.py
)
# setup the file 'testsuccess.cxx' which will become out-of-date when the # setup the file 'testsuccess.cxx' which will become out-of-date when the
# last test failed or when the tests code changed, so that tests are re-exe cuted # last test failed or when the tests code changed, so that tests are re-exe cuted
SET(TEST_SUCCESS_FILE "${CMAKE_CURRENT_BINARY_DIR}/testsuccess.cxx") SET(TEST_SUCCESS_FILE "${CMAKE_CURRENT_BINARY_DIR}/testsuccess.cxx")
# find the vigranumpy modules that we want to test, and make # find the vigranumpy modules that we want to test, and make
# 'testsuccess.cxx' depend on them # 'testsuccess.cxx' depend on them
# TODO: Does cmake provide a standard way to find those dependencies? # TODO: Does cmake provide a standard way to find those dependencies?
GET_TARGET_PROPERTY(VIGRANUMPY_DEPENDS vigranumpy VIGRA_DEPENDS) GET_TARGET_PROPERTY(VIGRANUMPY_DEPENDS vigranumpy VIGRA_DEPENDS)
SEPARATE_ARGUMENTS(VIGRANUMPY_DEPENDS) SEPARATE_ARGUMENTS(VIGRANUMPY_DEPENDS)
skipping to change at line 34 skipping to change at line 35
ARGS -E touch ${TEST_SUCCESS_FILE}) ARGS -E touch ${TEST_SUCCESS_FILE})
FILE(GLOB TESTSUCCESS_FOUND ${TEST_SUCCESS_FILE}) FILE(GLOB TESTSUCCESS_FOUND ${TEST_SUCCESS_FILE})
IF(NOT TESTSUCCESS_FOUND) IF(NOT TESTSUCCESS_FOUND)
FILE(WRITE ${TEST_SUCCESS_FILE} FILE(WRITE ${TEST_SUCCESS_FILE}
"// auto-generated dummy file to force re-execution of failed tests "// auto-generated dummy file to force re-execution of failed tests
") ")
ENDIF() ENDIF()
# setup the test target # setup the test target
ADD_LIBRARY(vigranumpytest SHARED EXCLUDE_FROM_ALL IF(AUTOBUILD_TESTS)
vigranumpytest.cxx ${TEST_SUCCESS_FILE} ${TEST_SCRIPTS}) ADD_LIBRARY(vigranumpytest SHARED
vigranumpytest.cxx ${TEST_SUCCESS_FILE} ${TEST_SCRIPTS})
ELSE()
ADD_LIBRARY(vigranumpytest SHARED EXCLUDE_FROM_ALL
vigranumpytest.cxx ${TEST_SUCCESS_FILE} ${TEST_SCRIPTS})
ENDIF()
IF(PYTHON_PLATFORM MATCHES "^windows$") IF(PYTHON_PLATFORM MATCHES "^windows$")
SET_TARGET_PROPERTIES(vigranumpytest PROPERTIES PREFIX "" SUFFIX ".pyd ") SET_TARGET_PROPERTIES(vigranumpytest PROPERTIES PREFIX "" SUFFIX ".pyd ")
ELSEIF(MACOSX)
SET_TARGET_PROPERTIES(vigranumpytest PROPERTIES PREFIX "" SUFFIX ".so")
ELSE() ELSE()
SET_TARGET_PROPERTIES(vigranumpytest PROPERTIES PREFIX "") SET_TARGET_PROPERTIES(vigranumpytest PROPERTIES PREFIX "")
ENDIF() ENDIF()
TARGET_LINK_LIBRARIES(vigranumpytest ${VIGRANUMPY_LIBRARIES} vigranumpy_cor #TARGET_LINK_LIBRARIES(vigranumpytest ${VIGRANUMPY_LIBRARIES} vigranumpy_co
e) re)
TARGET_LINK_LIBRARIES(vigranumpytest ${VIGRANUMPY_LIBRARIES})
ADD_DEPENDENCIES(check_python vigranumpytest) ADD_DEPENDENCIES(check_python vigranumpytest)
ADD_DEPENDENCIES(ctest vigranumpytest) ADD_DEPENDENCIES(ctest vigranumpytest)
ADD_DEPENDENCIES(vigranumpytest vigranumpy) ADD_DEPENDENCIES(vigranumpytest vigranumpy)
# setup the file 'set_path.py' to ensure that tests are run against the bin aries # setup the file 'set_path.py' to ensure that tests are run against the bin aries
# which are currently being built, not against (possibly outdated) installe d modules # which are currently being built, not against (possibly outdated) installe d modules
MACRO(DEPENDENCY_PATH variable target)
GET_TARGET_PROPERTY(${variable} ${target} LOCATION)
STRING(REGEX REPLACE "(/\\$\\([^\\)]*\\)/[^/]*|/[^/]*)$" "" ${variable}
${${variable}}) # get path prefix
FILE(TO_NATIVE_PATH ${${variable}} ${variable})
ENDMACRO(DEPENDENCY_PATH)
DEPENDENCY_PATH(VIGRAIMPEX_PATH vigraimpex) DEPENDENCY_PATH(VIGRAIMPEX_PATH vigraimpex)
DEPENDENCY_PATH(VIGRANUMPYTEST_PATH vigranumpytest) DEPENDENCY_PATH(VIGRANUMPYTEST_PATH vigranumpytest)
STRING(REGEX REPLACE "/vigra$" "" VIGRANUMPY_TMP_PATH ${vigranumpy_tmp_dir} ) STRING(REGEX REPLACE "/vigra$" "" VIGRANUMPY_TMP_PATH ${vigranumpy_tmp_dir} )
FILE(TO_NATIVE_PATH "${VIGRANUMPY_TMP_PATH}" VIGRANUMPY_TMP_PATH) FILE(TO_NATIVE_PATH "${VIGRANUMPY_TMP_PATH}" VIGRANUMPY_TMP_PATH)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/set_paths.py configure_file(${CMAKE_CURRENT_SOURCE_DIR}/set_paths.py.in
${CMAKE_CURRENT_BINARY_DIR}/set_paths.py ${CMAKE_CURRENT_BINARY_DIR}/set_paths.py
@ONLY) @ONLY)
IF(AUTOEXEC_TESTS) IF(NOT PYTHON_NOSETESTS_NOT_FOUND)
IF(NOT PYTHON_NOSETESTS_NOT_FOUND) # copy the individual test scripts
FOREACH(test_script ${TEST_SCRIPTS})
ADD_CUSTOM_COMMAND(
TARGET vigranumpytest
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/${test_script} ${CMAKE_CURRENT_BINA
RY_DIR}/${test_script}
COMMENT "Running vigranumpy tests")
ENDFOREACH(test_script)
# copy the individual test scripts VIGRA_NATIVE_PATH(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
FOREACH(test_script ${TEST_SCRIPTS})
ADD_CUSTOM_COMMAND(
TARGET vigranumpytest
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/${test_script} ${CMAKE_CURRENT_
BINARY_DIR}/${test_script}
COMMENT "Running vigranumpy tests")
ENDFOREACH(test_script)
VIGRA_NATIVE_PATH(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
# Windows: Set the DLL path to the binaries currently being built
# (so that binaries which are already installed are ignore
d)
# This is not necessary on Linux, because the correct path
# is hard-coded into the module by means of 'rpath'
set(VIGRA_PATH "")
if(WIN32)
IF(CYGWIN)
SET(PATHSEP ":")
ELSE()
SET(PATHSEP ";")
ENDIF()
FOREACH(lib ${LIBRARIES})
GET_TARGET_PROPERTY(p ${lib} LOCATION)
if(p)
GET_FILENAME_COMPONENT(p ${p} PATH)
VIGRA_NATIVE_PATH(p ${p})
SET(VIGRA_PATH "${p}${PATHSEP}${VIGRA_PATH}")
endif()
ENDFOREACH(lib)
endif()
# Setup the test execution script
VIGRA_NATIVE_PATH(VIGRA_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_D
IR})
SET(VIGRA_TEST_EXECUTABLE "${PYTHON_EXECUTABLE} -c \"import nose; n
ose.main()\" .")
IF(MSVC OR MINGW)
SET(VIGRA_TEST_EXECUTABLE "${VIGRA_TEST_EXECUTABLE} %CONFIGURAT
ION%")
SET(VIGRA_RUN_TEST "${CMAKE_CURRENT_BINARY_DIR}/run_vigramumpyt
est.bat")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config/run_test.bat.in
${VIGRA_RUN_TEST}
@ONLY)
ELSE()
SET(VIGRA_RUN_TEST "${CMAKE_CURRENT_BINARY_DIR}/run_vigramumpyt
est.sh")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config/run_test.sh.in
${VIGRA_RUN_TEST}
@ONLY)
EXECUTE_PROCESS(COMMAND chmod u+x ${VIGRA_RUN_TEST} OUTPUT_QUIE
T ERROR_QUIET)
ENDIF()
# register the test execution command # Windows: Set the DLL path to the binaries currently being built
# VIGRA_CONFIGURATION is 'release' or 'debug' on Windows, nothing o # (so that binaries which are already installed are ignored)
n Linux # This is not necessary on Linux, because the correct path
IF(NOT CMAKE_CFG_INTDIR STREQUAL ".") # is hard-coded into the module by means of 'rpath'
SET(VIGRA_CONFIGURATION ${CMAKE_CFG_INTDIR}) set(VIGRA_PATH "")
if(WIN32)
IF(CYGWIN)
SET(PATHSEP ":")
ELSE() ELSE()
SET(VIGRA_CONFIGURATION) SET(PATHSEP ";")
ENDIF() ENDIF()
FOREACH(lib ${LIBRARIES})
GET_TARGET_PROPERTY(p ${lib} LOCATION)
if(p)
GET_FILENAME_COMPONENT(p ${p} PATH)
VIGRA_NATIVE_PATH(p ${p})
SET(VIGRA_PATH "${p}${PATHSEP}${VIGRA_PATH}")
endif()
ENDFOREACH(lib)
endif()
# Setup the test execution script
VIGRA_NATIVE_PATH(VIGRA_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
SET(VIGRA_TEST_EXECUTABLE "${PYTHON_EXECUTABLE} -c \"import nose; nose.
main()\" .")
IF(MSVC OR MINGW)
SET(VIGRA_TEST_EXECUTABLE "${VIGRA_TEST_EXECUTABLE} %CONFIGURATION%
")
SET(VIGRA_RUN_TEST "${CMAKE_CURRENT_BINARY_DIR}/run_vigranumpytest.
bat")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config/run_test.bat.in
${VIGRA_RUN_TEST}
@ONLY)
ELSE()
SET(VIGRA_RUN_TEST "${CMAKE_CURRENT_BINARY_DIR}/run_vigranumpytest.
sh")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config/run_test.sh.in
${VIGRA_RUN_TEST}
@ONLY)
EXECUTE_PROCESS(COMMAND chmod u+x ${VIGRA_RUN_TEST} OUTPUT_QUIET ER
ROR_QUIET)
ENDIF()
# register the test execution command
# VIGRA_CONFIGURATION is 'release' or 'debug' on Windows, nothing on Li
nux
# variable CMAKE_CFG_INTDIR contains a dot '.' for a Windows nmake buil
d, or
# '$(OutDir)' for a VisualStudio build (OutDi
r will be
# set by VS at build time)
IF(NOT CMAKE_CFG_INTDIR STREQUAL ".")
SET(VIGRA_CONFIGURATION ${CMAKE_CFG_INTDIR})
ELSE()
SET(VIGRA_CONFIGURATION)
ENDIF()
IF(AUTOEXEC_TESTS)
add_custom_command( add_custom_command(
TARGET vigranumpytest TARGET vigranumpytest
POST_BUILD POST_BUILD
COMMAND ${VIGRA_RUN_TEST} ARGS ${VIGRA_CONFIGURATION} COMMAND ${VIGRA_RUN_TEST} ARGS ${VIGRA_CONFIGURATION}
COMMENT "Running vigranumpy tests") COMMENT "Running vigranumpy tests")
ENDIF()
ELSE() ADD_TEST(vigranumpytest ${VIGRA_RUN_TEST} ${VIGRA_CONFIGURATION})
ELSE()
MESSAGE(STATUS " vigranumpy tests will NOT be executed (nosetests missing)") MESSAGE(STATUS " vigranumpy tests will NOT be executed (nosetests missing)")
ENDIF()
ENDIF() ENDIF()
 End of changes. 15 change blocks. 
81 lines changed or deleted 87 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/