How do I get catkin to automatically build .so files when I run catkin_make?
I have a few .pyx files that I'd like to build with catkin and Cython. So far I've been able to get catkin to create the c files but don't know how to get it to create the .so files. My node structure looks like this:
my node
|-setup.py
|-CMakeLists.txt
|-package.xml
|-src
| |-1.pyx
| |-2.pyx
Other files and directories have been omitted for brevity. The setup file looks like this:
from setuptools import setup
from catkin_pkg.python_setup import generate_distutils_setup
from Cython.Build import cythonize
setup_args = generate_distutils_setup(
ext_modules=cythonize("src/*.pyx"),
packages=['sparus2_planner'],
package_dir={'': 'src'})
setup(**setup_args)
The CMakeLists.txt has been modified to include catkin_python_setup()
I can run python setup.py build_ext --inplace
manually and that then generates the .so files but would rather have catkin take care of it.
Does #q108776 and the linked example repo help? With this (and some knowledge of cython, I guess this is required to get all things done), I've been able to create a python module from a cpp library. But as you want it the other way round I'm not sure this is all you need.
I've already checked the mentioned repo and found it hard to understand since I come from a python coding background with little experience in cmake. I suspect that I need to change a couple of things in the cmakelists.txt, and maybe add a cmakelists.txt in the src file, but I don't know what I should use from the repo code.
Hi, were you able to come up with a good solution to this?