Commit 18e2965f authored by Guilhem Saurel's avatar Guilhem Saurel

[CMake] use PYTHON_INSTALL_ON_SITE

PYTHON_INSTALL_ON_SITE does the PYTHON_BUILD and the INSTALL, but they
require to have the same arguments. Then, we have to put the CMakeLists
in a parent folder of the module, as `python`, or `bindings/python`.
parent 230fe902
......@@ -33,7 +33,7 @@ IF(BUILD_PYTHON_INTERFACE)
ADD_REQUIRED_DEPENDENCY("pinocchio >= 2.1.0")
FINDPYTHON()
STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
ADD_SUBDIRECTORY(${PY_NAME})
ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(unittest)
ENDIF(BUILD_PYTHON_INTERFACE)
......
......@@ -5,6 +5,5 @@ SET(${PROJECT_NAME}_PYTHON_FILES
)
FOREACH(python ${${PROJECT_NAME}_PYTHON_FILES})
PYTHON_BUILD(. ${python})
INSTALL(FILES ${python} DESTINATION ${PYTHON_SITELIB}/${PY_NAME})
PYTHON_INSTALL_ON_SITE(${PY_NAME} ${python})
ENDFOREACH(python ${${PROJECT_NAME}_PYTHON_FILES})
......@@ -2,7 +2,6 @@ import sys
from os.path import dirname, exists, join
import numpy as np
import pinocchio
from pinocchio.robot_wrapper import RobotWrapper
......@@ -15,7 +14,7 @@ def getModelPath(subpath, printmsg=False):
if printmsg:
print("using %s as modelPath" % path)
return path
for path in (dirname(dirname(dirname(__file__))), dirname(dirname(__file__))):
for path in (dirname(dirname(dirname(dirname(__file__)))), dirname(dirname(dirname(__file__)))):
if exists(join(path, subpath.strip('/'))):
if printmsg:
print("using %s as modelPath" % path)
......
......@@ -3,5 +3,5 @@ SET(${PROJECT_NAME}_PYTHON_TESTS
)
FOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
ADD_PYTHON_UNIT_TEST("py-${TEST}" "unittest/test_${TEST}.py" .)
ADD_PYTHON_UNIT_TEST("py-${TEST}" "unittest/test_${TEST}.py" python)
ENDFOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
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