diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-04-05 13:03:51 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-04-05 13:03:51 +0300 |
commit | e5766454d647af735b82e54e94c5bd0b8854871b (patch) | |
tree | bfb3f6f9d198d35d69698696c9e27b94e0caefa4 /mesonbuild | |
parent | 6043016a380237c9ee859f9dee77dfca52c794ed (diff) | |
download | meson-e5766454d647af735b82e54e94c5bd0b8854871b.zip meson-e5766454d647af735b82e54e94c5bd0b8854871b.tar.gz meson-e5766454d647af735b82e54e94c5bd0b8854871b.tar.bz2 |
Set optimization level in the Xcode native way.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/xcodebackend.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 6b73f00..85fe8f8 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -20,7 +20,7 @@ from .. import mlog import uuid, os, operator import typing as T -from ..mesonlib import MesonException +from ..mesonlib import MesonException, OptionKey from ..interpreter import Interpreter INDENT = '\t' @@ -47,6 +47,14 @@ LANGNAMEMAP = {'c': 'C', 'objc': 'OBJC', 'objcpp': 'OBJCPLUSPLUS', } +OPT2XCODEOPT = {'0': '0', + 'g': '0', + '1': '1', + '2': '2', + '3': '3', + 's': 's', + } + class PbxItem: def __init__(self, value, comment = ''): @@ -187,7 +195,7 @@ class XCodeBackend(backends.Backend): return str(uuid.uuid4()).upper().replace('-', '')[:24] def get_target_dir(self, target): - dirname = os.path.join(target.get_subdir(), self.environment.coredata.get_option(mesonlib.OptionKey('buildtype'))) + dirname = os.path.join(target.get_subdir(), self.environment.coredata.get_option(OptionKey('buildtype'))) os.makedirs(os.path.join(self.environment.get_build_dir(), dirname), exist_ok=True) return dirname @@ -858,7 +866,7 @@ class XCodeBackend(backends.Backend): settings_dict.add_item('EXECUTABLE_SUFFIX', f'"{suffix}"') settings_dict.add_item('GCC_GENERATE_DEBUGGING_SYMBOLS', 'YES') settings_dict.add_item('GCC_INLINES_ARE_PRIVATE_EXTERN', 'NO') - settings_dict.add_item('GCC_OPTIMIZATION_LEVEL', 0) + settings_dict.add_item('GCC_OPTIMIZATION_LEVEL', OPT2XCODEOPT[self.get_option_for_target(OptionKey('optimization'), target)]) 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 |