• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3# found in the LICENSE file.
4
5{
6  'targets': [
7    {
8      # This creates a static library and puts it in a nonstandard location for
9      # libraries-search-path-test.
10      'target_name': 'mylib',
11      'type': 'static_library',
12      'standalone_static_library': 1,
13      # This directory is NOT in the default library search locations. It also
14      # MUST be passed in on the gyp command line:
15      #
16      #  -D abs_path_to_secret_library_location=/some_absolute_path
17      #
18      # The gyptest itself (../gyptest-library-dirs.py) provides this.
19      'product_dir': '<(abs_path_to_secret_library_location)',
20      'sources': [
21        'mylib.cc',
22      ],
23    },
24    {
25      'target_name': 'libraries-search-path-test',
26      'type': 'executable',
27      'dependencies': [
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,
30        # such that the link succeeds even without the library_dirs below.
31        #
32        # The point of this weird structuring is to ensure that 'library_dirs'
33        # works as advertised, such that just '-lmylib' (or its equivalent)
34        # works based on the directories that library_dirs puts in the library
35        # link path.
36        #
37        # If 'mylib' was listed as a proper dependency here, the build system
38        # would find it and link with its path on disk.
39        #
40        # Note that this implies 'mylib' must already be built when building
41        # 'libraries-search-path-test' (see ../gyptest-library-dirs.py).
42        #
43        #'mylib',
44      ],
45      'sources': [
46        'hello.cc',
47      ],
48      # Note that without this, the mylib library would not be found and
49      # successfully linked.
50      'library_dirs': [
51        '<(abs_path_to_secret_library_location)',
52      ],
53      'link_settings': {
54        'conditions': [
55          ['OS=="linux"', {
56            'libraries': [
57              '-lmylib',
58            ],
59          }, { # else
60            'libraries': [
61              '<(STATIC_LIB_PREFIX)mylib<(STATIC_LIB_SUFFIX)',
62            ],
63          }],
64        ],  # conditions
65      },
66    },
67  ],
68}
69