To get close to a MWE, I have an example project that illustrates my problem. The project tries to perform a simple operation on a wrapped C++ class, in this case a PCLHeader object.
I am pretty sure the problem lies in the fact that my cmake
call includes two .pyx
files.
cython_add_module(test_cython common.pyx test_cython.pyx)
.
Based on the documentation in UseCython.cmake
, which is part of the project, this call should be okay as far as I can tell.
When I build this project, then try to import the resulting library, Python fails to import the first time only.
In [1]: import test_cython
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-158d7481838a> in <module>()
----> 1 import test_cython
common.pxd in init test_cython (/Users/phil/devel/test_cython/build/test_cython.cxx:1424)()
ImportError: No module named common
In [2]: import test_cython
In [3]:
As an aside, if anybody could steer me toward a better design if this is wrong in some way, I would appreciate it. For example, I cannot understand why this line causes compile errors based on my setup.