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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 def GetCflags(self, configname, arch=None): | 323 def GetCflags(self, configname, arch=None): |
324 """Returns flags that need to be added to .c, .cc, .m, and .mm | 324 """Returns flags that need to be added to .c, .cc, .m, and .mm |
325 compilations.""" | 325 compilations.""" |
326 # This functions (and the similar ones below) do not offer complete | 326 # This functions (and the similar ones below) do not offer complete |
327 # emulation of all xcode_settings keys. They're implemented on demand. | 327 # emulation of all xcode_settings keys. They're implemented on demand. |
328 | 328 |
329 self.configname = configname | 329 self.configname = configname |
330 cflags = [] | 330 cflags = [] |
331 | 331 |
332 sdk_root = self._SdkPath() | 332 sdk_root = self._SdkPath() |
333 if sdk_root: | 333 if 'SDKROOT' in self._Settings() and sdk_root: |
334 cflags.append('-isysroot %s' % sdk_root) | 334 cflags.append('-isysroot %s' % sdk_root) |
335 | 335 |
336 if self._Test('CLANG_WARN_CONSTANT_CONVERSION', 'YES', default='NO'): | 336 if self._Test('CLANG_WARN_CONSTANT_CONVERSION', 'YES', default='NO'): |
337 cflags.append('-Wconstant-conversion') | 337 cflags.append('-Wconstant-conversion') |
338 | 338 |
339 if self._Test('GCC_CHAR_IS_UNSIGNED_CHAR', 'YES', default='NO'): | 339 if self._Test('GCC_CHAR_IS_UNSIGNED_CHAR', 'YES', default='NO'): |
340 cflags.append('-funsigned-char') | 340 cflags.append('-funsigned-char') |
341 | 341 |
342 if self._Test('GCC_CW_ASM_SYNTAX', 'YES', default='YES'): | 342 if self._Test('GCC_CW_ASM_SYNTAX', 'YES', default='YES'): |
343 cflags.append('-fasm-blocks') | 343 cflags.append('-fasm-blocks') |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 if self._Test('PREBINDING', 'YES', default='NO'): | 632 if self._Test('PREBINDING', 'YES', default='NO'): |
633 ldflags.append('-Wl,-prebind') | 633 ldflags.append('-Wl,-prebind') |
634 | 634 |
635 self._Appendf( | 635 self._Appendf( |
636 ldflags, 'DYLIB_COMPATIBILITY_VERSION', '-compatibility_version %s') | 636 ldflags, 'DYLIB_COMPATIBILITY_VERSION', '-compatibility_version %s') |
637 self._Appendf( | 637 self._Appendf( |
638 ldflags, 'DYLIB_CURRENT_VERSION', '-current_version %s') | 638 ldflags, 'DYLIB_CURRENT_VERSION', '-current_version %s') |
639 | 639 |
640 self._AppendPlatformVersionMinFlags(ldflags) | 640 self._AppendPlatformVersionMinFlags(ldflags) |
641 | 641 |
642 if self._SdkPath(): | 642 if 'SDKROOT' in self._Settings() and self._SdkPath(): |
643 ldflags.append('-isysroot ' + self._SdkPath()) | 643 ldflags.append('-isysroot ' + self._SdkPath()) |
644 | 644 |
645 for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []): | 645 for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []): |
646 ldflags.append('-L' + gyp_to_build_path(library_path)) | 646 ldflags.append('-L' + gyp_to_build_path(library_path)) |
647 | 647 |
648 if 'ORDER_FILE' in self._Settings(): | 648 if 'ORDER_FILE' in self._Settings(): |
649 ldflags.append('-Wl,-order_file ' + | 649 ldflags.append('-Wl,-order_file ' + |
650 '-Wl,' + gyp_to_build_path( | 650 '-Wl,' + gyp_to_build_path( |
651 self._Settings()['ORDER_FILE'])) | 651 self._Settings()['ORDER_FILE'])) |
652 | 652 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
853 def _AdjustLibrary(self, library, config_name=None): | 853 def _AdjustLibrary(self, library, config_name=None): |
854 if library.endswith('.framework'): | 854 if library.endswith('.framework'): |
855 l = '-framework ' + os.path.splitext(os.path.basename(library))[0] | 855 l = '-framework ' + os.path.splitext(os.path.basename(library))[0] |
856 else: | 856 else: |
857 m = self.library_re.match(library) | 857 m = self.library_re.match(library) |
858 if m: | 858 if m: |
859 l = '-l' + m.group(1) | 859 l = '-l' + m.group(1) |
860 else: | 860 else: |
861 l = library | 861 l = library |
862 | 862 |
863 if self._SdkPath(): | 863 sdk_root = self._SdkPath(config_name) |
864 sdk_root = self._SdkPath(config_name) | 864 if not sdk_root: |
Nico
2013/12/24 19:16:21
`sdk_root is None` maybe?
| |
865 else: | |
866 sdk_root = '' | 865 sdk_root = '' |
867 return l.replace('$(SDKROOT)', sdk_root) | 866 return l.replace('$(SDKROOT)', sdk_root) |
868 | 867 |
869 def AdjustLibraries(self, libraries, config_name=None): | 868 def AdjustLibraries(self, libraries, config_name=None): |
870 """Transforms entries like 'Cocoa.framework' in libraries into entries like | 869 """Transforms entries like 'Cocoa.framework' in libraries into entries like |
871 '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc. | 870 '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc. |
872 """ | 871 """ |
873 libraries = [self._AdjustLibrary(library, config_name) | 872 libraries = [self._AdjustLibrary(library, config_name) |
874 for library in libraries] | 873 for library in libraries] |
875 return libraries | 874 return libraries |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1390 new_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' | 1389 new_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' |
1391 target_dict['configurations'][new_config_name] = new_config_dict | 1390 target_dict['configurations'][new_config_name] = new_config_dict |
1392 return targets | 1391 return targets |
1393 | 1392 |
1394 def CloneConfigurationForDeviceAndEmulator(target_dicts): | 1393 def CloneConfigurationForDeviceAndEmulator(target_dicts): |
1395 """If |target_dicts| contains any iOS targets, automatically create -iphoneos | 1394 """If |target_dicts| contains any iOS targets, automatically create -iphoneos |
1396 targets for iOS device builds.""" | 1395 targets for iOS device builds.""" |
1397 if _HasIOSTarget(target_dicts): | 1396 if _HasIOSTarget(target_dicts): |
1398 return _AddIOSDeviceConfigurations(target_dicts) | 1397 return _AddIOSDeviceConfigurations(target_dicts) |
1399 return target_dicts | 1398 return target_dicts |
OLD | NEW |