cisst / data /cisstVector /testsPython /CMakeLists.txt
introvoyz045's picture
Migrated from GitHub
68ce2fc verified
Raw History Blame Contribute Delete
3.24 kB
#
# (C) Copyright 2005-2024 Johns Hopkins University (JHU), All Rights Reserved.
#
# --- begin cisst license - do not edit ---
#
# This software is provided "as is" under an open source license, with
# no warranty. The complete license can be found in license.txt and
# http://www.cisst.org/cisst/license.txt.
#
# --- end cisst license ---
# CMakeLists.txt for cisstVector wrapping tests
# Keep a list all tests for ctest
set (CTEST_TEST_FILE ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile-cisstVectorPython.txt)
set (CTEST_TEST_FILE_AUTO ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile-cisstVectorPython-auto.txt)
file (WRITE ${CTEST_TEST_FILE} "# File generated by CMake, do not modify\n")
# Allow generated c++ code to find header files
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
# We are using C++ code
cisst_add_swig_module (MODULE cisstVectorPythonTest
FOLDER "cisstVector/tests"
MODULE_LINK_LIBRARIES cisstCommon cisstVector)
# Copy the .py file generated to wherever the libraries are
add_custom_command (TARGET cisstVectorPythonTestPython
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy
${CMAKE_CURRENT_BINARY_DIR}/cisstVectorPythonTest.py
${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/cisstVectorPythonTest.py)
# Create the scripts from .in
set (LIB cisstVector)
if (CMAKE_CONFIGURATION_TYPES)
foreach (config ${CMAKE_CONFIGURATION_TYPES})
configure_file (${cisst_SOURCE_DIR}/cisstTestsDriver/cisstTestsDriver.py.in
${EXECUTABLE_OUTPUT_PATH}/${config}/cisstVectorTests.py
IMMEDIATE @ONLY)
endforeach (config)
else (CMAKE_CONFIGURATION_TYPES)
configure_file (${cisst_SOURCE_DIR}/cisstTestsDriver/cisstTestsDriver.py.in
${EXECUTABLE_OUTPUT_PATH}/cisstVectorTests.py
IMMEDIATE @ONLY)
endif (CMAKE_CONFIGURATION_TYPES)
# Run the script to generate the list of tests automatically
if (WIN32)
add_custom_target (cisstVector_CREATE_PYTHON_TESTS_LIST ALL
COMMAND ${cisstTestsDriver_BINARY_DIR}/cisstTestsDriverPython.bat ${CMAKE_CFG_INTDIR}
${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/cisstVectorTests.py ${CTEST_TEST_FILE_AUTO}
SOURCES ${TEST_PROGRAMS})
else (WIN32)
add_custom_target (cisstVector_CREATE_PYTHON_TESTS_LIST ALL
COMMAND ${Python_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/cisstVectorTests.py
-d ${Python_EXECUTABLE} > ${CTEST_TEST_FILE_AUTO}
SOURCES ${TEST_PROGRAMS})
endif (WIN32)
set_property (TARGET cisstVector_CREATE_PYTHON_TESTS_LIST PROPERTY FOLDER "cisstVector/tests")
add_dependencies (cisstVector_CREATE_PYTHON_TESTS_LIST
cisstCommon
cisstVector
cisstCommonPython
cisstVectorPython
cisstVectorPythonTestPython)
file (APPEND ${CTEST_TEST_FILE} "include (\"${CTEST_TEST_FILE_AUTO}\")\n")
# Add all the test lists
set_directory_properties (PROPERTIES TEST_INCLUDE_FILE
${CTEST_TEST_FILE})