| 1 |
# SPDX-License-Identifier: BSD-3-Clause |
| 2 |
# Copyright Contributors to the OpenEXR Project. |
| 3 |
|
| 4 |
if(TARGET Python2::Interpreter) |
| 5 |
add_test(PyImath.PyImathTest_Python2 |
| 6 |
${Python2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in |
| 7 |
) |
| 8 |
set_tests_properties(PyImath.PyImathTest_Python2 PROPERTIES |
| 9 |
ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}" |
| 10 |
) |
| 11 |
endif() |
| 12 |
|
| 13 |
if(TARGET Python3::Interpreter) |
| 14 |
add_test(PyImath.PyImathTest_Python3 |
| 15 |
${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in |
| 16 |
) |
| 17 |
set_tests_properties(PyImath.PyImathTest_Python3 PROPERTIES |
| 18 |
ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}" |
| 19 |
) |
| 20 |
|
| 21 |
add_executable(PyImathTestC main.cpp testStringTable.cpp) |
| 22 |
|
| 23 |
target_link_libraries(PyImathTestC |
| 24 |
Imath::Config |
| 25 |
Imath::PyImath_Python${Python_VERSION_MAJOR}_${Python_VERSION_MINOR} |
| 26 |
Python3::Python |
| 27 |
Boost::${PYIMATH_BOOST_PY_COMPONENT}) |
| 28 |
set_target_properties(PyImathTestC PROPERTIES |
| 29 |
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 30 |
) |
| 31 |
|
| 32 |
add_test(NAME Imath.PyImathTestC COMMAND $<TARGET_FILE:PyImathTestC>) |
| 33 |
set(PYTHONPATH ${CMAKE_BINARY_DIR}/python${Python_VERSION_MAJOR}_${Python_VERSION_MINOR}) |
| 34 |
set_tests_properties(Imath.PyImathTestC PROPERTIES ENVIRONMENT PYTHONPATH=${PYTHONPATH}) |
| 35 |
|
| 36 |
endif() |
| 37 |
|