Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,10 @@ def generate_cython_transpile(self, target: build.BuildTarget) -> \
args += cython.get_option_std_args(target, target.subproject)
args += self.build.get_global_args(cython, target.for_machine)
args += self.build.get_project_args(cython, target)
cython_args = self.environment.coredata.optstore.get_value_for(
OptionKey('cython_args', target.subproject, target.for_machine))
assert isinstance(cython_args, list), 'for mypy'
args += cython_args
args += target.get_extra_args('cython')

ext = self.get_target_option(target, OptionKey('cython_language', machine=target.for_machine))
Expand Down
5 changes: 5 additions & 0 deletions test cases/cython/3 cython_args/builtincythonargs.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test():
IF BUILTIN_VALUE:
return 1
ELSE:
return 0
5 changes: 5 additions & 0 deletions test cases/cython/3 cython_args/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ mod = python.extension_module(
],
)

builtin_mod = python.extension_module(
'builtincythonargs',
files('builtincythonargs.pyx'),
)

test(
'test',
python,
Expand Down
9 changes: 9 additions & 0 deletions test cases/cython/3 cython_args/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"matrix": {
"options": {
"cython_args": [
{ "val": "--compile-time-env BUILTIN_VALUE=1" }
]
}
}
}
2 changes: 2 additions & 0 deletions test cases/cython/3 cython_args/test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import cythonargs
import builtincythonargs

assert cythonargs.test() == 1
assert builtincythonargs.test() == 1
Loading