This patch adds a new meson built-in option for cython, allowing it to target C++ instead of C as the intermediate language. This can, of course, be done on a per-target basis using the `override_options` keyword argument, or for the entire project in the project function. There are some things in this patch that are less than ideal. One of them is that we have to add compilers in the build layer, but there isn't a better place to do it because of per target override_options. There's also some design differences between Meson and setuptools, in that Meson only allows options on a per-target rather than a per-file granularity. Fixes #9015pull/9207/head
parent
524a95fa62
commit
68c23a6120
8 changed files with 123 additions and 7 deletions
@ -0,0 +1,22 @@ |
||||
## Cython can now transpile to C++ as an intermediate language |
||||
|
||||
Built-in cython support currently only allows C as an intermediate language, now |
||||
C++ is also allowed. This can be set via the `cython_language` option, either on |
||||
the command line, or in the meson.build files. |
||||
|
||||
```meson |
||||
project( |
||||
'myproject', |
||||
'cython', |
||||
default_options : ['cython_language=cpp'], |
||||
) |
||||
``` |
||||
|
||||
or on a per target basis with: |
||||
```meson |
||||
python.extension_module( |
||||
'mod', |
||||
'mod.pyx', |
||||
override_options : ['cython_language=cpp'], |
||||
) |
||||
``` |
@ -1,8 +1,16 @@ |
||||
#pragma once |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
typedef struct _Storer Storer; |
||||
|
||||
Storer* storer_new(); |
||||
void storer_destroy(Storer *s); |
||||
int storer_get_value(Storer *s); |
||||
void storer_set_value(Storer *s, int v); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
@ -0,0 +1,10 @@ |
||||
{ |
||||
"matrix": { |
||||
"options": { |
||||
"cython_language": [ |
||||
{ "val": "c" }, |
||||
{ "val": "cpp" } |
||||
] |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue