0
$\begingroup$

Rosanswers logo

We're using SWIG to generate python bindings for some C++ classes. This works fine in the devel space (cmake below). However, I can't figure out how to change our cmake to also install the python modules in the install space in addition. I can change the destinations from CATKIN_DEVEL_PREFIX to CMAKE_INSTALL_PREFIX for PYTHON_MODULE_DIR which does what I want. However, then the modules are not available in the devel space anymore. So how can I properly install my modules to the install space?

I tried to add the install macro to the cmake below:

# Install 
install(TARGETS ${SWIG_MODULE_${target}_REAL_NAME}
  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python2.7/${DIST_DIR}/${PYTHON_PACKAGE_NAME}
  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python2.7/${DIST_DIR}/${PYTHON_PACKAGE_NAME}
)

But the corresponding files are not installed to the install space. I only get a relatively empty __init__.py and __init__.pyc. In the devel dist-package I have __init__.py, _package_name.so, package_name.py, package_namePYTHON_wrap.cxx.


Originally posted by prex on ROS Answers with karma: 151 on 2020-04-19

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The install from my post just installs the .so libraries. We needed to add this additional install rule:

 install(FILES ${SWIG_OUT_MODULE_DIR}/${MODULE_REAL_NAME}.py DESTINATION ${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION})

Originally posted by prex with karma: 151 on 2020-04-22

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.