CMakeLists.txt 2.8 KB
Newer Older
1
2
# Copyright 2010, François Bleibel, Olivier Stasse, JRL, CNRS/AIST,
#                 Florent Lamiraux (CNRS/LAAS)
Thomas Moulard's avatar
Thomas Moulard committed
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# 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
16

17
18
INCLUDE(../cmake/python.cmake)

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

SET(integrator-force-rk4_plugins_dependencies integrator-force)
SET(integrator-force-exact_plugins_dependencies integrator-force)

Thomas Moulard's avatar
Thomas Moulard committed
26
27
28
29
SET(dynamic-hrp2_plugins_dependencies dynamic)
SET(dynamic-hrp2_10_plugins_dependencies dynamic)
SET(dynamic-hrp2_10_old_plugins_dependencies dynamic)

Francois Bleibel's avatar
Francois Bleibel committed
30
FOREACH(lib ${libs})
Thomas Moulard's avatar
Thomas Moulard committed
31
  ADD_LIBRARY(${lib} SHARED ${lib}.cpp)
Thomas Moulard's avatar
Thomas Moulard committed
32

Thomas Moulard's avatar
Thomas Moulard committed
33
  SET_TARGET_PROPERTIES(${lib} PROPERTIES
Thomas Moulard's avatar
Thomas Moulard committed
34
    PREFIX ""
Thomas Moulard's avatar
Thomas Moulard committed
35
    SOVERSION ${PROJECT_VERSION})
Thomas Moulard's avatar
Thomas Moulard committed
36
37
38
39
40
41

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

42
  PKG_CONFIG_USE_DEPENDENCY(${lib} jrl-dynamics)
43
44
45
46
  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)
47

Thomas Moulard's avatar
Thomas Moulard committed
48
  INSTALL(TARGETS ${lib} DESTINATION lib/plugin)
49
50
51
52
53
54
55
56
57
58
  # build python submodule
  STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${lib})
  ADD_DEPENDENCIES(${lib} MKDIR_${PYTHON_LIBRARY_NAME})
  ADD_CUSTOM_TARGET(MKDIR_${PYTHON_LIBRARY_NAME}
    mkdir -p dynamic_graph/sot/dynamics/${PYTHON_LIBRARY_NAME}
    )
  DYNAMIC_GRAPH_PYTHON_MODULE("sot/dynamics/${PYTHON_LIBRARY_NAME}"
    ${lib}
    sot/dynamics/${PYTHON_LIBRARY_NAME}/wrap
    )
Francois Bleibel's avatar
Francois Bleibel committed
59
ENDFOREACH(lib)
Thomas Moulard's avatar
Thomas Moulard committed
60

61
62
63
64
65
66
67
68
69
EXEC_PROGRAM(${PYTHON_EXECUTABLE} ARGS "-c \"from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='')\""
  OUTPUT_VARIABLE PYTHON_SITELIB
  )

# Install empty __init__.py files in intermediate directories.
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dynamics/__init__.py
  DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/dynamics
  )

Thomas Moulard's avatar
Thomas Moulard committed
70
71
72
73
74
75
PKG_CONFIG_USE_DEPENDENCY(dynamic-hrp2 hrp2-dynamics)

IF(${HRP2_10_OPTIMIZED_FOUND})
  PKG_CONFIG_USE_DEPENDENCY(dynamic-hrp2_10 hrp2-10-optimized)
  PKG_CONFIG_USE_DEPENDENCY(dynamic-hrp2_10_old hrp2-10-optimized)
ENDIF()