Unverified Commit 3e110a0c authored by Guilhem Saurel's avatar Guilhem Saurel Committed by GitHub
Browse files

Merge pull request #12 from nim65s/devel

[CMake] add BUILD_PYTHON_INTERFACE option
parents c4158e5c 6a9c14a2
Pipeline #1346 passed with stage
in 14 minutes and 57 seconds
...@@ -20,10 +20,11 @@ INCLUDE(cmake/boost.cmake) ...@@ -20,10 +20,11 @@ INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake) INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/lapack.cmake) INCLUDE(cmake/lapack.cmake)
INCLUDE(cmake/cpack.cmake) INCLUDE(cmake/cpack.cmake)
INCLUDE(cmake/python.cmake)
SET(PROJECT_NAME sot-dyninv) SET(PROJECT_NAME sot-dyninv)
SET(PROJECT_DESCRIPTION "control by inverse dynamics.") 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(CUSTOM_HEADER_DIR "${PROJECT_NAME}")
SET(DOXYGEN_USE_MATHJAX YES) SET(DOXYGEN_USE_MATHJAX YES)
...@@ -135,22 +136,18 @@ foreach(lib solver-op-space solver-dyn-reduced solver-dyn-red2) ...@@ -135,22 +136,18 @@ foreach(lib solver-op-space solver-dyn-reduced solver-dyn-red2)
ENDIF(WIN32) ENDIF(WIN32)
endforeach(lib) 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 subdirectories.
ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(python) ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(unitTesting) 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_FINALIZE()
SETUP_PROJECT_CPACK() SETUP_PROJECT_CPACK()
INCLUDE(../cmake/python.cmake) IF(BUILD_PYTHON_INTERFACE)
FINDPYTHON()
INSTALL( CONFIGURE_FILE(
FILES ros/sot-concept.py "${CMAKE_CURRENT_SOURCE_DIR}/robot_specific.py.cmake"
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/tutorial "${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 @@ ...@@ -14,9 +14,6 @@
# received a copy of the GNU Lesser General Public License along with # received a copy of the GNU Lesser General Public License along with
# sot-dyninv. If not, see <http://www.gnu.org/licenses/>. # sot-dyninv. If not, see <http://www.gnu.org/licenses/>.
INCLUDE(../cmake/python.cmake)
FINDPYTHON()
IF(CMAKE_BUILD_TYPE STREQUAL "DEBUG") IF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
ADD_DEFINITIONS(-DDEBUG=2) ADD_DEFINITIONS(-DDEBUG=2)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "DEBUG") ENDIF(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
...@@ -37,7 +34,6 @@ FOREACH(header ${headers}) ...@@ -37,7 +34,6 @@ FOREACH(header ${headers})
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE) PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
ENDFOREACH(header) ENDFOREACH(header)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include)
LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS})
# --- COMPILATION OF PLUGINS # --- COMPILATION OF PLUGINS
FOREACH(lib ${libs}) FOREACH(lib ${libs})
...@@ -62,22 +58,23 @@ FOREACH(lib ${libs}) ...@@ -62,22 +58,23 @@ FOREACH(lib ${libs})
INSTALL(TARGETS ${lib} DESTINATION ${DYNAMIC_GRAPH_PLUGINDIR}) INSTALL(TARGETS ${lib} DESTINATION ${DYNAMIC_GRAPH_PLUGINDIR})
# build python submodule # build python submodule
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${lib}) IF(BUILD_PYTHON_INTERFACE)
DYNAMIC_GRAPH_PYTHON_MODULE("sot/dyninv/${PYTHON_LIBRARY_NAME}" STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${lib})
${lib} DYNAMIC_GRAPH_PYTHON_MODULE("sot/dyninv/${PYTHON_LIBRARY_NAME}"
sot-dyninv-${PYTHON_LIBRARY_NAME}-wrap ${lib}
) sot-dyninv-${PYTHON_LIBRARY_NAME}-wrap
)
ENDIF(BUILD_PYTHON_INTERFACE)
ENDFOREACH(lib) ENDFOREACH(lib)
# Install empty __init__.py files in intermediate directories. # Install empty __init__.py files in intermediate directories.
INSTALL(FILES IF(BUILD_PYTHON_INTERFACE)
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/__init__.py INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_task_dyn_6d.py ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/__init__.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_task_dyn_passing_point.py ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_task_dyn_6d.py
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_tasks_dyn.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_relative.py ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_tasks_dyn.py
${CMAKE_CURRENT_BINARY_DIR}/../python/robot_specific.py ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_graph/sot/dyninv/meta_tasks_dyn_relative.py
DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/dyninv DESTINATION ${PYTHON_SITELIB}/dynamic_graph/sot/dyninv
) )
ENDIF(BUILD_PYTHON_INTERFACE)
MESSAGE(STATUS DESTINATION ${PYTHON_SITELIB} )
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