2012-01-27 11:29:48 +04:00
|
|
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
{
|
|
|
|
'variables': {
|
|
|
|
# When including this gypi, the following variables must be set:
|
2014-08-05 12:02:06 +04:00
|
|
|
# schema_files:
|
|
|
|
# An array of json or idl files that comprise the api model.
|
2014-08-29 07:56:28 +04:00
|
|
|
# schema_include_rules (optional):
|
|
|
|
# An array of paths to include when searching for referenced objects,
|
|
|
|
# with the namespace separated by a :.
|
|
|
|
# Example:
|
|
|
|
# [ '/foo/bar:Foo::Bar::%(namespace)s' ]
|
2014-08-05 12:02:06 +04:00
|
|
|
# cc_dir:
|
|
|
|
# The directory to put the generated code in.
|
|
|
|
# root_namespace:
|
|
|
|
# A Python string substituion pattern used to generate the C++
|
|
|
|
# namespace for each API. Use %(namespace)s to replace with the API
|
|
|
|
# namespace, like "toplevel::%(namespace)s_api".
|
|
|
|
#
|
2012-02-15 18:52:32 +04:00
|
|
|
# Functions and namespaces can be excluded by setting "nocompile" to true.
|
2012-01-27 11:29:48 +04:00
|
|
|
'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler',
|
|
|
|
'api_gen': '<(api_gen_dir)/compiler.py',
|
2014-08-29 07:56:28 +04:00
|
|
|
'schema_include_rules': [],
|
2012-01-27 11:29:48 +04:00
|
|
|
},
|
|
|
|
'rules': [
|
|
|
|
{
|
2014-10-01 02:26:52 +04:00
|
|
|
# GN version: json_schema_api.gni
|
2012-01-27 11:29:48 +04:00
|
|
|
'rule_name': 'genapi',
|
2013-01-11 06:10:11 +04:00
|
|
|
'msvs_external_rule': 1,
|
2012-01-27 11:29:48 +04:00
|
|
|
'extension': 'json',
|
|
|
|
'inputs': [
|
2012-02-15 18:52:32 +04:00
|
|
|
'<(api_gen_dir)/cc_generator.py',
|
2012-01-27 11:29:48 +04:00
|
|
|
'<(api_gen_dir)/code.py',
|
|
|
|
'<(api_gen_dir)/compiler.py',
|
2013-02-06 05:29:31 +04:00
|
|
|
'<(api_gen_dir)/cpp_generator.py',
|
2012-03-07 06:33:35 +04:00
|
|
|
'<(api_gen_dir)/cpp_type_generator.py',
|
2012-02-15 18:52:32 +04:00
|
|
|
'<(api_gen_dir)/cpp_util.py',
|
2012-03-07 06:33:35 +04:00
|
|
|
'<(api_gen_dir)/h_generator.py',
|
|
|
|
'<(api_gen_dir)/json_schema.py',
|
|
|
|
'<(api_gen_dir)/model.py',
|
|
|
|
'<(api_gen_dir)/util.cc',
|
|
|
|
'<(api_gen_dir)/util.h',
|
|
|
|
'<(api_gen_dir)/util_cc_helper.py',
|
|
|
|
# TODO(calamity): uncomment this when gyp on windows behaves like other
|
|
|
|
# platforms. List expansions of filepaths in inputs expand to different
|
|
|
|
# things.
|
2013-01-11 06:10:11 +04:00
|
|
|
# '<@(schema_files)',
|
2012-03-07 06:33:35 +04:00
|
|
|
],
|
|
|
|
'outputs': [
|
2014-05-12 22:17:44 +04:00
|
|
|
'<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).cc',
|
|
|
|
'<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).h',
|
2012-03-07 06:33:35 +04:00
|
|
|
],
|
|
|
|
'action': [
|
|
|
|
'python',
|
|
|
|
'<(api_gen)',
|
|
|
|
'<(RULE_INPUT_PATH)',
|
|
|
|
'--root=<(DEPTH)',
|
|
|
|
'--destdir=<(SHARED_INTERMEDIATE_DIR)',
|
|
|
|
'--namespace=<(root_namespace)',
|
2013-02-06 05:29:31 +04:00
|
|
|
'--generator=cpp',
|
2014-08-29 07:56:28 +04:00
|
|
|
'--include-rules=<(schema_include_rules)'
|
2012-03-07 06:33:35 +04:00
|
|
|
],
|
|
|
|
'message': 'Generating C++ code from <(RULE_INPUT_PATH) json files',
|
|
|
|
'process_outputs_as_sources': 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'rule_name': 'genapi_idl',
|
2012-03-20 02:24:35 +04:00
|
|
|
'msvs_external_rule': 1,
|
2012-03-07 06:33:35 +04:00
|
|
|
'extension': 'idl',
|
|
|
|
'inputs': [
|
|
|
|
'<(api_gen_dir)/cc_generator.py',
|
|
|
|
'<(api_gen_dir)/code.py',
|
|
|
|
'<(api_gen_dir)/compiler.py',
|
2013-02-06 05:29:31 +04:00
|
|
|
'<(api_gen_dir)/cpp_generator.py',
|
2012-01-27 11:29:48 +04:00
|
|
|
'<(api_gen_dir)/cpp_type_generator.py',
|
2012-03-07 06:33:35 +04:00
|
|
|
'<(api_gen_dir)/cpp_util.py',
|
2012-02-15 18:52:32 +04:00
|
|
|
'<(api_gen_dir)/h_generator.py',
|
2012-03-07 06:33:35 +04:00
|
|
|
'<(api_gen_dir)/idl_schema.py',
|
2012-02-15 18:52:32 +04:00
|
|
|
'<(api_gen_dir)/model.py',
|
|
|
|
'<(api_gen_dir)/util.cc',
|
|
|
|
'<(api_gen_dir)/util.h',
|
|
|
|
'<(api_gen_dir)/util_cc_helper.py',
|
2012-02-28 09:51:44 +04:00
|
|
|
# TODO(calamity): uncomment this when gyp on windows behaves like other
|
|
|
|
# platforms. List expansions of filepaths in inputs expand to different
|
|
|
|
# things.
|
2013-01-11 06:10:11 +04:00
|
|
|
# '<@(schema_files)',
|
2012-01-27 11:29:48 +04:00
|
|
|
],
|
|
|
|
'outputs': [
|
2014-05-12 22:17:44 +04:00
|
|
|
'<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).cc',
|
|
|
|
'<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).h',
|
2012-01-27 11:29:48 +04:00
|
|
|
],
|
|
|
|
'action': [
|
|
|
|
'python',
|
|
|
|
'<(api_gen)',
|
|
|
|
'<(RULE_INPUT_PATH)',
|
|
|
|
'--root=<(DEPTH)',
|
|
|
|
'--destdir=<(SHARED_INTERMEDIATE_DIR)',
|
|
|
|
'--namespace=<(root_namespace)',
|
2013-02-06 05:29:31 +04:00
|
|
|
'--generator=cpp',
|
2014-08-29 07:56:28 +04:00
|
|
|
'--include-rules=<(schema_include_rules)'
|
2012-01-27 11:29:48 +04:00
|
|
|
],
|
2012-03-07 06:33:35 +04:00
|
|
|
'message': 'Generating C++ code from <(RULE_INPUT_PATH) IDL files',
|
2012-01-27 11:29:48 +04:00
|
|
|
'process_outputs_as_sources': 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'include_dirs': [
|
|
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
|
|
'<(DEPTH)',
|
|
|
|
],
|
|
|
|
'dependencies':[
|
|
|
|
'<(DEPTH)/tools/json_schema_compiler/api_gen_util.gyp:api_gen_util',
|
|
|
|
],
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
'include_dirs': [
|
|
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
# This target exports a hard dependency because it generates header
|
|
|
|
# files.
|
|
|
|
'hard_dependency': 1,
|
|
|
|
}
|