Verified Commit 37104175 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

cmake: skip embeded Python for PyPy compiler

parent 2f53ccd8
Pipeline #13983 passed with stage
in 124 minutes and 38 seconds
......@@ -144,6 +144,17 @@ IF(BUILD_PYTHON_INTERFACE)
FINDPYTHON(REQUIRED)
SEARCH_FOR_BOOST_PYTHON(REQUIRED)
ADD_PROJECT_DEPENDENCY(eigenpy 2.6.2 REQUIRED)
# Check wether this a PyPy Python
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import platform; print(platform.python_implementation())"
OUTPUT_VARIABLE _python_implementation_value
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
IF(_python_implementation_value MATCHES "PyPy")
SET(BUILD_PYTHON_INTERFACE_WITH_PYPY)
ENDIF()
ELSE(BUILD_PYTHON_INTERFACE)
MESSAGE(STATUS "Pinocchio won't be compiled with its Python bindings. If you want to enable this feature, please set the option BUILD_PYTHON_INTERFACE to ON.")
ENDIF(BUILD_PYTHON_INTERFACE)
......
......@@ -49,16 +49,18 @@ FILE(GLOB_RECURSE ${PROJECT_NAME}_PYTHON_SOURCES
)
# Parser for Python model
LIST(APPEND ${PROJECT_NAME}_PYTHON_HEADERS
parsers/python.hpp
)
SET(${PROJECT_NAME}_PARSER_PYTHON_HEADERS
parsers/python.hpp
)
IF(NOT BUILD_PYTHON_INTERFACE_WITH_PYPY)
LIST(APPEND ${PROJECT_NAME}_PYTHON_HEADERS
parsers/python.hpp
)
SET(${PROJECT_NAME}_PARSER_PYTHON_HEADERS
parsers/python.hpp
)
LIST(APPEND ${PROJECT_NAME}_PYTHON_SOURCES
parsers/python/model.cpp
)
LIST(APPEND ${PROJECT_NAME}_PYTHON_SOURCES
parsers/python/model.cpp
)
ENDIF(NOT BUILD_PYTHON_INTERFACE_WITH_PYPY)
REMOVE_PATH_FROM_LIST("${${PROJECT_NAME}_PYTHON_HEADERS}" "${CMAKE_CURRENT_SOURCE_DIR}/" ${PROJECT_NAME}_PYTHON_HEADERS)
REMOVE_PATH_FROM_LIST("${${PROJECT_NAME}_PYTHON_SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/" ${PROJECT_NAME}_PYTHON_SOURCES)
......@@ -112,8 +114,10 @@ MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/
SYMLINK_AND_INSTALL_HEADERS("${${PROJECT_NAME}_PYTHON_HEADERS}" "bindings/python")
# Headers of the Python parser
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/parsers/python")
SYMLINK_AND_INSTALL_HEADERS("${${PROJECT_NAME}_PARSER_PYTHON_HEADERS}" "")
IF(NOT BUILD_PYTHON_INTERFACE_WITH_PYPY)
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/parsers/python")
SYMLINK_AND_INSTALL_HEADERS("${${PROJECT_NAME}_PARSER_PYTHON_HEADERS}" "")
ENDIF(NOT BUILD_PYTHON_INTERFACE_WITH_PYPY)
# --- COMPILE WRAPPER
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/bindings/python/${PROJECT_NAME}")
......
......@@ -95,7 +95,7 @@ IF(urdfdom_FOUND)
ENDIF(hpp-fcl_FOUND)
ENDIF(urdfdom_FOUND)
IF(BUILD_PYTHON_INTERFACE)
IF(BUILD_PYTHON_INTERFACE AND NOT BUILD_PYTHON_INTERFACE_WITH_PYPY)
ADD_PINOCCHIO_UNIT_TEST(python_parser PACKAGES eigenpy)
TARGET_INCLUDE_DIRECTORIES(test-cpp-python_parser SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
......@@ -113,7 +113,7 @@ IF(BUILD_PYTHON_INTERFACE)
ENDIF(APPLE)
SET_PROPERTY(TEST test-cpp-python_parser PROPERTY ENVIRONMENT ${ENV_VARIABLES})
ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)
ENDIF(BUILD_PYTHON_INTERFACE AND NOT BUILD_PYTHON_INTERFACE_WITH_PYPY)
# Test over the joints
ADD_PINOCCHIO_UNIT_TEST(all-joints)
......
Supports Markdown
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