mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
[fuchsia] allow generation of C++ bindings for FIDL dependencies
Bug: fuchsia/DX-1270 Change-Id: I99edcfcc96baa00affd129f9249fe6e3c565812b Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1560311 Reviewed-by: Scott Graham <scottmg@chromium.org> Commit-Queue: Francois Rousseau <frousseau@google.com>
This commit is contained in:
parent
0c618f8317
commit
83f6f43d81
104
third_party/fuchsia/BUILD.gn
vendored
104
third_party/fuchsia/BUILD.gn
vendored
@ -45,6 +45,11 @@ if (crashpad_is_in_fuchsia) {
|
||||
fidl_root_gen_dir,
|
||||
"$sdk_pkg_path/fidl/include",
|
||||
"$sdk_pkg_path/fidl_base/include",
|
||||
"$sdk_pkg_path/async/include",
|
||||
"$sdk_pkg_path/fidl_cpp/include",
|
||||
"$sdk_pkg_path/fidl_cpp_base/include",
|
||||
"$sdk_pkg_path/fidl_cpp_sync/include",
|
||||
"$sdk_pkg_path/fit/include",
|
||||
]
|
||||
}
|
||||
|
||||
@ -90,7 +95,26 @@ if (crashpad_is_in_fuchsia) {
|
||||
public_configs = [ ":fidl_config" ]
|
||||
}
|
||||
|
||||
source_set("fidl_cpp_base") {
|
||||
sources = [
|
||||
"$sdk_pkg_path/fidl_cpp_base/clone.cc",
|
||||
"$sdk_pkg_path/fidl_cpp_base/decoder.cc",
|
||||
"$sdk_pkg_path/fidl_cpp_base/encoder.cc",
|
||||
"$sdk_pkg_path/fidl_cpp_base/string.cc",
|
||||
]
|
||||
|
||||
public_configs = [
|
||||
":fidl_config",
|
||||
":zx_config",
|
||||
]
|
||||
}
|
||||
|
||||
fidl_sources = [
|
||||
{
|
||||
fidl = "$sdk_fidl_sources_path/fuchsia.mem/buffer.fidl"
|
||||
header_stem = "fuchsia/mem"
|
||||
library_name = "fuchsia.mem"
|
||||
},
|
||||
{
|
||||
fidl = "$sdk_fidl_sources_path/fuchsia.sysinfo/sysinfo.fidl"
|
||||
header_stem = "fuchsia/sysinfo"
|
||||
@ -100,12 +124,17 @@ if (crashpad_is_in_fuchsia) {
|
||||
|
||||
foreach(fidl_source, fidl_sources) {
|
||||
fidl_stem = "$target_gen_dir/fidl/${fidl_source.library_name}"
|
||||
json_representation = "$fidl_stem/intermediary_representation.json"
|
||||
c_stem = "$fidl_root_gen_dir/${fidl_source.header_stem}/c"
|
||||
c_header = "$c_stem/fidl.h"
|
||||
c_client = "$c_stem/client.cc"
|
||||
cpp_stem = "$fidl_root_gen_dir/${fidl_source.header_stem}/cpp/fidl"
|
||||
cpp_header = "$cpp_stem.h"
|
||||
cpp_source = "$cpp_stem.cc"
|
||||
coding_tables = "$fidl_stem/tables.cc"
|
||||
|
||||
# Compiles the .fidl file and generates the C bindings.
|
||||
# Compiles the .fidl file, outputs the intermediary JSON representation
|
||||
# and generates the C bindings.
|
||||
action("fidlc_${fidl_source.library_name}") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
@ -119,6 +148,8 @@ if (crashpad_is_in_fuchsia) {
|
||||
rebase_path(c_client, root_build_dir),
|
||||
"--tables",
|
||||
rebase_path(coding_tables, root_build_dir),
|
||||
"--json",
|
||||
rebase_path(json_representation, root_build_dir),
|
||||
"--name",
|
||||
fidl_source.library_name,
|
||||
"--files",
|
||||
@ -134,13 +165,45 @@ if (crashpad_is_in_fuchsia) {
|
||||
c_client,
|
||||
c_header,
|
||||
coding_tables,
|
||||
json_representation,
|
||||
]
|
||||
}
|
||||
|
||||
source_set("${fidl_source.library_name}_c") {
|
||||
# Generates the C++ bindings from the intermediary JSON representation.
|
||||
action("fidlgen_cpp_${fidl_source.library_name}") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
script = "runner.py"
|
||||
|
||||
args = [
|
||||
rebase_path("$sdk_path/tools/fidlgen", root_build_dir),
|
||||
"--json",
|
||||
rebase_path(json_representation, root_build_dir),
|
||||
"--include-base",
|
||||
rebase_path(fidl_root_gen_dir, root_build_dir),
|
||||
"--output-base",
|
||||
rebase_path(cpp_stem, root_build_dir),
|
||||
"--generators",
|
||||
"cpp",
|
||||
]
|
||||
|
||||
inputs = [
|
||||
"$sdk_path/tools/fidlgen",
|
||||
json_representation,
|
||||
]
|
||||
|
||||
outputs = [
|
||||
cpp_header,
|
||||
cpp_source,
|
||||
]
|
||||
|
||||
deps = [
|
||||
":fidlc_${fidl_source.library_name}",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("${fidl_source.library_name}_tables") {
|
||||
sources = [
|
||||
c_client,
|
||||
c_header,
|
||||
coding_tables,
|
||||
]
|
||||
|
||||
@ -150,11 +213,44 @@ if (crashpad_is_in_fuchsia) {
|
||||
|
||||
public_configs = [ ":fidl_config" ]
|
||||
}
|
||||
|
||||
source_set("${fidl_source.library_name}_c") {
|
||||
sources = [
|
||||
c_client,
|
||||
c_header,
|
||||
]
|
||||
|
||||
deps = [
|
||||
":${fidl_source.library_name}_tables",
|
||||
":fidlc_${fidl_source.library_name}",
|
||||
]
|
||||
|
||||
public_configs = [ ":fidl_config" ]
|
||||
}
|
||||
|
||||
source_set("${fidl_source.library_name}_cpp") {
|
||||
sources = [
|
||||
cpp_header,
|
||||
cpp_source,
|
||||
]
|
||||
|
||||
deps = [
|
||||
":${fidl_source.library_name}_tables",
|
||||
":fidlgen_cpp_${fidl_source.library_name}",
|
||||
]
|
||||
|
||||
public_configs = [
|
||||
":fidl_config",
|
||||
":zx_config",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
static_library("fuchsia") {
|
||||
deps = [
|
||||
":fidl_base",
|
||||
":fidl_cpp_base",
|
||||
":fuchsia.mem_cpp",
|
||||
":fuchsia.sysinfo_c",
|
||||
":zx",
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user