Commit 2cb63255 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[ios] Set `target_environment` gn variable in setup-gn.py

In preparation of supporting arm64 simulator build (for Apple Silicon
macs), we need to decouple the fact that a build is a simulator build
from the `target_cpu`.

This was done by introducing a `target_environment` variable that can
be set by the user (the default value is set using the same heuristic
based on value of `target_cpu` if unset).

Configure setup-gn.py to be explicit about setting the variable.

Bug: 1138425
Change-Id: Ic8f84ef260972e542ea456d6e85e43080e81da36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2489984
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819768}
parent 9e5267c5
...@@ -72,6 +72,11 @@ class GnGenerator(object): ...@@ -72,6 +72,11 @@ class GnGenerator(object):
} }
} }
TARGET_ENVIRONMENT_VALUES = {
'iphoneos': '"device"',
'iphonesimulator': '"simulator"',
}
def __init__(self, settings, config, target): def __init__(self, settings, config, target):
assert target in SUPPORTED_TARGETS assert target in SUPPORTED_TARGETS
assert config in SUPPORTED_CONFIGS assert config in SUPPORTED_CONFIGS
...@@ -103,7 +108,7 @@ class GnGenerator(object): ...@@ -103,7 +108,7 @@ class GnGenerator(object):
args.append(('enable_stripping', 'enable_dsyms')) args.append(('enable_stripping', 'enable_dsyms'))
args.append(('is_official_build', self._config == 'Official')) args.append(('is_official_build', self._config == 'Official'))
args.append(('is_chrome_branded', 'is_official_build')) args.append(('is_chrome_branded', 'is_official_build'))
args.append(('use_xcode_clang', 'false')) args.append(('use_xcode_clang', False))
args.append(('use_clang_coverage', self._config == 'Coverage')) args.append(('use_clang_coverage', self._config == 'Coverage'))
args.append(('is_component_build', False)) args.append(('is_component_build', False))
...@@ -120,6 +125,10 @@ class GnGenerator(object): ...@@ -120,6 +125,10 @@ class GnGenerator(object):
else: else:
args.append(('target_cpu', cpu_values[build_arch])) args.append(('target_cpu', cpu_values[build_arch]))
args.append((
'target_environment',
self.TARGET_ENVIRONMENT_VALUES[self._target]))
# Add user overrides after the other configurations so that they can # Add user overrides after the other configurations so that they can
# refer to them and override them. # refer to them and override them.
args.extend(self._settings.items('gn_args')) args.extend(self._settings.items('gn_args'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment