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

Side by Side Diff: pylib/gyp/xcode_emulation.py

Issue 194713003: Enable 64-bit architectures by default for Xcode 5.1 and higher (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Improved comment & remove patch 2 Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """ 5 """
6 This module contains classes that help to emulate xcodebuild behavior on top of 6 This module contains classes that help to emulate xcodebuild behavior on top of
7 other build systems, such as make and ninja. 7 other build systems, such as make and ninja.
8 """ 8 """
9 9
10 import copy 10 import copy
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 sdk_root = items[-1] 937 sdk_root = items[-1]
938 sdk_path = self._XcodeSdkPath(sdk_root) 938 sdk_path = self._XcodeSdkPath(sdk_root)
939 if sdk_path == default_sdk_path: 939 if sdk_path == default_sdk_path:
940 return sdk_root 940 return sdk_root
941 return '' 941 return ''
942 942
943 def _DefaultArch(self): 943 def _DefaultArch(self):
944 # For Mac projects, Xcode changed the default value used when ARCHS is not 944 # For Mac projects, Xcode changed the default value used when ARCHS is not
945 # set from "i386" to "x86_64". 945 # set from "i386" to "x86_64".
946 # 946 #
947 # For iOS projects, if ARCHS is unset, it defaults to "armv7 armv7s" when 947 # For iOS projects, the value used when ARCHS is unset depends on the
948 # building for a device, and the simulator binaries are always build for 948 # version of Xcode. The following array summarize the default used:
949 # "i386".
950 # 949 #
951 # For new projects, ARCHS is set to $(ARCHS_STANDARD_INCLUDING_64_BIT), 950 # Xcode Version | ARCHS for simulator | ARCHS for device
952 # which correspond to "armv7 armv7s arm64", and when building the simulator 951 # ---------------+---------------------+--------------------
953 # the architecture is either "i386" or "x86_64" depending on the simulated 952 # < 5.0 | i386 | armv7 armv7s
954 # device (respectively 32-bit or 64-bit device). 953 # < 5.1 (*) | i386 x86_64 | armv7 armv7s arm64
954 # >= 5.1 (**) | i386 x86_64 | armv7 armv7s arm64
955 #
956 # (*): the default is $(ARCHS_STANDARD_INCLUDING_64_BIT) instead of the
957 # default of $(ARCHS_STANDARD) used by previous versions of Xcode.
958 #
959 # (**): the default is back to $(ARCHS_STANDARD), but the macro has been
960 # updated to also include 64-bit architectures.
955 # 961 #
956 # Since the value returned by this function is only used when ARCHS is not 962 # Since the value returned by this function is only used when ARCHS is not
957 # set, then on iOS we return "i386", as the default xcode project generator 963 # set, then on iOS we return "i386", as the default xcode project generator
958 # does not set ARCHS if it is not set in the .gyp file. 964 # does not set ARCHS if it is not set in the .gyp file.
959 if self.isIOS: 965 if self.isIOS:
960 return 'i386' 966 return 'i386'
Mark Mentovai 2014/03/22 13:55:50 Why not x86_64 too when version >= '0500'?
sdefresne 2014/03/24 10:52:21 Done.
961 version, build = XcodeVersion() 967 version, build = XcodeVersion()
962 if version >= '0500': 968 if version >= '0500':
963 return 'x86_64' 969 return 'x86_64'
964 return 'i386' 970 return 'i386'
965 971
966 class MacPrefixHeader(object): 972 class MacPrefixHeader(object):
967 """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature. 973 """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature.
968 974
969 This feature consists of several pieces: 975 This feature consists of several pieces:
970 * If GCC_PREFIX_HEADER is present, all compilations in that project get an 976 * If GCC_PREFIX_HEADER is present, all compilations in that project get an
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 def _IOSDefaultArchForSDKRoot(sdkroot): 1450 def _IOSDefaultArchForSDKRoot(sdkroot):
1445 """Returns the expansion of standard ARCHS macro depending on the version 1451 """Returns the expansion of standard ARCHS macro depending on the version
1446 of Xcode installed and configured, and which |sdkroot| to use (iphoneos or 1452 of Xcode installed and configured, and which |sdkroot| to use (iphoneos or
1447 simulator).""" 1453 simulator)."""
1448 xcode_version, xcode_build = XcodeVersion() 1454 xcode_version, xcode_build = XcodeVersion()
1449 if xcode_version < '0500': 1455 if xcode_version < '0500':
1450 if _IOSIsDeviceSDKROOT(sdkroot): 1456 if _IOSIsDeviceSDKROOT(sdkroot):
1451 return {'$(ARCHS_STANDARD)': ['armv7']} 1457 return {'$(ARCHS_STANDARD)': ['armv7']}
1452 else: 1458 else:
1453 return {'$(ARCHS_STANDARD)': ['i386']} 1459 return {'$(ARCHS_STANDARD)': ['i386']}
1454 else: 1460 elif xcode_version < '0510':
1455 if _IOSIsDeviceSDKROOT(sdkroot): 1461 if _IOSIsDeviceSDKROOT(sdkroot):
1456 return { 1462 return {
1457 '$(ARCHS_STANDARD)': ['armv7', 'armv7s'], 1463 '$(ARCHS_STANDARD)': ['armv7', 'armv7s'],
1458 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['armv7', 'armv7s', 'arm64'], 1464 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['armv7', 'armv7s', 'arm64'],
1459 } 1465 }
1460 else: 1466 else:
1461 return { 1467 return {
1462 '$(ARCHS_STANDARD)': ['i386'], 1468 '$(ARCHS_STANDARD)': ['i386'],
1463 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['i386', 'x86_64'], 1469 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['i386', 'x86_64'],
1464 } 1470 }
1471 else:
1472 if _IOSIsDeviceSDKROOT(sdkroot):
1473 return {
1474 '$(ARCHS_STANDARD)': ['armv7', 'armv7s', 'arm64'],
1475 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['armv7', 'armv7s', 'arm64'],
1476 }
1477 else:
1478 return {
1479 '$(ARCHS_STANDARD)': ['i386', 'x86_64'],
1480 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['i386', 'x86_64'],
1481 }
1465 1482
1466 1483
1467 def _FilterIOSArchitectureForSDKROOT(xcode_settings): 1484 def _FilterIOSArchitectureForSDKROOT(xcode_settings):
1468 """Filter the ARCHS value from the |xcode_settings| dictionary to only 1485 """Filter the ARCHS value from the |xcode_settings| dictionary to only
1469 contains architectures valid for the sdk configured in SDKROOT value.""" 1486 contains architectures valid for the sdk configured in SDKROOT value."""
1470 defaults_archs = _IOSDefaultArchForSDKRoot(xcode_settings.get('SDKROOT', '')) 1487 defaults_archs = _IOSDefaultArchForSDKRoot(xcode_settings.get('SDKROOT', ''))
1471 allowed_archs = set() 1488 allowed_archs = set()
1472 for archs in defaults_archs.itervalues(): 1489 for archs in defaults_archs.itervalues():
1473 allowed_archs.update(archs) 1490 allowed_archs.update(archs)
1474 selected_archs = set() 1491 selected_archs = set()
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 _FilterIOSArchitectureForSDKROOT(iphoneos_config_dict['xcode_settings']) 1524 _FilterIOSArchitectureForSDKROOT(iphoneos_config_dict['xcode_settings'])
1508 _FilterIOSArchitectureForSDKROOT(config_dict['xcode_settings']) 1525 _FilterIOSArchitectureForSDKROOT(config_dict['xcode_settings'])
1509 return targets 1526 return targets
1510 1527
1511 def CloneConfigurationForDeviceAndEmulator(target_dicts): 1528 def CloneConfigurationForDeviceAndEmulator(target_dicts):
1512 """If |target_dicts| contains any iOS targets, automatically create -iphoneos 1529 """If |target_dicts| contains any iOS targets, automatically create -iphoneos
1513 targets for iOS device builds.""" 1530 targets for iOS device builds."""
1514 if _HasIOSTarget(target_dicts): 1531 if _HasIOSTarget(target_dicts):
1515 return _AddIOSDeviceConfigurations(target_dicts) 1532 return _AddIOSDeviceConfigurations(target_dicts)
1516 return target_dicts 1533 return target_dicts
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698