CMakeLists.txt 2.47 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
ENDFUNCTION()

12
SET(${PROJECT_NAME}_EXAMPLES
13
  inverse-kinematics
14
  overview-simple
15
  overview-lie
16
17
  overview-SE3
  interpolation-SE3
18
19
  )

Justin Carpentier's avatar
Justin Carpentier committed
20
IF(BUILD_WITH_URDF_SUPPORT)
21
  LIST(APPEND ${PROJECT_NAME}_EXAMPLES
22
    overview-urdf
Justin Carpentier's avatar
Justin Carpentier committed
23
    build-reduced-model
24
25
26
27
28
29
30
31
    geometry-models
    kinematics-derivatives
    forward-dynamics-derivatives
    inverse-dynamics-derivatives
  )
ENDIF()

IF(BUILD_ADVANCED_TESTING)
Justin Carpentier's avatar
Justin Carpentier committed
32
  IF(BUILD_WITH_URDF_SUPPORT)
33
34
35
36
    LIST(APPEND ${PROJECT_NAME}_EXAMPLES
      multiprecision
      )
  ENDIF()
37
38
ENDIF(BUILD_ADVANCED_TESTING)

39
IF(hpp-fcl_FOUND)
Justin Carpentier's avatar
Justin Carpentier committed
40
  IF(BUILD_WITH_URDF_SUPPORT)
41
42
43
44
    LIST(APPEND ${PROJECT_NAME}_EXAMPLES
      collisions
      )
  ENDIF()
45
ENDIF(hpp-fcl_FOUND)
46

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

Francois Keith's avatar
Francois Keith committed
49
50
51
52
IF(WIN32)
  ADD_DEFINITIONS("-DNOMINMAX -D_USE_MATH_DEFINES")
ENDIF(WIN32)

53
FOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
54
  ADD_PINOCCHIO_CPP_EXAMPLE(${EXAMPLE})
55
ENDFOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
56

Justin Carpentier's avatar
Justin Carpentier committed
57
IF(BUILD_ADVANCED_TESTING AND BUILD_WITH_URDF_SUPPORT)
58
  SET_PROPERTY(TARGET example-cpp-multiprecision PROPERTY CXX_STANDARD 11)
Justin Carpentier's avatar
Justin Carpentier committed
59
ENDIF(BUILD_ADVANCED_TESTING AND BUILD_WITH_URDF_SUPPORT)
60

61
62
IF(BUILD_PYTHON_INTERFACE)
  SET(${PROJECT_NAME}_PYTHON_EXAMPLES
63
    inverse-kinematics
64
    overview-simple
65
    kinematics-derivatives
66
67
    forward-dynamics-derivatives
    inverse-dynamics-derivatives
68
69
    )

Justin Carpentier's avatar
Justin Carpentier committed
70
  IF(BUILD_WITH_URDF_SUPPORT)
71
72
73
    LIST(APPEND ${PROJECT_NAME}_PYTHON_EXAMPLES 
      overview-urdf
      gepetto-viewer
Justin Carpentier's avatar
Justin Carpentier committed
74
      build-reduced-model
75
76
77
78
79
      meshcat-viewer
      meshcat-viewer-dae
      robot-wrapper-viewer
      geometry-models
      )
Justin Carpentier's avatar
Justin Carpentier committed
80
  ENDIF(BUILD_WITH_URDF_SUPPORT)
81

82
  IF(hpp-fcl_FOUND)
83
    LIST(APPEND ${PROJECT_NAME}_PYTHON_EXAMPLES 
84
      sample-model-viewer
85
      display-shapes
86
      simulation-inverted-pendulum
87
      )
Justin Carpentier's avatar
Justin Carpentier committed
88
    IF(BUILD_WITH_URDF_SUPPORT)
89
90
91
      LIST(APPEND ${PROJECT_NAME}_PYTHON_EXAMPLES 
        collisions
        )
Justin Carpentier's avatar
Justin Carpentier committed
92
    ENDIF(BUILD_WITH_URDF_SUPPORT)
93
  ENDIF(hpp-fcl_FOUND)
94

95
  FOREACH(EXAMPLE ${${PROJECT_NAME}_PYTHON_EXAMPLES})
96
    ADD_PYTHON_UNIT_TEST("example-py-${EXAMPLE}" "examples/${EXAMPLE}.py" "bindings/python")
97
98
  ENDFOREACH(EXAMPLE ${${PROJECT_NAME}_PYTHON_EXAMPLES})
ENDIF(BUILD_PYTHON_INTERFACE)
99
100

ADD_SUBDIRECTORY(codegen)