CMakeLists.txt 3.22 KB
Newer Older
Thomas Moulard's avatar
Thomas Moulard committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Copyright 2010, François Bleibel, Olivier Stasse, JRL, CNRS/AIST
#
# This file is part of sot-dynamic.
# sot-dynamic is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# sot-dynamic is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# sot-dynamic. If not, see <http://www.gnu.org/licenses/>.
Francois Bleibel's avatar
Francois Bleibel committed
15
16
17
18

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)

IF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
Thomas Moulard's avatar
Thomas Moulard committed
19
  ADD_DEFINITIONS(-DDEBUG=2)
Francois Bleibel's avatar
Francois Bleibel committed
20
21
22
ENDIF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")

SET(libs
Thomas Moulard's avatar
Thomas Moulard committed
23
24
25
26
27
28
29
30
31
  zmpreffromcom
  force-compensation
  integrator-force-exact
  mass-apparent
  integrator-force-rk4
  integrator-force
  angle-estimator
  waist-attitude-from-sensor
  )
Francois Bleibel's avatar
Francois Bleibel committed
32

33
34
35
36
37
# hrp2-14 dependencies.
LIST(APPEND libs dynamic)
LIST(APPEND libs dynamic-hrp2)
SET (dynamic-hrp2_plugins_dependencies dynamic)

38

39
40
IF(${_hrp210optimized_FOUND})
  LIST(APPEND libs dynamic-hrp2_10)
41
  SET (dynamic-hrp2_10_additional_libs ${_hrp210optimized_LIBRARIES})
42
  SET (dynamic-hrp2_10_plugins_dependencies dynamic)
Thomas Moulard's avatar
Thomas Moulard committed
43
  SET(dynamic-hrp2_10_plugins_compile_flags
44
    ${_hrp210optimized_CFLAGS})
45
46

  LIST(APPEND libs dynamic-hrp2_10_old)
47
  SET (dynamic-hrp2_10_old_additional_libs ${_hrp210optimized_LIBRARIES})
48
  SET (dynamic-hrp2_10_plugins_dependencies dynamic)
Thomas Moulard's avatar
Thomas Moulard committed
49
  SET(dynamic-hrp2_10_old_plugins_compile_flags
50
    ${_hrp210optimized_CFLAGS})
51
52
53

ENDIF(${_hrp210optimized_FOUND})

54
IF(NOT UNIX)
Thomas Moulard's avatar
Thomas Moulard committed
55
56
57
58
59
60
  FOREACH(dlink ${_hrp210optimized_LDFLAGS})
    SET(dynamic-hrp2_10_plugins_link_flags
      "${dynamic-hrp2_10_plugins_link_flags} ${dlink}")
    SET(dynamic-hrp2_10_old_plugins_link_flags
      "${dynamic-hrp2_10_old_plugins_link_flags} ${dlink}")
  ENDFOREACH(dlink)
61
62
ENDIF(NOT UNIX)

Francois Bleibel's avatar
Francois Bleibel committed
63
64
65
66
SET(integrator-force-rk4_plugins_dependencies integrator-force)
SET(integrator-force-exact_plugins_dependencies integrator-force)

FOREACH(lib ${libs})
Thomas Moulard's avatar
Thomas Moulard committed
67
68
69
70
71
72
73
74
75
76
77
78
79
  ADD_LIBRARY(${lib}
    SHARED
    ${lib}.cpp)

  SET_TARGET_PROPERTIES(${lib}
    PROPERTIES
    SOVERSION ${PROJECT_VERSION}
    PREFIX ""
    INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib/plugin)

  IF (UNIX)
    TARGET_LINK_LIBRARIES(${lib} "${${lib}_additional_libs}")
  ENDIF(UNIX)
Francois Bleibel's avatar
Francois Bleibel committed
80

Thomas Moulard's avatar
Thomas Moulard committed
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  IF(WIN32)
    SET(${lib}_plugins_link_flags "${${PROJECT_NAME}_src_LDFLAGS} ${${lib}_plugins_link_flags}")
  ENDIF(WIN32)

  SET_TARGET_PROPERTIES(${lib}
    PROPERTIES
    COMPILE_FLAGS "${${lib}_plugins_compile_flags}"
    LINK_FLAGS "${${lib}_plugins_link_flags}")

  IF(${lib}_plugins_dependencies)
    ADD_DEPENDENCIES(${lib} "${${lib}_plugins_dependencies}")
    TARGET_LINK_LIBRARIES(${lib} "${${lib}_plugins_dependencies}")
  ENDIF(${lib}_plugins_dependencies)

95
  PKG_CONFIG_USE_DEPENDENCY(${lib} jrl-dynamics)
96
97
98
99
100
  PKG_CONFIG_USE_DEPENDENCY(${lib} hrp2-dynamics)
  PKG_CONFIG_USE_DEPENDENCY(${lib} sot-core)
  PKG_CONFIG_USE_DEPENDENCY(${lib} dynamic-graph)
  PKG_CONFIG_USE_DEPENDENCY(${lib} jrl-mal)
  
101

Thomas Moulard's avatar
Thomas Moulard committed
102
103
  INSTALL(TARGETS ${lib}
    DESTINATION lib/plugin)
Francois Bleibel's avatar
Francois Bleibel committed
104
ENDFOREACH(lib)