From 68c23a61203fc35dd11c7a0b1cc13f7cc2c5cf8c Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 24 Aug 2021 09:20:03 -0700 Subject: Add option to to transpile Cython to C++ 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 #9015 --- docs/markdown/snippets/cython-c++-intermediate.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/markdown/snippets/cython-c++-intermediate.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/cython-c++-intermediate.md b/docs/markdown/snippets/cython-c++-intermediate.md new file mode 100644 index 0000000..0a1c35f --- /dev/null +++ b/docs/markdown/snippets/cython-c++-intermediate.md @@ -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'], +) +``` -- cgit v1.1