ENDIF(EXISTS ${aTestFileName})
endforeach(eachFileName ${ARGN})
ENDMACRO(ADD_UNIT_TESTS)
+
+MACRO(ADD_UNIT_TESTS_API)
+ if (WIN32) # different separators and path to libraries variable name
+ 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}")
+ STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
+ STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
+ SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
+ STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
+ STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
+ else()
+ 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}")
+ SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
+ endif()
+
+ foreach(eachFileName ${ARGN})
+ # Strip the ".py" suffix
+ GET_FILENAME_COMPONENT(aTestName ${eachFileName} NAME_WE)
+
+ # Add "SubprojectName_" prefix
+ GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+ SET(aTestName "${aSubprojectName}_${aTestName}")
+
+ # Full path to the python test file beeing executed
+ SET(aTestFileName "${CMAKE_CURRENT_SOURCE_DIR}/${eachFileName}")
+ IF(EXISTS ${aTestFileName})
+ ADD_TEST(NAME ${aTestName}
+ COMMAND ${PYTHON_EXECUTABLE} ${aTestFileName})
+ if (WIN32) # different path to libraries variable name
+ SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+ ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH}")
+ else()
+ SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+ ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH}")
+ endif()
+ # Debug output...
+ #MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFileName}")
+ ELSE(EXISTS ${aTestFileName})
+ MESSAGE(WARNING "Can not find the test file: ${aTestFileName}")
+ ENDIF(EXISTS ${aTestFileName})
+ endforeach(eachFileName ${ARGN})
+ENDMACRO(ADD_UNIT_TESTS_API)
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS_API(
+ Primitives/TestBox.py
+ Primitives/TestCylinder.py
+ Primitives/TestAPI_Box.py
+ Primitives/TestAPI_Cylinder.py
+ GDML/TestConeSegment.py
+ GDML/TestAPI_ConeSegment.py
+ Transformations/TestScale.py
+ Transformations/TestSymmetry.py
+ Transformations/TestTranslation.py
+ Transformations/TestAPI_Scale.py
+ Transformations/TestAPI_Symmetry.py
+ Transformations/TestAPI_Translation.py
+)