blob: 6e5727a6ba4b4491d3303dba67233b0919d8fc8b [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:
[email protected]8d368d62014-08-05 08:02:068 # schema_files:
9 # An array of json or idl files that comprise the api model.
lfg8a1bee32014-08-29 03:56:2810 # schema_include_rules (optional):
11 # An array of paths to include when searching for referenced objects,
12 # with the namespace separated by a :.
13 # Example:
14 # [ '/foo/bar:Foo::Bar::%(namespace)s' ]
[email protected]8d368d62014-08-05 08:02:0615 # cc_dir:
16 # The directory to put the generated code in.
17 # root_namespace:
18 # A Python string substituion pattern used to generate the C++
19 # namespace for each API. Use %(namespace)s to replace with the API
20 # namespace, like "toplevel::%(namespace)s_api".
21 #
[email protected]cfe484902012-02-15 14:52:3222 # Functions and namespaces can be excluded by setting "nocompile" to true.
[email protected]15f08dd2012-01-27 07:29:4823 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler',
24 'api_gen': '<(api_gen_dir)/compiler.py',
lfg8a1bee32014-08-29 03:56:2825 'schema_include_rules': [],
[email protected]15f08dd2012-01-27 07:29:4826 },
27 'rules': [
28 {
James Robinson145636c42014-09-30 22:26:5229 # GN version: json_schema_api.gni
[email protected]15f08dd2012-01-27 07:29:4830 'rule_name': 'genapi',
[email protected]4636c832013-01-11 02:10:1131 'msvs_external_rule': 1,
[email protected]15f08dd2012-01-27 07:29:4832 'extension': 'json',
33 'inputs': [
[email protected]cfe484902012-02-15 14:52:3234 '<(api_gen_dir)/cc_generator.py',
[email protected]15f08dd2012-01-27 07:29:4835 '<(api_gen_dir)/code.py',
36 '<(api_gen_dir)/compiler.py',
[email protected]32096af2013-02-06 01:29:3137 '<(api_gen_dir)/cpp_generator.py',
[email protected]15f08dd2012-01-27 07:29:4838 '<(api_gen_dir)/cpp_type_generator.py',
[email protected]750b8362012-03-07 02:33:3539 '<(api_gen_dir)/cpp_util.py',
[email protected]cfe484902012-02-15 14:52:3240 '<(api_gen_dir)/h_generator.py',
[email protected]750b8362012-03-07 02:33:3541 '<(api_gen_dir)/json_schema.py',
[email protected]cfe484902012-02-15 14:52:3242 '<(api_gen_dir)/model.py',
43 '<(api_gen_dir)/util.cc',
44 '<(api_gen_dir)/util.h',
45 '<(api_gen_dir)/util_cc_helper.py',
[email protected]25cbf6012012-02-28 05:51:4446 # TODO(calamity): uncomment this when gyp on windows behaves like other
47 # platforms. List expansions of filepaths in inputs expand to different
48 # things.
[email protected]4636c832013-01-11 02:10:1149 # '<@(schema_files)',
[email protected]15f08dd2012-01-27 07:29:4850 ],
51 'outputs': [
[email protected]c9fa3e62014-05-12 18:17:4452 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).cc',
53 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).h',
[email protected]15f08dd2012-01-27 07:29:4854 ],
55 'action': [
56 'python',
57 '<(api_gen)',
58 '<(RULE_INPUT_PATH)',
59 '--root=<(DEPTH)',
60 '--destdir=<(SHARED_INTERMEDIATE_DIR)',
61 '--namespace=<(root_namespace)',
[email protected]32096af2013-02-06 01:29:3162 '--generator=cpp',
lfg8a1bee32014-08-29 03:56:2863 '--include-rules=<(schema_include_rules)'
[email protected]15f08dd2012-01-27 07:29:4864 ],
[email protected]750b8362012-03-07 02:33:3565 'message': 'Generating C++ code from <(RULE_INPUT_PATH) json files',
66 'process_outputs_as_sources': 1,
67 },
68 {
69 'rule_name': 'genapi_idl',
[email protected]ae33d322012-03-19 22:24:3570 'msvs_external_rule': 1,
[email protected]750b8362012-03-07 02:33:3571 'extension': 'idl',
72 'inputs': [
[email protected]750b8362012-03-07 02:33:3573 '<(api_gen_dir)/cc_generator.py',
74 '<(api_gen_dir)/code.py',
75 '<(api_gen_dir)/compiler.py',
[email protected]32096af2013-02-06 01:29:3176 '<(api_gen_dir)/cpp_generator.py',
[email protected]750b8362012-03-07 02:33:3577 '<(api_gen_dir)/cpp_type_generator.py',
78 '<(api_gen_dir)/cpp_util.py',
79 '<(api_gen_dir)/h_generator.py',
80 '<(api_gen_dir)/idl_schema.py',
81 '<(api_gen_dir)/model.py',
82 '<(api_gen_dir)/util.cc',
83 '<(api_gen_dir)/util.h',
84 '<(api_gen_dir)/util_cc_helper.py',
85 # TODO(calamity): uncomment this when gyp on windows behaves like other
86 # platforms. List expansions of filepaths in inputs expand to different
87 # things.
[email protected]4636c832013-01-11 02:10:1188 # '<@(schema_files)',
[email protected]750b8362012-03-07 02:33:3589 ],
90 'outputs': [
[email protected]c9fa3e62014-05-12 18:17:4491 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).cc',
92 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).h',
[email protected]750b8362012-03-07 02:33:3593 ],
94 'action': [
95 'python',
96 '<(api_gen)',
97 '<(RULE_INPUT_PATH)',
98 '--root=<(DEPTH)',
99 '--destdir=<(SHARED_INTERMEDIATE_DIR)',
100 '--namespace=<(root_namespace)',
[email protected]32096af2013-02-06 01:29:31101 '--generator=cpp',
lfg8a1bee32014-08-29 03:56:28102 '--include-rules=<(schema_include_rules)'
[email protected]750b8362012-03-07 02:33:35103 ],
104 'message': 'Generating C++ code from <(RULE_INPUT_PATH) IDL files',
[email protected]15f08dd2012-01-27 07:29:48105 'process_outputs_as_sources': 1,
106 },
107 ],
108 'include_dirs': [
109 '<(SHARED_INTERMEDIATE_DIR)',
110 '<(DEPTH)',
111 ],
112 'dependencies':[
113 '<(DEPTH)/tools/json_schema_compiler/api_gen_util.gyp:api_gen_util',
114 ],
115 'direct_dependent_settings': {
116 'include_dirs': [
117 '<(SHARED_INTERMEDIATE_DIR)',
118 ]
119 },
120 # This target exports a hard dependency because it generates header
121 # files.
122 'hard_dependency': 1,
123}