CMakeLists.txt 2.78 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
#
2
# Copyright (c) 2014-2019 CNRS
Justin Carpentier's avatar
Justin Carpentier committed
3
# Copyright (c) 2018-2021 INRIA
Guilhem Saurel's avatar
Guilhem Saurel committed
4
#
jcarpent's avatar
jcarpent committed
5

6
MACRO(ADD_LIB_UNIT_TEST test)
7
8
  CREATE_CTEST_BUILD_TESTS_TARGET()

9
  IF(BUILD_TESTING)
10
    ADD_LIBRARY(${test} SHARED "${test}.cpp")
11
  ELSE(BUILD_TESTING)
12
    ADD_LIBRARY(${test} SHARED EXCLUDE_FROM_ALL "${test}.cpp")
13
  ENDIF(BUILD_TESTING)
14

Justin Carpentier's avatar
Justin Carpentier committed
15
  TARGET_LINK_LIBRARIES(${test} PUBLIC ${PROJECT_NAME})
jcarpent's avatar
jcarpent committed
16
17
  SET_TARGET_PROPERTIES(${test} PROPERTIES PREFIX "")

Justin Carpentier's avatar
Justin Carpentier committed
18
  SET_TARGET_PROPERTIES(${test} PROPERTIES SUFFIX ${PYTHON_EXT_SUFFIX})
Guilhem Saurel's avatar
Guilhem Saurel committed
19

Justin Carpentier's avatar
Justin Carpentier committed
20
  ADD_TEST(NAME ${test} COMMAND ${PYTHON_EXECUTABLE} -c "import ${test}")
jcarpent's avatar
jcarpent committed
21

22
  ADD_DEPENDENCIES(build_tests ${test})
23
  IF(NOT BUILD_TESTING)
24
    SET_TESTS_PROPERTIES(${test} PROPERTIES DEPENDS ctest_build_tests)
25
  ENDIF(NOT BUILD_TESTING)
26
ENDMACRO(ADD_LIB_UNIT_TEST)
27

28
29
30
31
ADD_LIB_UNIT_TEST(matrix)
ADD_LIB_UNIT_TEST(geometry)
ADD_LIB_UNIT_TEST(complex)
ADD_LIB_UNIT_TEST(return_by_ref)
Guilhem Saurel's avatar
Guilhem Saurel committed
32
ADD_LIB_UNIT_TEST(include)
33
IF(NOT ${EIGEN3_VERSION} VERSION_LESS "3.2.0")
34
  ADD_LIB_UNIT_TEST(eigen_ref)
35
ENDIF()
36
ADD_LIB_UNIT_TEST(user_type)
jcarpent's avatar
jcarpent committed
37

38
ADD_PYTHON_UNIT_TEST("py-matrix" "unittest/python/test_matrix.py" "unittest")
Guilhem Saurel's avatar
Guilhem Saurel committed
39
ADD_PYTHON_UNIT_TEST("py-geometry" "unittest/python/test_geometry.py" "unittest")
40
ADD_PYTHON_UNIT_TEST("py-complex" "unittest/python/test_complex.py" "unittest")
41
ADD_PYTHON_UNIT_TEST("py-return-by-ref" "unittest/python/test_return_by_ref.py" "unittest")
42
ADD_PYTHON_UNIT_TEST("py-eigen-ref" "unittest/python/test_eigen_ref.py" "unittest")
43
ADD_PYTHON_UNIT_TEST("py-user-type" "unittest/python/test_user_type.py" "unittest")
44

Justin Carpentier's avatar
Justin Carpentier committed
45
ADD_PYTHON_UNIT_TEST("py-switch" "unittest/python/test_switch.py" "python/eigenpy;unittest")
46
47
SET_TESTS_PROPERTIES("py-switch" PROPERTIES DEPENDS ${PYWRAP})

Justin Carpentier's avatar
Justin Carpentier committed
48
ADD_PYTHON_UNIT_TEST("py-dimensions" "unittest/python/test_dimensions.py" "python/eigenpy;unittest")
49
SET_TESTS_PROPERTIES("py-dimensions" PROPERTIES DEPENDS ${PYWRAP})
50

Justin Carpentier's avatar
Justin Carpentier committed
51
ADD_PYTHON_UNIT_TEST("py-version" "unittest/python/test_version.py" "python/eigenpy;unittest")
52
SET_TESTS_PROPERTIES("py-version" PROPERTIES DEPENDS ${PYWRAP})
53

Justin Carpentier's avatar
Justin Carpentier committed
54
ADD_PYTHON_UNIT_TEST("py-eigen-solver" "unittest/python/test_eigen_solver.py" "python/eigenpy;unittest")
55
SET_TESTS_PROPERTIES("py-eigen-solver" PROPERTIES DEPENDS ${PYWRAP})
56

Justin Carpentier's avatar
Justin Carpentier committed
57
ADD_PYTHON_UNIT_TEST("py-self-adjoint-eigen-solver" "unittest/python/test_self_adjoint_eigen_solver.py" "python/eigenpy;unittest")
58
SET_TESTS_PROPERTIES("py-self-adjoint-eigen-solver" PROPERTIES DEPENDS ${PYWRAP})
Justin Carpentier's avatar
Justin Carpentier committed
59

Justin Carpentier's avatar
Justin Carpentier committed
60
ADD_PYTHON_UNIT_TEST("py-LLT" "unittest/python/test_LLT.py" "python/eigenpy;unittest")
Justin Carpentier's avatar
Justin Carpentier committed
61
SET_TESTS_PROPERTIES("py-LLT" PROPERTIES DEPENDS ${PYWRAP})
62

Justin Carpentier's avatar
Justin Carpentier committed
63
ADD_PYTHON_UNIT_TEST("py-LDLT" "unittest/python/test_LDLT.py" "python/eigenpy;unittest")
64
SET_TESTS_PROPERTIES("py-LDLT" PROPERTIES DEPENDS ${PYWRAP})
Justin Carpentier's avatar
Justin Carpentier committed
65
66
67

ADD_PYTHON_UNIT_TEST("py-MINRES" "unittest/python/test_MINRES.py" "python/eigenpy;unittest")
SET_TESTS_PROPERTIES("py-MINRES" PROPERTIES DEPENDS ${PYWRAP})