diff --git a/cmake/GtsamCythonWrap.cmake b/cmake/GtsamCythonWrap.cmake index f1382729f..3ca8b903f 100644 --- a/cmake/GtsamCythonWrap.cmake +++ b/cmake/GtsamCythonWrap.cmake @@ -279,3 +279,10 @@ function(install_cython_files source_files dest_directory) endfunction() +function(install_python_package install_path) + set(package_path "${install_path}${GTSAM_BUILD_TAG}") + # set cython directory permissions to user so we don't get permission denied + install(CODE "execute_process(COMMAND sh \"-c\" \"chown -R $(logname):$(logname) ${package_path}\")") + # go to cython directory and run setup.py + install(CODE "execute_process(COMMAND sh \"-c\" \"cd ${package_path} && python setup.py install\")") +endfunction() diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt index 4cc9d2f5d..96503b82f 100644 --- a/cython/CMakeLists.txt +++ b/cython/CMakeLists.txt @@ -45,4 +45,6 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX) install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py") install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam_unstable" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py") + install_python_package("${GTSAM_CYTHON_INSTALL_PATH}") + endif ()