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 gyp.common | 10 import gyp.common |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if self._Test('GCC_WARN_ABOUT_MISSING_NEWLINE', 'YES', default='NO'): | 299 if self._Test('GCC_WARN_ABOUT_MISSING_NEWLINE', 'YES', default='NO'): |
300 cflags.append('-Wnewline-eof') | 300 cflags.append('-Wnewline-eof') |
301 | 301 |
302 self._Appendf(cflags, 'MACOSX_DEPLOYMENT_TARGET', '-mmacosx-version-min=%s') | 302 self._Appendf(cflags, 'MACOSX_DEPLOYMENT_TARGET', '-mmacosx-version-min=%s') |
303 | 303 |
304 # TODO: | 304 # TODO: |
305 if self._Test('COPY_PHASE_STRIP', 'YES', default='NO'): | 305 if self._Test('COPY_PHASE_STRIP', 'YES', default='NO'): |
306 self._WarnUnimplemented('COPY_PHASE_STRIP') | 306 self._WarnUnimplemented('COPY_PHASE_STRIP') |
307 self._WarnUnimplemented('GCC_DEBUGGING_SYMBOLS') | 307 self._WarnUnimplemented('GCC_DEBUGGING_SYMBOLS') |
308 self._WarnUnimplemented('GCC_ENABLE_OBJC_EXCEPTIONS') | 308 self._WarnUnimplemented('GCC_ENABLE_OBJC_EXCEPTIONS') |
309 self._WarnUnimplemented('GCC_ENABLE_OBJC_GC') | |
310 | 309 |
311 # TODO: This is exported correctly, but assigning to it is not supported. | 310 # TODO: This is exported correctly, but assigning to it is not supported. |
312 self._WarnUnimplemented('MACH_O_TYPE') | 311 self._WarnUnimplemented('MACH_O_TYPE') |
313 self._WarnUnimplemented('PRODUCT_TYPE') | 312 self._WarnUnimplemented('PRODUCT_TYPE') |
314 | 313 |
315 archs = self._Settings().get('ARCHS', ['i386']) | 314 archs = self._Settings().get('ARCHS', ['i386']) |
316 if len(archs) != 1: | 315 if len(archs) != 1: |
317 # TODO: Supporting fat binaries will be annoying. | 316 # TODO: Supporting fat binaries will be annoying. |
318 self._WarnUnimplemented('ARCHS') | 317 self._WarnUnimplemented('ARCHS') |
319 archs = ['i386'] | 318 archs = ['i386'] |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 flag = '$OTHER_CFLAGS' | 369 flag = '$OTHER_CFLAGS' |
371 if flag in ('$OTHER_CFLAGS', '$(OTHER_CFLAGS)', '${OTHER_CFLAGS}'): | 370 if flag in ('$OTHER_CFLAGS', '$(OTHER_CFLAGS)', '${OTHER_CFLAGS}'): |
372 other_ccflags += self._Settings().get('OTHER_CFLAGS', []) | 371 other_ccflags += self._Settings().get('OTHER_CFLAGS', []) |
373 else: | 372 else: |
374 other_ccflags.append(flag) | 373 other_ccflags.append(flag) |
375 cflags_cc += other_ccflags | 374 cflags_cc += other_ccflags |
376 | 375 |
377 self.configname = None | 376 self.configname = None |
378 return cflags_cc | 377 return cflags_cc |
379 | 378 |
| 379 def _AddObjectiveCGarbageCollectionFlags(self, flags): |
| 380 gc_policy = self._Settings().get('GCC_ENABLE_OBJC_GC', 'unsupported') |
| 381 if gc_policy == 'supported': |
| 382 flags.append('-fobjc-gc') |
| 383 elif gc_policy == 'required': |
| 384 flags.append('-fobjc-gc-only') |
| 385 |
380 def GetCflagsObjC(self, configname): | 386 def GetCflagsObjC(self, configname): |
381 """Returns flags that need to be added to .m compilations.""" | 387 """Returns flags that need to be added to .m compilations.""" |
382 self.configname = configname | 388 self.configname = configname |
| 389 cflags_objc = [] |
| 390 |
| 391 self._AddObjectiveCGarbageCollectionFlags(cflags_objc) |
| 392 |
383 self.configname = None | 393 self.configname = None |
384 return [] | 394 return cflags_objc |
385 | 395 |
386 def GetCflagsObjCC(self, configname): | 396 def GetCflagsObjCC(self, configname): |
387 """Returns flags that need to be added to .mm compilations.""" | 397 """Returns flags that need to be added to .mm compilations.""" |
388 self.configname = configname | 398 self.configname = configname |
389 cflags_objcc = [] | 399 cflags_objcc = [] |
| 400 self._AddObjectiveCGarbageCollectionFlags(cflags_objcc) |
390 if self._Test('GCC_OBJC_CALL_CXX_CDTORS', 'YES', default='NO'): | 401 if self._Test('GCC_OBJC_CALL_CXX_CDTORS', 'YES', default='NO'): |
391 cflags_objcc.append('-fobjc-call-cxx-cdtors') | 402 cflags_objcc.append('-fobjc-call-cxx-cdtors') |
392 self.configname = None | 403 self.configname = None |
393 return cflags_objcc | 404 return cflags_objcc |
394 | 405 |
395 def GetInstallNameBase(self): | 406 def GetInstallNameBase(self): |
396 """Return DYLIB_INSTALL_NAME_BASE for this target.""" | 407 """Return DYLIB_INSTALL_NAME_BASE for this target.""" |
397 # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. | 408 # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. |
398 if (self.spec['type'] != 'shared_library' and | 409 if (self.spec['type'] != 'shared_library' and |
399 (self.spec['type'] != 'loadable_module' or self._IsBundle())): | 410 (self.spec['type'] != 'loadable_module' or self._IsBundle())): |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 def GetSpecPostbuildCommands(spec, quiet=False): | 1019 def GetSpecPostbuildCommands(spec, quiet=False): |
1009 """Returns the list of postbuilds explicitly defined on |spec|, in a form | 1020 """Returns the list of postbuilds explicitly defined on |spec|, in a form |
1010 executable by a shell.""" | 1021 executable by a shell.""" |
1011 postbuilds = [] | 1022 postbuilds = [] |
1012 for postbuild in spec.get('postbuilds', []): | 1023 for postbuild in spec.get('postbuilds', []): |
1013 if not quiet: | 1024 if not quiet: |
1014 postbuilds.append('echo POSTBUILD\\(%s\\) %s' % ( | 1025 postbuilds.append('echo POSTBUILD\\(%s\\) %s' % ( |
1015 spec['target_name'], postbuild['postbuild_name'])) | 1026 spec['target_name'], postbuild['postbuild_name'])) |
1016 postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild['action'])) | 1027 postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild['action'])) |
1017 return postbuilds | 1028 return postbuilds |
OLD | NEW |