]> SALOME platform Git repositories - modules/shaper.git/blob - test.models/CMakeLists.txt
Salome HOME
Correct DoF calculation
[modules/shaper.git] / test.models / CMakeLists.txt
1 # Copyright (C) 2007-2017  CEA/DEN, EDF R&D, OPEN CASCADE
2
3 ENABLE_TESTING()
4
5 file(GLOB pyFiles "*.py")
6
7 if (WIN32) # different separators and path to libraries variable name
8   SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${SUIT_LIB_DIR};$ENV{PATH}")
9   STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
10   STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
11   SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
12   STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
13   STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
14 else()
15   SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${SUIT_LIB_DIR}:$ENV{LD_LIBRARY_PATH}")
16   SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
17 endif()
18
19 foreach(eachFilePath ${pyFiles})
20   # Strip the ".py" suffix
21   GET_FILENAME_COMPONENT(aTestName ${eachFilePath} NAME_WE)
22
23   # Add "SubprojectName_" prefix
24   GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
25   SET(aTestName "${aSubprojectName}_${aTestName}")
26
27   # Full path to the python test file beeing executed
28   SET(aTestFilePath "${eachFilePath}")
29   IF(EXISTS ${aTestFilePath})
30     ADD_TEST(NAME ${aTestName} COMMAND ${PYTHON_EXECUTABLE} ${aTestFilePath})
31     if (WIN32) # different path to libraries variable name
32       SET_TESTS_PROPERTIES(${aTestName} PROPERTIES ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH}"
33         LABELS "models_tests")
34     else()
35       SET_TESTS_PROPERTIES(${aTestName} PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH}"
36         LABELS "models_tests")
37     endif()
38     # Debug output...
39     # MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFilePath}")
40   ELSE(EXISTS ${aTestFilePath})
41     MESSAGE(WARNING "Can not find the test file: ${aTestFilePath}")
42   ENDIF(EXISTS ${aTestFilePath})
43 endforeach(eachFilePath ${ARGN})
44
45 ADD_CUSTOM_TARGET(run_models_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -L "models_tests")