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

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

Issue 9382044: mac: Support ARCHS with zero or one element in the make and ninja generators. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 10 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 gyp.common 10 import gyp.common
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 if self._Test('GCC_TREAT_WARNINGS_AS_ERRORS', 'YES', default='NO'): 271 if self._Test('GCC_TREAT_WARNINGS_AS_ERRORS', 'YES', default='NO'):
272 cflags.append('-Werror') 272 cflags.append('-Werror')
273 273
274 if self._Test('GCC_WARN_ABOUT_MISSING_NEWLINE', 'YES', default='NO'): 274 if self._Test('GCC_WARN_ABOUT_MISSING_NEWLINE', 'YES', default='NO'):
275 cflags.append('-Wnewline-eof') 275 cflags.append('-Wnewline-eof')
276 276
277 self._Appendf(cflags, 'MACOSX_DEPLOYMENT_TARGET', '-mmacosx-version-min=%s') 277 self._Appendf(cflags, 'MACOSX_DEPLOYMENT_TARGET', '-mmacosx-version-min=%s')
278 278
279 # TODO: 279 # TODO:
280 self._WarnUnimplemented('ARCHS')
281 if self._Test('COPY_PHASE_STRIP', 'YES', default='NO'): 280 if self._Test('COPY_PHASE_STRIP', 'YES', default='NO'):
282 self._WarnUnimplemented('COPY_PHASE_STRIP') 281 self._WarnUnimplemented('COPY_PHASE_STRIP')
283 self._WarnUnimplemented('GCC_DEBUGGING_SYMBOLS') 282 self._WarnUnimplemented('GCC_DEBUGGING_SYMBOLS')
284 self._WarnUnimplemented('GCC_ENABLE_OBJC_EXCEPTIONS') 283 self._WarnUnimplemented('GCC_ENABLE_OBJC_EXCEPTIONS')
285 self._WarnUnimplemented('GCC_ENABLE_OBJC_GC') 284 self._WarnUnimplemented('GCC_ENABLE_OBJC_GC')
286 285
287 # TODO: This is exported correctly, but assigning to it is not supported. 286 # TODO: This is exported correctly, but assigning to it is not supported.
288 self._WarnUnimplemented('MACH_O_TYPE') 287 self._WarnUnimplemented('MACH_O_TYPE')
289 self._WarnUnimplemented('PRODUCT_TYPE') 288 self._WarnUnimplemented('PRODUCT_TYPE')
290 289
291 # TODO: Do not hardcode arch. Supporting fat binaries will be annoying. 290 archs = self._Settings().get('ARCHS', ['i386'])
292 # Even if self._Settings()['ARCHS'] contains only a single arch, dependent 291 if len(archs) == 0:
293 # targets might have been built with a different single arch. 292 pass
Nico 2012/02/13 06:09:07 I believe xcodebuild might default to i386 if ARCH
294 cflags.append('-arch i386') 293 elif len(archs) == 1:
294 cflags.append('-arch ' + archs[0])
Nico 2012/02/13 06:09:07 What if you have this setup: { 'targets': [ {
295 else:
296 # TODO: Supporting fat binaries will be annoying.
297 self._WarnUnimplemented('ARCHS')
298 cflags.append('-arch i386')
295 299
296 cflags += self._Settings().get('OTHER_CFLAGS', []) 300 cflags += self._Settings().get('OTHER_CFLAGS', [])
297 cflags += self._Settings().get('WARNING_CFLAGS', []) 301 cflags += self._Settings().get('WARNING_CFLAGS', [])
298 302
299 config = self.spec['configurations'][self.configname] 303 config = self.spec['configurations'][self.configname]
300 framework_dirs = config.get('mac_framework_dirs', []) 304 framework_dirs = config.get('mac_framework_dirs', [])
301 for directory in framework_dirs: 305 for directory in framework_dirs:
302 cflags.append('-F ' + directory.replace('$(SDKROOT)', sdk_root)) 306 cflags.append('-F ' + directory.replace('$(SDKROOT)', sdk_root))
303 307
304 self.configname = None 308 self.configname = None
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 ldflags.append('-isysroot ' + self._SdkPath()) 390 ldflags.append('-isysroot ' + self._SdkPath())
387 391
388 for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []): 392 for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []):
389 ldflags.append('-L' + gyp_to_build_path(library_path)) 393 ldflags.append('-L' + gyp_to_build_path(library_path))
390 394
391 if 'ORDER_FILE' in self._Settings(): 395 if 'ORDER_FILE' in self._Settings():
392 ldflags.append('-Wl,-order_file ' + 396 ldflags.append('-Wl,-order_file ' +
393 '-Wl,' + gyp_to_build_path( 397 '-Wl,' + gyp_to_build_path(
394 self._Settings()['ORDER_FILE'])) 398 self._Settings()['ORDER_FILE']))
395 399
396 # TODO: Do not hardcode arch. Supporting fat binaries will be annoying. 400 archs = self._Settings().get('ARCHS', ['i386'])
397 ldflags.append('-arch i386') 401 if len(archs) == 0:
402 pass
403 elif len(archs) == 1:
404 ldflags.append('-arch ' + archs[0])
405 else:
406 # TODO: Supporting fat binaries will be annoying.
407 self._WarnUnimplemented('ARCHS')
408 ldflags.append('-arch i386')
398 409
399 # Xcode adds the product directory by default. 410 # Xcode adds the product directory by default.
400 ldflags.append('-L' + product_dir) 411 ldflags.append('-L' + product_dir)
401 412
402 install_name = self.GetPerTargetSetting('LD_DYLIB_INSTALL_NAME') 413 install_name = self.GetPerTargetSetting('LD_DYLIB_INSTALL_NAME')
403 install_base = self.GetPerTargetSetting('DYLIB_INSTALL_NAME_BASE') 414 install_base = self.GetPerTargetSetting('DYLIB_INSTALL_NAME_BASE')
404 default_install_name = \ 415 default_install_name = \
405 '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)' 416 '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)'
406 if not install_name and install_base: 417 if not install_name and install_base:
407 install_name = default_install_name 418 install_name = default_install_name
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 # absolutified. Else, it's in the PATH (e.g. install_name_tool, ln). 958 # absolutified. Else, it's in the PATH (e.g. install_name_tool, ln).
948 if os.path.sep in shell_list[0]: 959 if os.path.sep in shell_list[0]:
949 shell_list[0] = gyp_path_to_build_path(shell_list[0]) 960 shell_list[0] = gyp_path_to_build_path(shell_list[0])
950 961
951 # "script.sh" -> "./script.sh" 962 # "script.sh" -> "./script.sh"
952 if not os.path.sep in shell_list[0]: 963 if not os.path.sep in shell_list[0]:
953 shell_list[0] = os.path.join('.', shell_list[0]) 964 shell_list[0] = os.path.join('.', shell_list[0])
954 postbuilds.append(gyp.common.EncodePOSIXShellList(shell_list)) 965 postbuilds.append(gyp.common.EncodePOSIXShellList(shell_list))
955 966
956 return postbuilds 967 return postbuilds
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