Revert homogenize msvs and ninja library_dir and libraries settings for
Review URL: https://codereview.chromium.org/25594002
git-svn-id: http://gyp.googlecode.com/svn/trunk@1744 78cadc50-ecff-11dd-a971-7dbc132099af
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
index 6a7bb8d..33b2825 100644
--- a/pylib/gyp/generator/ninja.py
+++ b/pylib/gyp/generator/ninja.py
@@ -1055,8 +1055,8 @@
if self.flavor == 'win':
library_dirs = [self.msvs_settings.ConvertVSMacros(l, config_name)
for l in library_dirs]
- library_dirs = ['/LIBPATH:' + QuoteShellArgument(self.GypPathToNinja(l),
- self.flavor)
+ library_dirs = [QuoteShellArgument('-LIBPATH:' + self.GypPathToNinja(l),
+ self.flavor)
for l in library_dirs]
else:
library_dirs = [QuoteShellArgument('-L' + self.GypPathToNinja(l),
diff --git a/pylib/gyp/msvs_emulation.py b/pylib/gyp/msvs_emulation.py
index 25f351b..3c9fe50 100644
--- a/pylib/gyp/msvs_emulation.py
+++ b/pylib/gyp/msvs_emulation.py
@@ -202,8 +202,7 @@
def AdjustLibraries(self, libraries):
"""Strip -l from library if it's specified with that."""
- libs = [lib[2:] if lib.startswith('-l') else lib for lib in libraries]
- return [lib + '.lib' if not lib.endswith('.lib') else lib for lib in libs]
+ return [lib[2:] if lib.startswith('-l') else lib for lib in libraries]
def _GetAndMunge(self, field, path, default, prefix, append, map):
"""Retrieve a value from |field| at |path| or return |default|. If
diff --git a/test/library_dirs/gyptest-library-dirs.py b/test/library_dirs/gyptest-library-dirs.py
index 5edd6e7..a201d59 100644
--- a/test/library_dirs/gyptest-library-dirs.py
+++ b/test/library_dirs/gyptest-library-dirs.py
@@ -8,8 +8,6 @@
Verifies library_dirs (in link_settings) are properly found.
"""
-import sys
-
import TestGyp
test = TestGyp.TestGyp(formats=['!android'])
@@ -31,20 +29,5 @@
test.run_built_executable(
'libraries-search-path-test', chdir='subdir', stdout=expect)
-if sys.platform in ('win32', 'cygwin'):
- test.run_gyp('test-win.gyp',
- '-D',
- 'abs_path_to_secret_library_location={0}'.format(lib_dir),
- chdir='subdir')
-
- test.build('test.gyp', 'mylib', chdir='subdir')
- test.build('test-win.gyp',
- 'libraries-search-path-test-lib-suffix',
- chdir='subdir')
-
- test.run_built_executable(
- 'libraries-search-path-test-lib-suffix', chdir='subdir', stdout=expect)
-
-
test.pass_test()
test.cleanup()
diff --git a/test/library_dirs/subdir/test-win.gyp b/test/library_dirs/subdir/test-win.gyp
deleted file mode 100644
index 033b6f7..0000000
--- a/test/library_dirs/subdir/test-win.gyp
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright (c) 2013 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'targets': [
- {
- # This creates a static library and puts it in a nonstandard location for
- # libraries-search-path-test.
- 'target_name': 'mylib',
- 'type': 'static_library',
- 'standalone_static_library': 1,
- # This directory is NOT in the default library search locations. It also
- # MUST be passed in on the gyp command line:
- #
- # -D abs_path_to_secret_library_location=/some_absolute_path
- #
- # The gyptest itself (../gyptest-library-dirs.py) provides this.
- 'product_dir': '<(abs_path_to_secret_library_location)',
- 'sources': [
- 'mylib.cc',
- ],
- },
- {
- 'target_name': 'libraries-search-path-test-lib-suffix',
- 'type': 'executable',
- 'dependencies': [
- # It is important to NOT list the mylib as a dependency here, because
- # some build systems will track it down based on its product_dir,
- # such that the link succeeds even without the library_dirs below.
- #
- # The point of this weird structuring is to ensure that 'library_dirs'
- # works as advertised, such that just '-lmylib' (or its equivalent)
- # works based on the directories that library_dirs puts in the library
- # link path.
- #
- # If 'mylib' was listed as a proper dependency here, the build system
- # would find it and link with its path on disk.
- #
- # Note that this implies 'mylib' must already be built when building
- # 'libraries-search-path-test' (see ../gyptest-library-dirs.py).
- #
- #'mylib',
- ],
- 'sources': [
- 'hello.cc',
- ],
- # Note that without this, the mylib library would not be found and
- # successfully linked.
- 'library_dirs': [
- '<(abs_path_to_secret_library_location)',
- ],
- 'link_settings': {
- 'libraries': [
- '-lmylib.lib',
- ],
- },
- },
- ],
-}
diff --git a/test/library_dirs/subdir/test.gyp b/test/library_dirs/subdir/test.gyp
index 127dd54..f83d7f2 100644
--- a/test/library_dirs/subdir/test.gyp
+++ b/test/library_dirs/subdir/test.gyp
@@ -51,9 +51,17 @@
'<(abs_path_to_secret_library_location)',
],
'link_settings': {
- 'libraries': [
- '-lmylib',
- ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'libraries': [
+ '-lmylib',
+ ],
+ }, { # else
+ 'libraries': [
+ '<(STATIC_LIB_PREFIX)mylib<(STATIC_LIB_SUFFIX)',
+ ],
+ }],
+ ], # conditions
},
},
],