CMakeLists.txt 3.07 KB
Newer Older
Olivier Stasse's avatar
Olivier Stasse committed
1
2
3
4
5
# Copyright (C) 2017-2019 LAAS-CNRS
#
# Author: Olivier Stasse
#

Olivier Stasse's avatar
Olivier Stasse committed
6
7
8
9
10
11
12
13
14
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_INSTALL_RPATH "${LIBRARY_OUTPUT_PATH}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_PATH}")
set(PKG_CONFIG_ADDITIONAL_VARIABLES
  ${PKG_CONFIG_ADDITIONAL_VARIABLES}
  plugindirname
  plugindir
  )
Olivier Stasse's avatar
Olivier Stasse committed
15
16

ADD_EXECUTABLE(roscontrol_sot_hardware roscontrol_sot_hardware.cpp)
Olivier Stasse's avatar
Olivier Stasse committed
17
18
19
20
21
22

# Create directory for local wrap.so
file(MAKE_DIRECTORY
  ${LIBRARY_OUTPUT_PATH}/dynamic_graph/sot/test/sot_test_device)


Olivier Stasse's avatar
Olivier Stasse committed
23
24
25
26
target_link_libraries(roscontrol_sot_hardware
  ${catkin_LIBRARIES}
  ${bullet_libraries}
  )
Olivier Stasse's avatar
Olivier Stasse committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40

# Add the library to wrap the test device.
MACRO(build_test_device)

  SET(DEVICE_NAME sot-test-device)
  ADD_LIBRARY(${DEVICE_NAME}
    SHARED
    sot-test-device.cpp
  )

  set_target_properties(${DEVICE_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH True)
  #set_target_properties(${DEVICE_NAME} PROPERTIES PREFIX "")

  # Link the dynamic library containing the SoT with its dependencies.
Olivier Stasse's avatar
Olivier Stasse committed
41
42
43
44
45
  target_link_libraries(${DEVICE_NAME} dynamic-graph::dynamic-graph)
  target_link_libraries(${DEVICE_NAME}
    dynamic-graph-python::dynamic-graph-python)
  target_link_libraries(${DEVICE_NAME} sot-core::sot-core)
  PKG_CONFIG_USE_DEPENDENCY(${DEVICE_NAME} pinocchio)
46
  #  target_link_libraries(${DEVICE_NAME}  dynamic_graph_bridge ros_bridge ros_inter)
Olivier Stasse's avatar
Olivier Stasse committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

  IF(UNIX AND NOT APPLE)
    TARGET_LINK_LIBRARIES(${DEVICE_NAME} ${Boost_LIBRARIES})
  ENDIF(UNIX AND NOT APPLE)

  INSTALL(TARGETS ${DEVICE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})

  # build python submodule
  STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${DEVICE_NAME})
  SET(NEW_ENTITY_CLASS ${ENTITIES})
  DYNAMIC_GRAPH_PYTHON_MODULE("sot/test/${PYTHON_LIBRARY_NAME}"
    ${DEVICE_NAME}
    sot/test/${PYTHON_LIBRARY_NAME}/wrap
    )

ENDMACRO()

build_test_device()

# Add the library to wrap the controller of Test.
MACRO(build_test_controller)

  SET(CONTROLLER_NAME sot-test-controller)
  ADD_LIBRARY(${CONTROLLER_NAME}
    SHARED
    sot-test-controller.cpp
  )

  #
  set_target_properties(${CONTROLLER_NAME}
    PROPERTIES BUILD_WITH_INSTALL_RPATH True)
  #set_target_properties(${CONTROLLER_NAME} PROPERTIES PREFIX "")

  # Link the dynamic library containing the SoT with its dependencies.
Olivier Stasse's avatar
Olivier Stasse committed
81
82
83
84
85
86
  target_link_libraries(${CONTROLLER_NAME}
    dynamic-graph::dynamic-graph)
  target_link_libraries(${CONTROLLER_NAME}
    dynamic-graph-python::dynamic-graph-python)
  target_link_libraries(${CONTROLLER_NAME}
    sot-core::sot-core)
87
  PKG_CONFIG_USE_DEPENDENCY(${CONTROLLER_NAME} PINOCCHIO)
Olivier Stasse's avatar
Olivier Stasse committed
88

Olivier Stasse's avatar
Olivier Stasse committed
89
  #target_link_libraries(${CONTROLLER_NAME} dynamic_graph_bridge)
Olivier Stasse's avatar
Olivier Stasse committed
90
91

  ADD_DEPENDENCIES(${CONTROLLER_NAME} sot-test-device)
Olivier Stasse's avatar
Olivier Stasse committed
92
93
94
  #TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ros_bridge)
  #TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ros_interpreter)
  TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} sot-test-device)
Olivier Stasse's avatar
Olivier Stasse committed
95
96
97
98
99
100
101
102
103
104
105
 
  IF(UNIX AND NOT APPLE)
    TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} ${Boost_LIBRARIES})
  ENDIF(UNIX AND NOT APPLE)

  INSTALL(TARGETS ${CONTROLLER_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})

ENDMACRO()

build_test_controller()