- I have a very complicated C++ library with lots of dependencies which I would like to wrap with Cython
- I build the library, including the shared object file I'd like to wrap, using CMake
- I need all the CMake information in order to compile the Cython code, but don't know how to incorporate it
For example, if I declare a simple class, similar to the tutorial (but try to #include something from my complicated library):
// this file is discoverable when building the so with cmake
std::cout << "test class printed, x:" << x << std::endl;
and the usual rect.pyx and rect.pyd wrapping the two C++ files, I can compile the shared object file in CMakeLists.txt
// complicated build procedure
// binding library
ADD_LIBRARY(binding_lib SHARED binding.cc)
Running cmake is able to build the shared object file fine, but running setup.py
from setuptools import setup
from Cython.Build import cythonize
fails, as it has no idea how to resolve the #include <my_complicated_libary/head.h> statement; I get the expected "fatal error: my_complicated_library/header.h: no such file or directory'. If I remove this line, everything works fine, but I can't use the definitions in my C++ library. This particular header has many other dependencies managed by CMake, so I don't think it's a matter of adding an include directory.
It seems the best way would be doing the Cython compilation in CMake directly, but I don't know how to do that. I can't be the only one attempting to wrap a library built by CMake.
Any guidance would be greatly appreciated!