scikit-build / scikit-build

Improved build system generator for CPython C, C++, Cython and Fortran extensions
https://scikit-build.readthedocs.io
Other
486 stars 121 forks source link

Cython: include dir not set properly for cython based library dependency #399

Open Nic30 opened 5 years ago

Nic30 commented 5 years ago

Hello,

if I use example from the cysignals library it works with the setuptools without any special settings. (Note that the include dir /usr/local/lib/python3.7/dist-packages/cysignals is added properly.)

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.7/dist-packages/cysignals -I/usr/include/python3.7m -c cysignals_example.cpp -o build/temp.linux-x86_64-3.7/cysignals_example.o

However if I just copy content of .pyx file to the example project for the skbuild the include dir is not added and the build will fail.

FAILED: hello/CMakeFiles/_hello.dir/_hello.cxx.o 
/usr/bin/c++  -D_hello_EXPORTS -I/usr/include/python3.7m -O3 -DNDEBUG -fPIC -MD -MT hello/CMakeFiles/_hello.dir/_hello.cxx.o -MF hello/CMakeFiles/_hello.dir/_hello.cxx.o.d -o hello/CMakeFiles/_hello.dir/_hello.cxx.o -c hello/_hello.cxx
hello/_hello.cxx:607:10: fatal error: struct_signals.h: No such file or directory
 #include "struct_signals.h"

Is this behaviour expected? I believe that the include directories should be added as there is a code for this https://github.com/scikit-build/scikit-build/blob/master/skbuild/resources/cmake/UseCython.cmake#L289

It seems to me as the cython build files are not analysed recursively and this causes the problem.

Nic30 commented 5 years ago

scikit_build-0.9.0 Cython version 0.29.6 pip3_freeze.txt ubuntu 19.04