Commit 6a9c14a2 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] add BUILD_PYTHON_INTERFACE option

parent c4158e5c
......@@ -20,10 +20,11 @@ INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/lapack.cmake)
INCLUDE(cmake/cpack.cmake)
INCLUDE(cmake/python.cmake)
SET(PROJECT_NAME sot-dyninv)
SET(PROJECT_DESCRIPTION "control by inverse dynamics.")
SET(PROJECT_URL "http://github.com/laas/sot-dyninv")
SET(PROJECT_URL "http://github.com/stack-of-tasks/sot-dyninv")
SET(CUSTOM_HEADER_DIR "${PROJECT_NAME}")
SET(DOXYGEN_USE_MATHJAX YES)
......@@ -135,22 +136,18 @@ foreach(lib solver-op-space solver-dyn-reduced solver-dyn-red2)
ENDIF(WIN32)
endforeach(lib)
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
IF(BUILD_PYTHON_INTERFACE)
FINDPYTHON()
FIND_NUMPY()
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
ADD_REQUIRED_DEPENDENCY("dynamic-graph-python")
ENDIF(BUILD_PYTHON_INTERFACE)
# Add subdirectories.
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(unitTesting)
# Configure some of the python files
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/python/robot_specific.py.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/python/robot_specific.py"
)
#INCLUDE(cmake/python.cmake)
#INSTALL(FILES
# "${CMAKE_CURRENT_BINARY_DIR}/python/robotSpecific.py"
# DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/dyninv
#)
SETUP_PROJECT_FINALIZE()
SETUP_PROJECT_CPACK()
INCLUDE(../cmake/python.cmake)
FINDPYTHON()
IF(BUILD_PYTHON_INTERFACE)
INSTALL(
FILES ros/sot-concept.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/tutorial
)
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/robot_specific.py.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/robot_specific.py"
)
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/robot_specific.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/dyninv
)
INSTALL(
FILES ros/sot-concept.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/tutorial
)
ENDIF(BUILD_PYTHON_INTERFACE)
......@@ -14,9 +14,6 @@
# received a copy of the GNU Lesser General Public License along with
# sot-dyninv. If not, see <http://www.gnu.org/licenses/>.
INCLUDE(../cmake/python.cmake)
FINDPYTHON()
IF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
ADD_DEFINITIONS(-DDEBUG=2)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
......@@ -37,7 +34,6 @@ FOREACH(header ${headers})
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
ENDFOREACH(header)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include)
LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS})
# --- COMPILATION OF PLUGINS
FOREACH(lib ${libs})
......@@ -62,22 +58,23 @@ FOREACH(lib ${libs})
INSTALL(TARGETS ${lib} DESTINATION ${DYNAMIC_GRAPH_PLUGINDIR})
# build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${lib})
DYNAMIC_GRAPH_PYTHON_MODULE("sot/dyninv/${PYTHON_LIBRARY_NAME}"
${lib}
sot-dyninv-${PYTHON_LIBRARY_NAME}-wrap
)
IF(BUILD_PYTHON_INTERFACE)
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${lib})
DYNAMIC_GRAPH_PYTHON_MODULE("sot/dyninv/${PYTHON_LIBRARY_NAME}"
${lib}
sot-dyninv-${PYTHON_LIBRARY_NAME}-wrap
)
ENDIF(BUILD_PYTHON_INTERFACE)
ENDFOREACH(lib)
# Install empty __init__.py files in intermediate directories.
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/__init__.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_task_dyn_6d.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_task_dyn_passing_point.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_tasks_dyn.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_tasks_dyn_relative.py
${CMAKE_CURRENT_BINARY_DIR}/../python/robot_specific.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/dyninv
)
MESSAGE(STATUS DESTINATION ${PYTHON_SITELIB} )
IF(BUILD_PYTHON_INTERFACE)
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/__init__.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_task_dyn_6d.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_task_dyn_passing_point.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_tasks_dyn.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_tasks_dyn_relative.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/dyninv
)
ENDIF(BUILD_PYTHON_INTERFACE)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment