CMakeLists.txt 3.91 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
ENDIF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")

Francois Keith's avatar
Francois Keith committed
22
# provide path to libraries
Thomas Moulard's avatar
Thomas Moulard committed
23
LINK_DIRECTORIES(${HRP2_DYNAMICS_LIBRARY_DIRS})
Francois Bleibel's avatar
Francois Bleibel committed
24
25
LINK_DIRECTORIES(${DYNAMIC_GRAPH_LIBRARY_DIRS})
LINK_DIRECTORIES(${SOT_CORE_LIBRARY_DIRS})
Thomas Moulard's avatar
Thomas Moulard committed
26
LINK_DIRECTORIES(${JRL_MAL_LIBRARY_DIRS})
Francois Bleibel's avatar
Francois Bleibel committed
27

Francois Keith's avatar
Francois Keith committed
28
# Add compilation flags
Thomas Moulard's avatar
Thomas Moulard committed
29
ADD_DEFINITIONS(${HRP2_DYNAMICS_CFLAGS})
Francois Bleibel's avatar
Francois Bleibel committed
30
31
ADD_DEFINITIONS(${DYNAMIC_GRAPH_CFLAGS})
ADD_DEFINITIONS(${SOT_CORE_CFLAGS})
Thomas Moulard's avatar
Thomas Moulard committed
32
ADD_DEFINITIONS(${JRL_MAL_CFLAGS})
Francois Bleibel's avatar
Francois Bleibel committed
33

34
foreach(dlink 	${HRP2_DYNAMICS_LDFLAGS}
Thomas Moulard's avatar
Thomas Moulard committed
35
36
37
38
39
    ${DYNAMIC_GRAPH_LDFLAGS}
    ${SOT_CORE_LDFLAGS}
    ${JRL_MAL_LDFLAGS}
    )
  SET ( ${PROJECT_NAME}_src_LDFLAGS "${${PROJECT_NAME}_src_LDFLAGS}  ${dlink}")
Francois Bleibel's avatar
Francois Bleibel committed
40
41
42
endforeach(dlink)

SET(libs
Thomas Moulard's avatar
Thomas Moulard committed
43
44
45
46
47
48
49
50
51
  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
52

53
54
55
56
57
# hrp2-14 dependencies.
LIST(APPEND libs dynamic)
LIST(APPEND libs dynamic-hrp2)
SET (dynamic-hrp2_plugins_dependencies dynamic)

58

59
60
IF(${_hrp210optimized_FOUND})
  LIST(APPEND libs dynamic-hrp2_10)
61
  SET (dynamic-hrp2_10_additional_libs ${_hrp210optimized_LIBRARIES})
62
  SET (dynamic-hrp2_10_plugins_dependencies dynamic)
Thomas Moulard's avatar
Thomas Moulard committed
63
  SET(dynamic-hrp2_10_plugins_compile_flags
64
    ${_hrp210optimized_CFLAGS})
65
66

  LIST(APPEND libs dynamic-hrp2_10_old)
67
  SET (dynamic-hrp2_10_old_additional_libs ${_hrp210optimized_LIBRARIES})
68
  SET (dynamic-hrp2_10_plugins_dependencies dynamic)
Thomas Moulard's avatar
Thomas Moulard committed
69
  SET(dynamic-hrp2_10_old_plugins_compile_flags
70
    ${_hrp210optimized_CFLAGS})
71
72
73

ENDIF(${_hrp210optimized_FOUND})

74
IF(NOT UNIX)
Thomas Moulard's avatar
Thomas Moulard committed
75
76
77
78
79
80
  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)
81
82
ENDIF(NOT UNIX)

Francois Bleibel's avatar
Francois Bleibel committed
83
84
85
86
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  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} ${DYNAMIC_GRAPH_LIBRARIES})
    #MESSAGE(FATAL_ERROR X ${DYNAMIC_GRAPH_LIBRARIES})
    TARGET_LINK_LIBRARIES(${lib} ${SOT_CORE_LIBRARIES})
    TARGET_LINK_LIBRARIES(${lib} ${JRL_MAL_LIBRARIES})
Thomas Moulard's avatar
Thomas Moulard committed
102
    TARGET_LINK_LIBRARIES(${lib} ${HRP2_DYNAMICS_LIBRARIES})
Thomas Moulard's avatar
Thomas Moulard committed
103
104
    TARGET_LINK_LIBRARIES(${lib} "${${lib}_additional_libs}")
  ENDIF(UNIX)
Francois Bleibel's avatar
Francois Bleibel committed
105

Thomas Moulard's avatar
Thomas Moulard committed
106
107
108
109
110
111
112
113
114
115
116
117
118
119
  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)

120
121
  PKG_CONFIG_USE_DEPENDENCY(${lib} jrl-dynamics)

Thomas Moulard's avatar
Thomas Moulard committed
122
123
  INSTALL(TARGETS ${lib}
    DESTINATION lib/plugin)
Francois Bleibel's avatar
Francois Bleibel committed
124
ENDFOREACH(lib)