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

Unified Diff: pylib/gyp/xcode_emulation.py

Issue 9254033: xcode emulation for make: Adjust .a and .dylib entries in 'libraries'. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: '' Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | test/mac/gyptest-libraries.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/xcode_emulation.py
===================================================================
--- pylib/gyp/xcode_emulation.py (revision 1170)
+++ pylib/gyp/xcode_emulation.py (working copy)
@@ -29,6 +29,9 @@
# This is only non-None temporarily during the execution of some methods.
self.configname = None
+ # Used by _AdjustLibrary to match .a and .dylib entries in libraries.
+ self.library_re = re.compile(r'^lib([^/]+)\.(a|dylib)$')
+
def _Settings(self):
assert self.configname
return self.xcode_settings[self.configname]
@@ -380,7 +383,7 @@
ldflags.append('-isysroot ' + self._SdkPath())
for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []):
- ldflags.append('-L' + library_path)
+ ldflags.append('-L' + gyp_to_build_path(library_path))
Nico 2012/01/20 17:44:07 Can you add a test for this, too? (That's not a qu
viettrungluu 2012/01/21 00:15:20 I added a test for LIBRARY_SEARCH_PATHS, but it do
Nico 2012/01/21 00:18:15 Add a 'static_library' target, then from the test
if 'ORDER_FILE' in self._Settings():
ldflags.append('-Wl,-order_file ' +
@@ -531,16 +534,22 @@
return (self._GetDebugPostbuilds(configname, output, output_binary) +
self._GetStripPostbuilds(configname, output_binary))
- def AdjustFrameworkLibraries(self, libraries):
+ def _AdjustLibrary(self, library):
+ if library.endswith('.framework'):
+ l = '-framework ' + os.path.splitext(os.path.basename(library))[0]
+ else:
+ m = self.library_re.match(library)
+ if m:
+ l = '-l' + m.group(1)
+ else:
+ l = library
+ return l.replace('$(SDKROOT)', self._SdkPath())
+
+ def AdjustLibraries(self, libraries):
"""Transforms entries like 'Cocoa.framework' in libraries into entries like
- '-framework Cocoa'.
+ '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc.
"""
- libraries = [
- '-framework ' + os.path.splitext(os.path.basename(library))[0]
- if library.endswith('.framework') else library
- for library in libraries]
- libraries = [library.replace('$(SDKROOT)', self._SdkPath())
- for library in libraries]
+ libraries = [ self._AdjustLibrary(library) for library in libraries]
Nico 2012/01/20 17:44:07 I like this, but linux doesn't do it. Should we be
viettrungluu 2012/01/21 00:15:20 No .gyp file for Linux currently relies on this. T
return libraries
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | test/mac/gyptest-libraries.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698