| OLD | NEW |
| 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 Loading... |
| 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: | |
| 960 return 'i386' | |
| 961 version, build = XcodeVersion() | 965 version, build = XcodeVersion() |
| 962 if version >= '0500': | 966 if version >= '0500': |
| 963 return 'x86_64' | 967 return 'x86_64' |
| 964 return 'i386' | 968 return 'i386' |
| 965 | 969 |
| 966 class MacPrefixHeader(object): | 970 class MacPrefixHeader(object): |
| 967 """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature. | 971 """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature. |
| 968 | 972 |
| 969 This feature consists of several pieces: | 973 This feature consists of several pieces: |
| 970 * If GCC_PREFIX_HEADER is present, all compilations in that project get an | 974 * 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 Loading... |
| 1444 def _IOSDefaultArchForSDKRoot(sdkroot): | 1448 def _IOSDefaultArchForSDKRoot(sdkroot): |
| 1445 """Returns the expansion of standard ARCHS macro depending on the version | 1449 """Returns the expansion of standard ARCHS macro depending on the version |
| 1446 of Xcode installed and configured, and which |sdkroot| to use (iphoneos or | 1450 of Xcode installed and configured, and which |sdkroot| to use (iphoneos or |
| 1447 simulator).""" | 1451 simulator).""" |
| 1448 xcode_version, xcode_build = XcodeVersion() | 1452 xcode_version, xcode_build = XcodeVersion() |
| 1449 if xcode_version < '0500': | 1453 if xcode_version < '0500': |
| 1450 if _IOSIsDeviceSDKROOT(sdkroot): | 1454 if _IOSIsDeviceSDKROOT(sdkroot): |
| 1451 return {'$(ARCHS_STANDARD)': ['armv7']} | 1455 return {'$(ARCHS_STANDARD)': ['armv7']} |
| 1452 else: | 1456 else: |
| 1453 return {'$(ARCHS_STANDARD)': ['i386']} | 1457 return {'$(ARCHS_STANDARD)': ['i386']} |
| 1454 else: | 1458 elif xcode_version < '0510': |
| 1455 if _IOSIsDeviceSDKROOT(sdkroot): | 1459 if _IOSIsDeviceSDKROOT(sdkroot): |
| 1456 return { | 1460 return { |
| 1457 '$(ARCHS_STANDARD)': ['armv7', 'armv7s'], | 1461 '$(ARCHS_STANDARD)': ['armv7', 'armv7s'], |
| 1458 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['armv7', 'armv7s', 'arm64'], | 1462 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['armv7', 'armv7s', 'arm64'], |
| 1459 } | 1463 } |
| 1460 else: | 1464 else: |
| 1461 return { | 1465 return { |
| 1462 '$(ARCHS_STANDARD)': ['i386'], | 1466 '$(ARCHS_STANDARD)': ['i386'], |
| 1463 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['i386', 'x86_64'], | 1467 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['i386', 'x86_64'], |
| 1464 } | 1468 } |
| 1469 else: |
| 1470 if _IOSIsDeviceSDKROOT(sdkroot): |
| 1471 return { |
| 1472 '$(ARCHS_STANDARD)': ['armv7', 'armv7s', 'arm64'], |
| 1473 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['armv7', 'armv7s', 'arm64'], |
| 1474 } |
| 1475 else: |
| 1476 return { |
| 1477 '$(ARCHS_STANDARD)': ['i386', 'x86_64'], |
| 1478 '$(ARCHS_STANDARD_INCLUDING_64_BIT)': ['i386', 'x86_64'], |
| 1479 } |
| 1465 | 1480 |
| 1466 | 1481 |
| 1467 def _FilterIOSArchitectureForSDKROOT(xcode_settings): | 1482 def _FilterIOSArchitectureForSDKROOT(xcode_settings): |
| 1468 """Filter the ARCHS value from the |xcode_settings| dictionary to only | 1483 """Filter the ARCHS value from the |xcode_settings| dictionary to only |
| 1469 contains architectures valid for the sdk configured in SDKROOT value.""" | 1484 contains architectures valid for the sdk configured in SDKROOT value.""" |
| 1470 defaults_archs = _IOSDefaultArchForSDKRoot(xcode_settings.get('SDKROOT', '')) | 1485 defaults_archs = _IOSDefaultArchForSDKRoot(xcode_settings.get('SDKROOT', '')) |
| 1471 allowed_archs = set() | 1486 allowed_archs = set() |
| 1472 for archs in defaults_archs.itervalues(): | 1487 for archs in defaults_archs.itervalues(): |
| 1473 allowed_archs.update(archs) | 1488 allowed_archs.update(archs) |
| 1474 selected_archs = set() | 1489 selected_archs = set() |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 _FilterIOSArchitectureForSDKROOT(iphoneos_config_dict['xcode_settings']) | 1522 _FilterIOSArchitectureForSDKROOT(iphoneos_config_dict['xcode_settings']) |
| 1508 _FilterIOSArchitectureForSDKROOT(config_dict['xcode_settings']) | 1523 _FilterIOSArchitectureForSDKROOT(config_dict['xcode_settings']) |
| 1509 return targets | 1524 return targets |
| 1510 | 1525 |
| 1511 def CloneConfigurationForDeviceAndEmulator(target_dicts): | 1526 def CloneConfigurationForDeviceAndEmulator(target_dicts): |
| 1512 """If |target_dicts| contains any iOS targets, automatically create -iphoneos | 1527 """If |target_dicts| contains any iOS targets, automatically create -iphoneos |
| 1513 targets for iOS device builds.""" | 1528 targets for iOS device builds.""" |
| 1514 if _HasIOSTarget(target_dicts): | 1529 if _HasIOSTarget(target_dicts): |
| 1515 return _AddIOSDeviceConfigurations(target_dicts) | 1530 return _AddIOSDeviceConfigurations(target_dicts) |
| 1516 return target_dicts | 1531 return target_dicts |
| OLD | NEW |