Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: pylib/gyp/xcode_emulation.py

Issue 138533006: Improve ninja's Xcode emulation (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/ios/app-bundle/test-archs.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/xcode_emulation.py
diff --git a/pylib/gyp/xcode_emulation.py b/pylib/gyp/xcode_emulation.py
index 30f27d5832d99bd02ede773af5e59ed7c513b127..622981600b5831450f6c17a1eecc824a035cb7f5 100644
--- a/pylib/gyp/xcode_emulation.py
+++ b/pylib/gyp/xcode_emulation.py
@@ -1418,17 +1418,43 @@ def _HasIOSTarget(targets):
return False
+def _IOSIsDeviceSDKROOT(sdkroot):
+ """Tests if |sdkroot| is a SDK for building for device."""
+ return sdkroot == 'iphoneos'
Mark Mentovai 2014/02/05 21:51:46 Shouldn’t this test be a little more comprehensive
sdefresne 2014/02/06 09:53:19 Done.
+
+
+def _FilterIOSArchitectureForSDKROOT(xcode_settings):
+ """Filter the ARCHS value from the |xcode_settings| dictionary to only
+ contains architectures valid for the sdk configured in SDKROOT value."""
+ allowed_archs = ('i386', 'x86_64')
+ if _IOSIsDeviceSDKROOT(xcode_settings.get('SDKROOT', '')):
+ allowed_archs = ('armv7', 'armv7s', 'arm64')
+ archs = set()
+ for arch in (xcode_settings.get('ARCHS', []) or ['$(ARCHS_STANDARD)']):
+ if arch == '$(ARCHS_STANDARD)':
+ archs.update(allowed_archs[:-1])
+ elif arch == '$(ARCHS_STANDARD_INCLUDING_64_BIT)':
+ archs.update(allowed_archs)
+ elif arch in allowed_archs:
+ archs.add(arch)
+ valid_archs = set(xcode_settings.get('VALID_ARCHS', []))
+ if valid_archs:
+ archs = archs & valid_archs
+ xcode_settings['ARCHS'] = list(archs)
+
+
def _AddIOSDeviceConfigurations(targets):
"""Clone all targets and append -iphoneos to the name. Configure these targets
- to build for iOS devices."""
- for target_dict in targets.values():
+ to build for iOS devices and use correct architectures for those builds."""
+ for target_dict in targets.itervalues():
for config_name in target_dict['configurations'].keys():
config = target_dict['configurations'][config_name]
new_config_name = config_name + '-iphoneos'
new_config_dict = copy.deepcopy(config)
if target_dict['toolset'] == 'target':
- new_config_dict['xcode_settings']['ARCHS'] = ['armv7']
new_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos'
+ _FilterIOSArchitectureForSDKROOT(new_config_dict['xcode_settings'])
+ _FilterIOSArchitectureForSDKROOT(config['xcode_settings'])
target_dict['configurations'][new_config_name] = new_config_dict
return targets
« no previous file with comments | « no previous file | test/ios/app-bundle/test-archs.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698