diff options
Diffstat (limited to 'docs/markdown/Cython.md')
-rw-r--r-- | docs/markdown/Cython.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/markdown/Cython.md b/docs/markdown/Cython.md index 1d30c1f..3042750 100644 --- a/docs/markdown/Cython.md +++ b/docs/markdown/Cython.md @@ -31,3 +31,32 @@ py.extension_module( dependencies : dep_py, ) ``` + +## C++ intermediate support + +*(New in 0.60.0)* + +An option has been added to control this, called `cython_language`. This can be +either `'c'` or `'cpp'`. + +For those coming from setuptools/distutils, they will find two things. First, +meson ignores `# distutils: language = c++` inline directives. Second that Meson +allows options only on a per-target granularity. This means that if you need to mix +cython files being transpiled to C and to C++ you need two targets: + +```meson +project('my project', 'cython') + +cython_cpp_lib = static_library( + 'helper_lib', + 'foo_cpp.pyx', # will be transpiled to C++ + override_options : ['cython_language=cpp'], +) + +py.extension_module( + 'foo', + 'foo.pyx', # will be transpiled to C + link_with : [cython_cpp_lib], + dependencies : dep_py, +) +``` |