Skip to content
Snippets Groups Projects
Commit 18e2965f authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[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
No related branches found
No related tags found
1 merge request!16[CMake] use PYTHON_INSTALL_ON_SITE
...@@ -33,7 +33,7 @@ IF(BUILD_PYTHON_INTERFACE) ...@@ -33,7 +33,7 @@ IF(BUILD_PYTHON_INTERFACE)
ADD_REQUIRED_DEPENDENCY("pinocchio >= 2.1.0") ADD_REQUIRED_DEPENDENCY("pinocchio >= 2.1.0")
FINDPYTHON() FINDPYTHON()
STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME}) STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
ADD_SUBDIRECTORY(${PY_NAME}) ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(unittest) ADD_SUBDIRECTORY(unittest)
ENDIF(BUILD_PYTHON_INTERFACE) ENDIF(BUILD_PYTHON_INTERFACE)
......
...@@ -5,6 +5,5 @@ SET(${PROJECT_NAME}_PYTHON_FILES ...@@ -5,6 +5,5 @@ SET(${PROJECT_NAME}_PYTHON_FILES
) )
FOREACH(python ${${PROJECT_NAME}_PYTHON_FILES}) FOREACH(python ${${PROJECT_NAME}_PYTHON_FILES})
PYTHON_BUILD(. ${python}) PYTHON_INSTALL_ON_SITE(${PY_NAME} ${python})
INSTALL(FILES ${python} DESTINATION ${PYTHON_SITELIB}/${PY_NAME})
ENDFOREACH(python ${${PROJECT_NAME}_PYTHON_FILES}) ENDFOREACH(python ${${PROJECT_NAME}_PYTHON_FILES})
...@@ -2,7 +2,6 @@ import sys ...@@ -2,7 +2,6 @@ import sys
from os.path import dirname, exists, join from os.path import dirname, exists, join
import numpy as np import numpy as np
import pinocchio import pinocchio
from pinocchio.robot_wrapper import RobotWrapper from pinocchio.robot_wrapper import RobotWrapper
...@@ -15,7 +14,7 @@ def getModelPath(subpath, printmsg=False): ...@@ -15,7 +14,7 @@ def getModelPath(subpath, printmsg=False):
if printmsg: if printmsg:
print("using %s as modelPath" % path) print("using %s as modelPath" % path)
return 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 exists(join(path, subpath.strip('/'))):
if printmsg: if printmsg:
print("using %s as modelPath" % path) print("using %s as modelPath" % path)
......
...@@ -3,5 +3,5 @@ SET(${PROJECT_NAME}_PYTHON_TESTS ...@@ -3,5 +3,5 @@ SET(${PROJECT_NAME}_PYTHON_TESTS
) )
FOREACH(TEST ${${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}) ENDFOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment