Index: pylib/gyp/xcode_emulation.py |
=================================================================== |
--- pylib/gyp/xcode_emulation.py (revision 1747) |
+++ pylib/gyp/xcode_emulation.py (working copy) |
@@ -7,6 +7,7 @@ |
other build systems, such as make and ninja. |
""" |
+import copy |
import gyp.common |
import os.path |
import re |
@@ -1190,3 +1191,35 @@ |
spec['target_name'], postbuild['postbuild_name'])) |
postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild['action'])) |
return postbuilds |
+ |
Nico
2013/10/04 19:35:07
python style guide says two blank lines between fu
justincohen
2013/10/04 19:42:40
Done.
|
+def HasIOSTarget(targets): |
Nico
2013/10/04 19:35:07
this is module-private, start name with a _
justincohen
2013/10/04 19:42:40
Done.
|
+ """Returns true if any target contains the iOS specific key |
+ IPHONEOS_DEPLOYMENT_TARGET.""" |
+ for target_dict in targets.values(): |
+ for config in target_dict['configurations'].values(): |
+ settings = config.get('xcode_settings', {}) |
+ if settings.get('IPHONEOS_DEPLOYMENT_TARGET'): |
Nico
2013/10/04 19:35:07
If it fits in one line, go with
if config.get('
justincohen
2013/10/04 19:42:40
Done.
|
+ return True |
+ return False |
+ |
+ |
+def AddIOSDeviceConfigurations(targets): |
Nico
2013/10/04 19:35:07
Also add a _ in front of the name
justincohen
2013/10/04 19:42:40
Done.
|
+ """Clone all targets and append -iphoneos to the name. Configure these targets |
+ to build for iOS devices.""" |
+ for target_dict in targets.values(): |
+ 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' |
+ target_dict['configurations'][new_config_name] = new_config_dict |
+ return targets |
+ |
+def CloneConfigurationForDeviceAndEmulator(target_dicts): |
+ """If |target_dicts| contains any iOS targets, automatically create -iphoneos |
+ targets for iOS device builds.""" |
+ if HasIOSTarget(target_dicts): |
+ return AddIOSDeviceConfigurations(target_dicts) |
+ return target_dicts |