blob: 940e65cf3c9f6d7d32ab2b3c66000f9afca26df6 [file] [log] [blame]
[email protected]15f08dd2012-01-27 07:29:481# 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{
6 'variables': {
7 # When including this gypi, the following variables must be set:
8 # json_schema_files: an array of json files that comprise the api model.
9 # cc_dir: path to generated files
10 # root_namespace: the C++ namespace that all generated files go under
11 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler',
12 'api_gen': '<(api_gen_dir)/compiler.py',
13 },
14 'rules': [
15 {
16 'rule_name': 'genapi',
17 'extension': 'json',
18 'inputs': [
19 '<(api_gen_dir)/code.py',
20 '<(api_gen_dir)/compiler.py',
21 '<(api_gen_dir)/model.py',
22 '<(api_gen_dir)/cc_generator.py',
23 '<(api_gen_dir)/h_generator.py',
24 '<(api_gen_dir)/cpp_type_generator.py',
25 '<@(json_schema_files)',
26 ],
27 'outputs': [
28 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).cc',
29 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).h',
30 ],
31 'action': [
32 'python',
33 '<(api_gen)',
34 '<(RULE_INPUT_PATH)',
35 '--root=<(DEPTH)',
36 '--destdir=<(SHARED_INTERMEDIATE_DIR)',
37 '--namespace=<(root_namespace)',
38 '<@(json_schema_files)',
39 ],
40 'message': 'Generating C++ code from <(RULE_INPUT_PATH) jsons',
41 'process_outputs_as_sources': 1,
42 },
43 ],
44 'include_dirs': [
45 '<(SHARED_INTERMEDIATE_DIR)',
46 '<(DEPTH)',
47 ],
48 'dependencies':[
49 '<(DEPTH)/tools/json_schema_compiler/api_gen_util.gyp:api_gen_util',
50 ],
51 'direct_dependent_settings': {
52 'include_dirs': [
53 '<(SHARED_INTERMEDIATE_DIR)',
54 ]
55 },
56 # This target exports a hard dependency because it generates header
57 # files.
58 'hard_dependency': 1,
59}