blob: 57271c8bcda3453515a055c33d05c472ca458dc8 [file] [log] [blame]
[email protected]11e67072012-11-17 14:20:291# Copyright 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 # schema_file: a json file that comprise the structure model.
9 # namespace: the C++ namespace that all generated files go under
10 # cc_dir: path to generated files
11 # Functions and namespaces can be excluded by setting "nocompile" to true.
12 'struct_gen_dir': '<(DEPTH)/tools/json_to_struct',
13 'struct_gen': '<(struct_gen_dir)/json_to_struct.py',
14 },
15 'rules': [
16 {
[email protected]c06b8442014-07-16 17:50:5117 # GN version: //tools/json_to_struct/json_to_struct.gni
[email protected]11e67072012-11-17 14:20:2918 'rule_name': 'genstaticinit',
19 'extension': 'json',
20 'inputs': [
21 '<(struct_gen_dir)/element_generator.py',
22 '<(struct_gen_dir)/json_to_struct.py',
23 '<(struct_gen_dir)/struct_generator.py',
24 '<(schema_file)',
25 ],
26 'outputs': [
27 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).cc',
28 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).h',
29 ],
30 'action': [
31 'python',
32 '<(struct_gen)',
33 '<(RULE_INPUT_PATH)',
34 '--destbase=<(SHARED_INTERMEDIATE_DIR)',
35 '--destdir=<(cc_dir)',
36 '--namespace=<(namespace)',
37 '--schema=<(schema_file)',
38 ],
39 'message': 'Generating C++ static initializers from <(RULE_INPUT_PATH)',
40 'process_outputs_as_sources': 1,
41 },
42 ],
43 'include_dirs': [
44 '<(SHARED_INTERMEDIATE_DIR)',
45 '<(DEPTH)',
46 ],
47 # This target exports a hard dependency because it generates header
48 # files.
49 'hard_dependency': 1,
50}