diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py index a247998b9..3f8dd0585 100644 --- a/mesonpy/__init__.py +++ b/mesonpy/__init__.py @@ -711,6 +711,8 @@ def __init__( cpp = ['c++', '-arch', {arch!r}] objc = ['cc', '-arch', {arch!r}] objcpp = ['c++', '-arch', {arch!r}] + strip = ['strip', '-arch', {arch!r}] + [host_machine] system = 'darwin' cpu = {arch!r} @@ -731,11 +733,12 @@ def __init__( cross_file_data = textwrap.dedent(f''' [binaries] + ar = '{arch}-apple-{subsystem}-ar' c = '{arch}-apple-{subsystem}-clang' cpp = '{arch}-apple-{subsystem}-clang++' objc = '{arch}-apple-{subsystem}-clang' objcpp = '{arch}-apple-{subsystem}-clang++' - ar = '{arch}-apple-{subsystem}-ar' + strip = ['strip', '-arch', {arch!r}] [host_machine] system = 'ios' diff --git a/tests/conftest.py b/tests/conftest.py index af737968c..ed375cf08 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -192,3 +192,18 @@ def cleanenv(): # $MACOSX_DEPLOYMENT_TARGET affects the computation of the platform tag on macOS. yield mpatch.delenv('MACOSX_DEPLOYMENT_TARGET', raising=False) mpatch.undo() + + +@pytest.fixture(autouse=True, scope='session') +def meson_fatal_warnings(): + # Cannot use the 'monkeypatch' fixture because of scope mismatch. + mpatch = pytest.MonkeyPatch() + mesonpy_project_init = mesonpy.Project.__init__ + + def __init__(self, source_dir, build_dir, meson_args=None, editable_verbose=False): + if meson_args is None: + meson_args = {} + meson_args['setup'] = meson_args.get('setup', []) + ['--fatal-meson-warnings'] + mesonpy_project_init(self, source_dir, build_dir, meson_args, editable_verbose) + + mpatch.setattr(mesonpy.Project, '__init__', __init__) diff --git a/tests/packages/limited-api/meson.build b/tests/packages/limited-api/meson.build index 4973c6f14..606a12242 100644 --- a/tests/packages/limited-api/meson.build +++ b/tests/packages/limited-api/meson.build @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: MIT -project('limited-api', 'c', version: '1.0.0') +project('limited-api', 'c', version: '1.0.0', meson_version: '>= 1.3') py = import('python').find_installation(pure: false) diff --git a/tests/test_project.py b/tests/test_project.py index fb3d08084..f4a3dc012 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -400,7 +400,7 @@ def test_ios_project(package_simple, monkeypatch, multiarch, tmp_path): project = mesonpy.Project(source_dir=package_simple, build_dir=tmp_path) # Meson configuration points at the cross file - assert project._meson_args['setup'] == ['--cross-file', os.fspath(tmp_path / 'meson-python-cross-file.ini')] + assert project._meson_args['setup'][-2:] == ['--cross-file', os.fspath(tmp_path / 'meson-python-cross-file.ini')] # Meson config files exist, and have some relevant keys assert (tmp_path / 'meson-python-native-file.ini').exists()