CMakeLists.txt 2.83 KB
Newer Older
1
# Copyright 2010, 2020, François Bleibel, Olivier Stasse, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
Thomas Moulard's avatar
Thomas Moulard committed
2

3
CONFIG_FILES_CMAKE(test-paths.h)
Francois Bleibel's avatar
Francois Bleibel committed
4

5
6
7
# Make Boost.Test generates the main function in test cases.
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)

8
# Definition of a macro that corresponds to the suffix for a dynamic lib
9
10
ADD_DEFINITIONS(-DTESTS_DYNLIBSUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}")

Thomas Moulard's avatar
Thomas Moulard committed
11
12
13
14
# The sot-core plugin libraries that tests have to be linked against
# the name of the variable for test EXECUTABLE_NAME is
# TEST_${EXECUTABLE_NAME}_LIBS
SET(TEST_tsot_LIBS
15
16
17
18
  task
  feature-visual-point
  gain-adaptive
  )
19

20
21
22
LINK_DIRECTORIES(${DYNAMIC_GRAPH_PLUGINDIR})

SET(TEST_test_traces_EXT_LIBS tracer)
23

24
SET(TEST_test_gain_LIBS
25
  gain-adaptive feature-visual-point)
26
27

SET(TEST_test_task_LIBS
28
  gain-adaptive feature-visual-point task)
29

30
SET(TEST_test_feature_point6d_LIBS
31
  gain-adaptive feature-point6d task)
32
33

SET(TEST_test_feature_generic_LIBS
34
  gain-adaptive feature-generic task feature-pose)
35

Francois Bleibel's avatar
Francois Bleibel committed
36
SET(TEST_test_mailbox_LIBS
37
  mailbox-vector)
Francois Bleibel's avatar
Francois Bleibel committed
38

39
SET(TEST_test_control_pd_LIBS
40
  control-pd)
41

42
43
44
SET(TEST_test_control_admittance_LIBS
  admittance-control-op-point)

45
46
SET(TEST_test_feature_generic_EXT_LIBS
  pinocchio::pinocchio)
47

48
49
SET(TEST_test_device_EXT_LIBS
  pinocchio::pinocchio)
50

51
SET(TEST_test_filter_differentiator_LIBS
52
  filter-differentiator)
Olivier Stasse's avatar
Olivier Stasse committed
53
54

SET(TEST_test_madgwick_ahrs_LIBS
55
  madgwickahrs)
Olivier Stasse's avatar
Olivier Stasse committed
56

57

Guilhem Saurel's avatar
Guilhem Saurel committed
58
SET(tests
59
  dummy
Thomas Moulard's avatar
Thomas Moulard committed
60

61
  control/test_control_pd
62
  control/test_control_admittance
Thomas Moulard's avatar
Thomas Moulard committed
63

64
65
  features/test_feature_point6d
  features/test_feature_generic
66

67
  filters/test_filter_differentiator
Olivier Stasse's avatar
Olivier Stasse committed
68
  filters/test_madgwick_ahrs
69

70
71
72
73
74
  signal/test_signal
  signal/test_depend
  signal/test_ptr
  signal/test_dep
  signal/test_ptrcast
Thomas Moulard's avatar
Thomas Moulard committed
75

76
  sot/tsot
Thomas Moulard's avatar
Thomas Moulard committed
77

78
79
  traces/files
  traces/test_traces
80

81
82
83
84
85
86
  task/test_flags
  task/test_gain
  task/test_multi_bound
  task/test_task

  tools/test_boost
87
  tools/test_device
88
89
90
91
92
93
94
95
96
  tools/test_mailbox
  tools/test_matrix
  tools/test_robot_utils

  math/matrix-twist
  math/matrix-homogeneous

  matrix/test_operator
  )
Francois Bleibel's avatar
Francois Bleibel committed
97

98
99
# TODO
IF(WIN32)
100
  LIST(REMOVE_ITEM tests tools/test_mailbox)
101
102
ENDIF(WIN32)

103
IF(UNIX)
104
  ADD_LIBRARY(pluginabstract SHARED tools/plugin.cc)
105

106
  ADD_EXECUTABLE(test_abstract_interface tools/test_abstract_interface.cpp)
107
  TARGET_LINK_LIBRARIES(test_abstract_interface
108
    pluginabstract ${CMAKE_DL_LIBS} ${Boost_LIBRARIES})
109
110
111
  TARGET_INCLUDE_DIRECTORIES(test_abstract_interface
    SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})

112
113
ENDIF(UNIX)

114
115
116
FOREACH(path ${tests})
  GET_FILENAME_COMPONENT(test ${path} NAME)
  ADD_UNIT_TEST(${test} ${path}.cpp)
117

118
119
120
  TARGET_LINK_LIBRARIES(${test}
    PUBLIC
    ${PROJECT_NAME}
121
122
    ${TEST_${test}_LIBS} ${TEST_${test}_EXT_LIBS}
    dynamic-graph::dynamic-graph)
123

Guilhem Saurel's avatar
Guilhem Saurel committed
124
  IF(UNIX)
Olivier Stasse's avatar
Olivier Stasse committed
125
    TARGET_LINK_LIBRARIES(${test} PUBLIC ${CMAKE_DL_LIBS})
126
  ENDIF(UNIX)
127
ENDFOREACH(path ${tests})
128
129
130
131

IF(BUILD_PYTHON_INTERFACE)
  ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)