diff options
author | Ralf Gommers <ralf.gommers@gmail.com> | 2023-03-25 22:53:59 +0000 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2025-07-18 10:42:18 -0700 |
commit | 1c18bcef1f17554e792d2e53ec556f0ec149b5b3 (patch) | |
tree | 0d61b71a5213a5105e492060ca31c66529a361bb | |
parent | d7261815f193a46074217af7c89bf276e965030e (diff) | |
download | meson-1c18bcef1f17554e792d2e53ec556f0ec149b5b3.zip meson-1c18bcef1f17554e792d2e53ec556f0ec149b5b3.tar.gz meson-1c18bcef1f17554e792d2e53ec556f0ec149b5b3.tar.bz2 |
Fix use of a .pxi Cython include file as source from `configure_file`
Without adding .pxi` as a known header suffix, the added test will
fail with:
```
No specified compiler can handle file stuff.pxi
```
Technically only .pxd are header files, and .pxi are "include files"
which are literally included in .pyx files. Adding them as headers
seems to be fine though, since they're kinda similar and the point is
to avoid treating them as source files.
-rw-r--r-- | mesonbuild/compilers/compilers.py | 2 | ||||
-rw-r--r-- | test cases/cython/2 generated sources/meson.build | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index af6b050..76d8d72 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -42,7 +42,7 @@ _T = T.TypeVar('_T') about. To support a new compiler, add its information below. Also add corresponding autodetection code in detect.py.""" -header_suffixes = {'h', 'hh', 'hpp', 'hxx', 'H', 'ipp', 'moc', 'vapi', 'di'} +header_suffixes = {'h', 'hh', 'hpp', 'hxx', 'H', 'ipp', 'moc', 'vapi', 'di', 'pxd', 'pxi'} obj_suffixes = {'o', 'obj', 'res'} # To the emscripten compiler, .js files are libraries lib_suffixes = {'a', 'lib', 'dll', 'dll.a', 'dylib', 'so', 'js'} diff --git a/test cases/cython/2 generated sources/meson.build b/test cases/cython/2 generated sources/meson.build index d438d80..3d2837d 100644 --- a/test cases/cython/2 generated sources/meson.build +++ b/test cases/cython/2 generated sources/meson.build @@ -79,13 +79,20 @@ stuff_pxi = fs.copyfile( 'stuff.pxi' ) +stuff_pxi_2 = configure_file( + input: 'stuff.pxi.in', + output: 'stuff.pxi', + configuration: configuration_data(), + install: false +) + # Need to copy the cython source to the build directory # since meson can only generate the .pxi there includestuff_pyx = fs.copyfile( 'includestuff.pyx' ) -stuff_pxi_dep = declare_dependency(sources: stuff_pxi) +stuff_pxi_dep = declare_dependency(sources: [stuff_pxi, stuff_pxi_2]) includestuff_ext = py3.extension_module( 'includestuff', |