aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-08-24 09:20:03 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2021-09-24 22:56:46 +0300
commit68c23a61203fc35dd11c7a0b1cc13f7cc2c5cf8c (patch)
tree5afe315e41b55e8b12f3b1b56d75bfd766620cae /mesonbuild/interpreter/interpreter.py
parent524a95fa62a6e0cb77e53d7b38d5c2d59a75e449 (diff)
downloadmeson-68c23a61203fc35dd11c7a0b1cc13f7cc2c5cf8c.zip
meson-68c23a61203fc35dd11c7a0b1cc13f7cc2c5cf8c.tar.gz
meson-68c23a61203fc35dd11c7a0b1cc13f7cc2c5cf8c.tar.bz2
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
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r--mesonbuild/interpreter/interpreter.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 4d4e5da..2d04d2d 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -1241,9 +1241,14 @@ external dependencies (including libraries) must go to "dependencies".''')
args = [a.lower() for a in args]
langs = set(self.coredata.compilers[for_machine].keys())
langs.update(args)
- if ('vala' in langs or 'cython' in langs) and 'c' not in langs:
- if 'vala' in langs:
- FeatureNew.single_use('Adding Vala language without C', '0.59.0', self.subproject)
+ # We'd really like to add cython's default language here, but it can't
+ # actually be done because the cython compiler hasn't been initialized,
+ # so we can't actually get the option yet. Because we can't know what
+ # compiler to add by default, and we don't want to add unnecessary
+ # compilers we don't add anything for cython here, and instead do it
+ # When the first cython target using a particular language is used.
+ if 'vala' in langs and 'c' not in langs:
+ FeatureNew.single_use('Adding Vala language without C', '0.59.0', self.subproject)
args.append('c')
success = True