Ask Your Question
0

Install SWIG python bindings in install space

asked 2020-04-19 08:27:52 -0500

prex gravatar image

updated 2020-04-22 07:12:54 -0500

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-22 07:14:30 -0500

prex gravatar image

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})
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2020-04-19 08:27:52 -0500

Seen: 131 times

Last updated: Apr 22 '20