Explicitly set target_subarch for iOS (re-land)

Since the approach in https://webrtc-codereview.appspot.com/48869004/
was not possible, this is the only way to set
the target_subarch GYP_DEFINES for iOS.

WebRTC doesn't use or support the target_subarch
GYP variable in the same way as Chromium does, and we
currently don't build fat binaries at our buildbots.

This is needed to unblock the chromium_revision roll in
https://webrtc-codereview.appspot.com/50569004/ and it
also makes it a bit easier to build for iOS since it
is no longer needed to set target_subarch=arm64 when
target_arch=arm64 (i.e. when you build for ARM64).

BUG=4503
TESTED=Ran successful project generations using:
GYP_DEFINES="OS=ios target_arch=arm" webrtc/build/gyp_webrtc
and verified the -arch compiler flag was set to 'armv7'

GYP_DEFINES="OS=ios target_arch=arm64" webrtc/build/gyp_webrtc
and verified the -arch compiler flag was set to 'arm64'

R=phoglund@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/48909004

Cr-Commit-Position: refs/heads/master@{#8949}
This commit is contained in:
Henrik Kjellander 2015-04-08 15:28:49 +02:00
parent fbfc74a070
commit 06c80133f2

View File

@ -78,11 +78,11 @@ if __name__ == '__main__':
args.append('--check')
supplemental_includes = GetSupplementalFiles()
gn_vars_dict = gyp_chromium.GetGypVars(supplemental_includes)
gyp_vars = gyp_chromium.GetGypVars(supplemental_includes)
# Automatically turn on crosscompile support for platforms that need it.
if all(('ninja' in os.environ.get('GYP_GENERATORS', ''),
gn_vars_dict.get('OS') in ['android', 'ios'],
gyp_vars.get('OS') in ['android', 'ios'],
'GYP_CROSSCOMPILE' not in os.environ)):
os.environ['GYP_CROSSCOMPILE'] = '1'
@ -90,6 +90,18 @@ if __name__ == '__main__':
gyp_chromium.additional_include_files(supplemental_includes,
args)])
# Set target_subarch for iOS builds if not already set.
if gyp_vars.get('OS') == 'ios' and 'target_subarch' not in gyp_vars:
os.environ.setdefault('GYP_DEFINES', '')
target_subarch = None
if gyp_vars.get('target_arch') == 'arm' :
target_subarch = 'arm32'
elif gyp_vars.get('target_arch') == 'arm64':
target_subarch = 'arm64'
if target_subarch:
print 'INFO: Appending target_subarch=%s to GYP_DEFINES' % target_subarch
os.environ['GYP_DEFINES'] += ' target_subarch=%s' % target_subarch
# Set the gyp depth variable to the root of the checkout.
args.append('--depth=' + os.path.relpath(checkout_root))