OLD | NEW |
---|---|
1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 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 'targets': [ | 6 'targets': [ |
7 { | 7 { |
8 # This creates a static library and puts it in a nonstandard location for | 8 # This creates a static library and puts it in a nonstandard location for |
9 # libraries-search-path-test. | 9 # libraries-search-path-test. |
10 'target_name': 'mylib', | 10 'target_name': 'mylib', |
11 'type': 'static_library', | 11 'type': 'static_library', |
12 'standalone_static_library': 1, | 12 'standalone_static_library': 1, |
13 # This directory is NOT in the default library search locations. It also | 13 # This directory is NOT in the default library search locations. It also |
14 # MUST be passed in on the gyp command line: | 14 # MUST be passed in on the gyp command line: |
15 # | 15 # |
16 # -D abs_path_to_secret_library_location=/some_absolute_path | 16 # -D abs_path_to_secret_library_location=/some_absolute_path |
17 # | 17 # |
18 # The gyptest itself (../gyptest-library-dirs.py) provides this. | 18 # The gyptest itself (../gyptest-library-dirs.py) provides this. |
19 'product_dir': '<(abs_path_to_secret_library_location)', | 19 'product_dir': '<(abs_path_to_secret_library_location)', |
20 'sources': [ | 20 'sources': [ |
21 'mylib.cc', | 21 'mylib.cc', |
22 ], | 22 ], |
23 }, | 23 }, |
24 { | 24 { |
25 'target_name': 'libraries-search-path-test', | 25 'target_name': 'libraries-search-path-test-lib-suffix', |
26 'type': 'executable', | 26 'type': 'executable', |
27 'dependencies': [ | 27 'dependencies': [ |
28 # It is important to NOT list the mylib as a dependency here, because | 28 # It is important to NOT list the mylib as a dependency here, because |
29 # some build systems will track it down based on its product_dir, | 29 # some build systems will track it down based on its product_dir, |
30 # such that the link succeeds even without the library_dirs below. | 30 # such that the link succeeds even without the library_dirs below. |
31 # | 31 # |
32 # The point of this weird structuring is to ensure that 'library_dirs' | 32 # The point of this weird structuring is to ensure that 'library_dirs' |
33 # works as advertised, such that just '-lmylib' (or its equivalent) | 33 # works as advertised, such that just '-lmylib' (or its equivalent) |
34 # works based on the directories that library_dirs puts in the library | 34 # works based on the directories that library_dirs puts in the library |
35 # link path. | 35 # link path. |
36 # | 36 # |
37 # If 'mylib' was listed as a proper dependency here, the build system | 37 # If 'mylib' was listed as a proper dependency here, the build system |
38 # would find it and link with its path on disk. | 38 # would find it and link with its path on disk. |
39 # | 39 # |
40 # Note that this implies 'mylib' must already be built when building | 40 # Note that this implies 'mylib' must already be built when building |
41 # 'libraries-search-path-test' (see ../gyptest-library-dirs.py). | 41 # 'libraries-search-path-test' (see ../gyptest-library-dirs.py). |
42 # | 42 # |
43 #'mylib', | 43 #'mylib', |
44 ], | 44 ], |
45 'sources': [ | 45 'sources': [ |
46 'hello.cc', | 46 'hello.cc', |
47 ], | 47 ], |
48 # Note that without this, the mylib library would not be found and | 48 # Note that without this, the mylib library would not be found and |
49 # successfully linked. | 49 # successfully linked. |
50 'library_dirs': [ | 50 'library_dirs': [ |
51 '<(abs_path_to_secret_library_location)', | 51 '<(abs_path_to_secret_library_location)', |
52 ], | 52 ], |
53 'link_settings': { | 53 'link_settings': { |
54 'conditions': [ | 54 'conditions': [ |
55 ['OS=="linux"', { | 55 ['OS=="win"', { |
56 'libraries': [ | |
57 '-lmylib.lib', | |
58 ], | |
59 }, { # else | |
56 'libraries': [ | 60 'libraries': [ |
scottmg
2013/09/27 20:38:47
delete this branch condition?
ericvw
2013/09/27 21:48:02
I did this originally in the event it did get run
| |
57 '-lmylib', | 61 '-lmylib', |
58 ], | 62 ], |
59 }, { # else | 63 }] |
60 'libraries': [ | |
61 '<(STATIC_LIB_PREFIX)mylib<(STATIC_LIB_SUFFIX)', | |
62 ], | |
63 }], | |
64 ], # conditions | 64 ], # conditions |
65 }, | 65 }, |
66 }, | 66 }, |
67 ], | 67 ], |
68 } | 68 } |
OLD | NEW |