Skip to content

Commit caa5220

Browse files
tristan957nirbheek
authored andcommitted
Add support for cython_args
cython_args was previoously ignored by Meson.
1 parent 2647f18 commit caa5220

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

mesonbuild/backend/ninjabackend.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,7 @@ def generate_cython_transpile(self, target: build.BuildTarget) -> \
16081608
args += cython.get_option_compile_args(opt_proxy)
16091609
args += self.build.get_global_args(cython, target.for_machine)
16101610
args += self.build.get_project_args(cython, target.subproject, target.for_machine)
1611+
args += target.get_extra_args('cython')
16111612

16121613
ext = opt_proxy[OptionKey('language', machine=target.for_machine, lang='cython')].value
16131614

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def test():
2+
IF VALUE:
3+
return 1
4+
ELSE:
5+
return 0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
project('cython_args', ['cython', 'c'])
2+
3+
pymod = import('python')
4+
python = pymod.find_installation('python3')
5+
python_dep = python.dependency()
6+
if not python_dep.found()
7+
error('MESON_SKIP_TEST: Python library not found.')
8+
endif
9+
10+
mod = python.extension_module(
11+
'cythonargs',
12+
files('cythonargs.pyx'),
13+
cython_args: [
14+
'--compile-time-env',
15+
'VALUE=1'
16+
],
17+
dependencies: [python_dep]
18+
)
19+
20+
test(
21+
'test',
22+
python,
23+
args: [
24+
'test.py'
25+
],
26+
workdir: meson.current_source_dir(),
27+
env: environment({
28+
'PYTHONPATH': meson.current_build_dir(),
29+
})
30+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import cythonargs
2+
3+
assert cythonargs.test() == 1

0 commit comments

Comments
 (0)