1# Copyright (c) 2012 The Chromium Authors. 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# This file is meant to be included into a target to provide a rule
6# to create import libraries from an import description file in a consistent
7# manner.
8#
9# To use this, create a gyp target with the following form:
10# {
11#   'target_name': 'my_proto_lib',
12#   'type': 'none',
13#   'sources': [
14#     'foo.imports',
15#     'bar.imports',
16#   ],
17#   'variables': {
18#     # Optional, see below: 'proto_in_dir': '.'
19#     'create_importlib': 'path-to-script',
20#     'lib_dir': 'path-to-output-directory',
21#   },
22#   'includes': ['path/to/this/gypi/file'],
23# }
24#
25# This will generate import libraries named 'foo.lib' and 'bar.lib' in the
26# specified lib directory.
27
28{
29  'variables': {
30    'create_importlib': '<(DEPTH)/build/win/importlibs/create_importlib_win.py',
31    'lib_dir': '<(PRODUCT_DIR)/lib',
32  },
33  'rules': [
34    {
35      'rule_name': 'create_import_lib',
36      'extension': 'imports',
37      'inputs': [
38        '<(create_importlib)',
39      ],
40      'outputs': [
41        '<(lib_dir)/<(RULE_INPUT_ROOT).lib',
42      ],
43      'action': [
44        'python',
45        '<(create_importlib)',
46        '--output-file', '<@(_outputs)',
47        '<(RULE_INPUT_PATH)',
48      ],
49      'message': 'Generating import library from <(RULE_INPUT_PATH)',
50      'process_outputs_as_sources': 0,
51    },
52  ],
53}
54