aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/xcodebackend.py
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-07-12 15:22:30 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2022-10-09 14:43:18 +0300
commita590cfde0cf719c637b75e4784be0c0ae60e3b1f (patch)
tree3287d2c965962c470d027ead3df8256da000ec62 /mesonbuild/backend/xcodebackend.py
parente945f35cd72402d0d204ff10870e2a95c59b6192 (diff)
downloadmeson-a590cfde0cf719c637b75e4784be0c0ae60e3b1f.zip
meson-a590cfde0cf719c637b75e4784be0c0ae60e3b1f.tar.gz
meson-a590cfde0cf719c637b75e4784be0c0ae60e3b1f.tar.bz2
compilers: Add optimization=plain option
https://github.com/mesonbuild/meson/pull/9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that ā€œno extra build flags are usedā€. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
Diffstat (limited to 'mesonbuild/backend/xcodebackend.py')
-rw-r--r--mesonbuild/backend/xcodebackend.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py
index 0d8bafb..9e101ce 100644
--- a/mesonbuild/backend/xcodebackend.py
+++ b/mesonbuild/backend/xcodebackend.py
@@ -52,7 +52,8 @@ LANGNAMEMAP = {'c': 'C',
'objcpp': 'OBJCPLUSPLUS',
'swift': 'SWIFT_'
}
-OPT2XCODEOPT = {'0': '0',
+OPT2XCODEOPT = {'plain': None,
+ '0': '0',
'g': '0',
'1': '1',
'2': '2',
@@ -1561,7 +1562,9 @@ class XCodeBackend(backends.Backend):
settings_dict.add_item('EXECUTABLE_SUFFIX', suffix)
settings_dict.add_item('GCC_GENERATE_DEBUGGING_SYMBOLS', BOOL2XCODEBOOL[target.get_option(OptionKey('debug'))])
settings_dict.add_item('GCC_INLINES_ARE_PRIVATE_EXTERN', 'NO')
- settings_dict.add_item('GCC_OPTIMIZATION_LEVEL', OPT2XCODEOPT[target.get_option(OptionKey('optimization'))])
+ opt_flag = OPT2XCODEOPT[target.get_option(OptionKey('optimization'))]
+ if opt_flag is not None:
+ settings_dict.add_item('GCC_OPTIMIZATION_LEVEL', opt_flag)
if target.has_pch:
# Xcode uses GCC_PREFIX_HEADER which only allows one file per target/executable. Precompiling various header files and
# applying a particular pch to each source file will require custom scripts (as a build phase) and build flags per each