Chromium Code Reviews| Index: test/library_dirs/subdir/test.gyp |
| =================================================================== |
| --- test/library_dirs/subdir/test.gyp (revision 0) |
| +++ test/library_dirs/subdir/test.gyp (revision 0) |
| @@ -0,0 +1,56 @@ |
| +# Copyright (c) 2012 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', |
| + 'type': 'executable', |
| + 'dependencies': [ |
| + # It is important to NOT list the mylib as a dependency here, because |
|
Mark Mentovai
2013/05/29 13:23:07
I don’t see how any build system would ensure that
Dimi Shahbaz
2013/05/29 21:32:41
That's the point of the weird structuring of this
|
| + # some build systems will track it down based on its product_dir, |
| + # such that the link succeeds even without the library_dirs below. |
| + #'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': { |
| + 'conditions': [ |
| + ['OS=="linux"', { |
| + 'libraries': [ |
| + '-lmylib', |
| + ], |
| + }, { # else |
| + 'libraries': [ |
| + '<(STATIC_LIB_PREFIX)mylib<(STATIC_LIB_SUFFIX)', |
| + ], |
| + }], |
| + ], # conditions |
| + }, |
| + }, |
| + ], |
| +} |