michael@0: # Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: { michael@0: 'variables': { michael@0: # When including this gypi, the following variables must be set: michael@0: # json_schema_files: a list of json files that comprise the api model. michael@0: # idl_schema_files: a list of IDL files that comprise the api model. michael@0: # cc_dir: path to generated files michael@0: # root_namespace: the C++ namespace that all generated files go under michael@0: # Functions and namespaces can be excluded by setting "nocompile" to true. michael@0: 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler', michael@0: 'api_gen': '<(api_gen_dir)/compiler.py', michael@0: }, michael@0: 'rules': [ michael@0: { michael@0: 'rule_name': 'genapi', michael@0: 'extension': 'json', michael@0: 'inputs': [ michael@0: '<(api_gen_dir)/any.cc', michael@0: '<(api_gen_dir)/any.h', michael@0: '<(api_gen_dir)/any_helper.py', michael@0: '<(api_gen_dir)/cc_generator.py', michael@0: '<(api_gen_dir)/code.py', michael@0: '<(api_gen_dir)/compiler.py', michael@0: '<(api_gen_dir)/cpp_type_generator.py', michael@0: '<(api_gen_dir)/cpp_util.py', michael@0: '<(api_gen_dir)/h_generator.py', michael@0: '<(api_gen_dir)/json_schema.py', michael@0: '<(api_gen_dir)/model.py', michael@0: '<(api_gen_dir)/util.cc', michael@0: '<(api_gen_dir)/util.h', michael@0: '<(api_gen_dir)/util_cc_helper.py', michael@0: # TODO(calamity): uncomment this when gyp on windows behaves like other michael@0: # platforms. List expansions of filepaths in inputs expand to different michael@0: # things. michael@0: # '<@(json_schema_files)', michael@0: ], michael@0: 'outputs': [ michael@0: '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).cc', michael@0: '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).h', michael@0: ], michael@0: 'action': [ michael@0: 'python', michael@0: '<(api_gen)', michael@0: '<(RULE_INPUT_PATH)', michael@0: '--root=<(DEPTH)', michael@0: '--destdir=<(SHARED_INTERMEDIATE_DIR)', michael@0: '--namespace=<(root_namespace)', michael@0: ], michael@0: 'message': 'Generating C++ code from <(RULE_INPUT_PATH) json files', michael@0: 'process_outputs_as_sources': 1, michael@0: }, michael@0: { michael@0: 'rule_name': 'genapi_idl', michael@0: 'msvs_external_rule': 1, michael@0: 'extension': 'idl', michael@0: 'inputs': [ michael@0: '<(api_gen_dir)/any.cc', michael@0: '<(api_gen_dir)/any.h', michael@0: '<(api_gen_dir)/any_helper.py', michael@0: '<(api_gen_dir)/cc_generator.py', michael@0: '<(api_gen_dir)/code.py', michael@0: '<(api_gen_dir)/compiler.py', michael@0: '<(api_gen_dir)/cpp_type_generator.py', michael@0: '<(api_gen_dir)/cpp_util.py', michael@0: '<(api_gen_dir)/h_generator.py', michael@0: '<(api_gen_dir)/idl_schema.py', michael@0: '<(api_gen_dir)/model.py', michael@0: '<(api_gen_dir)/util.cc', michael@0: '<(api_gen_dir)/util.h', michael@0: '<(api_gen_dir)/util_cc_helper.py', michael@0: # TODO(calamity): uncomment this when gyp on windows behaves like other michael@0: # platforms. List expansions of filepaths in inputs expand to different michael@0: # things. michael@0: # '<@(idl_schema_files)', michael@0: ], michael@0: 'outputs': [ michael@0: '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).cc', michael@0: '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_ROOT).h', michael@0: ], michael@0: 'action': [ michael@0: 'python', michael@0: '<(api_gen)', michael@0: '<(RULE_INPUT_PATH)', michael@0: '--root=<(DEPTH)', michael@0: '--destdir=<(SHARED_INTERMEDIATE_DIR)', michael@0: '--namespace=<(root_namespace)', michael@0: ], michael@0: 'message': 'Generating C++ code from <(RULE_INPUT_PATH) IDL files', michael@0: 'process_outputs_as_sources': 1, michael@0: }, michael@0: ], michael@0: 'include_dirs': [ michael@0: '<(SHARED_INTERMEDIATE_DIR)', michael@0: '<(DEPTH)', michael@0: ], michael@0: 'dependencies':[ michael@0: '<(DEPTH)/tools/json_schema_compiler/api_gen_util.gyp:api_gen_util', michael@0: ], michael@0: 'direct_dependent_settings': { michael@0: 'include_dirs': [ michael@0: '<(SHARED_INTERMEDIATE_DIR)', michael@0: ] michael@0: }, michael@0: # This target exports a hard dependency because it generates header michael@0: # files. michael@0: 'hard_dependency': 1, michael@0: }