CMakeLists.txt 2.18 KB
Newer Older
Justin Carpentier's avatar
Justin Carpentier committed
1
#
2
# Copyright (c) 2015-2020 CNRS INRIA
Justin Carpentier's avatar
Justin Carpentier committed
3
4
#

5
6
7
8
FUNCTION(ADD_PINOCCHIO_CPP_EXAMPLE EXAMPLE)
  GET_FILENAME_COMPONENT(EXAMPLE_NAME ${EXAMPLE} NAME)
  SET(EXAMPLE_NAME "example-cpp-${EXAMPLE_NAME}")
  ADD_UNIT_TEST(${EXAMPLE_NAME} ${EXAMPLE})
9
  TARGET_LINK_LIBRARIES(${EXAMPLE_NAME} PUBLIC ${PROJECT_NAME})
10
11
12
13
14
15
16
17
18
19
20
21
  PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} eigen3)
  IF(URDFDOM_FOUND)
    PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} urdfdom)
  ENDIF(URDFDOM_FOUND)
  IF(HPP_FCL_FOUND)
    PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} hpp-fcl)
  ENDIF(HPP_FCL_FOUND)
  IF(CPPAD_FOUND)
    PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} "cppad")
  ENDIF(CPPAD_FOUND)
ENDFUNCTION()

22
SET(${PROJECT_NAME}_EXAMPLES
23
  inverse-kinematics
24
  overview-simple
25
  overview-lie
26
  overview-SE3
27
  overview-urdf
28
  interpolation-SE3
29
  build-reduced-model
30
  geometry-models
31
  kinematics-derivatives
32
  forward-dynamics-derivatives
33
  inverse-dynamics-derivatives
34
35
  )

36
37
38
39
40
41
IF(BUILD_ADVANCED_TESTING)
  LIST(APPEND ${PROJECT_NAME}_EXAMPLES
    multiprecision
    )
ENDIF(BUILD_ADVANCED_TESTING)

42
43
44
45
46
47
IF(HPP_FCL_FOUND)
  LIST(APPEND ${PROJECT_NAME}_EXAMPLES
    collisions
    )
ENDIF(HPP_FCL_FOUND)

48
49
ADD_DEFINITIONS(-DPINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")

50
FOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
51
  ADD_PINOCCHIO_CPP_EXAMPLE(${EXAMPLE})
52
ENDFOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
53

54
55
56
57
IF(BUILD_ADVANCED_TESTING)
  SET_PROPERTY(TARGET example-cpp-multiprecision PROPERTY CXX_STANDARD 11)
ENDIF(BUILD_ADVANCED_TESTING)

58
59
IF(BUILD_PYTHON_INTERFACE)
  SET(${PROJECT_NAME}_PYTHON_EXAMPLES
60
    inverse-kinematics
61
    overview-simple
62
    overview-urdf
63
    kinematics-derivatives
64
65
    forward-dynamics-derivatives
    inverse-dynamics-derivatives
66
67
    gepetto-viewer
    meshcat-viewer
Gabriele Buondonno's avatar
Gabriele Buondonno committed
68
    meshcat-viewer-dae
69
    robot-wrapper-viewer
70
    geometry-models
71
72
    )

73
74
75
  IF(HPP_FCL_FOUND)
    LIST(APPEND ${PROJECT_NAME}_PYTHON_EXAMPLES 
      collisions
76
      sample-model-viewer
77
      display-shapes
78
79
80
      )
  ENDIF(HPP_FCL_FOUND)

81
  FOREACH(EXAMPLE ${${PROJECT_NAME}_PYTHON_EXAMPLES})
82
    ADD_PYTHON_UNIT_TEST("example-py-${EXAMPLE}" "examples/${EXAMPLE}.py" "bindings/python")
83
84
  ENDFOREACH(EXAMPLE ${${PROJECT_NAME}_PYTHON_EXAMPLES})
ENDIF(BUILD_PYTHON_INTERFACE)
85
86

ADD_SUBDIRECTORY(codegen)