blob: 55903f2c981099fe494822a204bbc7bf00e4a87e [file] [log] [blame]
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/fidl/fidl.gni")
import("//zircon/tools/zither/zither_golden_files.gni")
import("vdso.gni")
group("vdso") {
deps = [ ":zx($fidl_toolchain)" ]
}
# See //zircon/tools/zither:tests, which covers the files generation from
# library zx.
group("tests") {
testonly = true
deps = []
}
# This is the zx library used by internal FIDL backends. For the library
# imported by `using zx;` in regular FIDL libraries, see
# //zircon/vdso/zx/BUILD.gn.
fidl("zx") {
visibility = [
":*",
"//zircon/tools/zither:tests",
]
versioned = "fuchsia"
sources = [
"bti.fidl",
"cache.fidl",
"channel.fidl",
"clock.fidl",
"cprng.fidl",
"debug.fidl",
"debuglog.fidl",
"errors.fidl",
"event.fidl",
"eventpair.fidl",
"exception.fidl",
"fifo.fidl",
"framebuffer.fidl",
"futex.fidl",
"guest.fidl",
"handle.fidl",
"interrupt.fidl",
"iob.fidl",
"iommu.fidl",
"ioports.fidl",
"job.fidl",
"ktrace.fidl",
"misc.fidl",
"msi.fidl",
"mtrace.fidl",
"object.fidl",
"overview.fidl",
"pager.fidl",
"pc.fidl",
"pci.fidl",
"pmt.fidl",
"port.fidl",
"process.fidl",
"profile.fidl",
"resource.fidl",
"restricted.fidl",
"rights.fidl",
"sampler.fidl",
"smc.fidl",
"socket.fidl",
"stream.fidl",
"system.fidl",
"task.fidl",
"thread.fidl",
"timer.fidl",
"types.fidl",
"vcpu.fidl",
"vmar.fidl",
"vmo.fidl",
"zx_common.fidl",
]
if (!exclude_testonly_syscalls) {
sources += [ "syscall.test.fidl" ]
}
# TODO(https://fxbug.dev/42061412): Burn these down.
experimental_flags = [ "zx_c_types" ]
enable_zither = true
enable_cpp = false
enable_rust = false
zither = {
asm = {
# While "zx" headers are currently stratified across zircon/* and
# zircon/syscalls/*, at this time we only use the assembly backend to
# generate checked-in headers in the former include namespace (i.e.,
# <zircon/errors.h>).
output_namespace = "zircon"
}
}
}
zither_golden_files("ifs") {
fidl = ":zx"
backend = "zircon_ifs"
sources = [ "//src/zircon/lib/zircon/zircon.ifs" ]
}
# TODO(https://fxbug.dev/42128146): Consumption of this header in assembly should be
# migrated over to using the assembly backend directly, at which point this
# header should be generated by the C backend, complete with C-style casts.
zither_golden_files("zx.asm.checked-in") {
fidl = ":zx"
backend = "asm"
sources = [ "//zircon/system/public/zircon/errors.h" ]
}
# Depended on by //zircon/public/sysroot/sdk:sysroot_sdk.
group("sysroot_sdk") {
deps = [ ":zx.asm.checked-in" ]
}
# TODO(joshuaseaton): Do not let our use of a "library zx" here propagate up to
# SDK build logic that would then consider this an "SDK library": there is
# already another library zx in the SDK and so this prevents collision.
barrier_metadata = {
fidl_json_barrier = []
}
# This provides the public headers that go with the vDSO API, which are
# seen as <zircon/...>.
group("public") {
visibility = [
"//src/zircon/lib/zircon/*",
"//zircon/kernel/lib/userabi/vdso/*",
"//zircon/public/sysroot/*",
]
public_deps = [ ":zx_zither.legacy_syscall_cdecl" ]
metadata = barrier_metadata
}
# This provides the private headers used by the kernel and vDSO
# implementation, which are seen as <lib/syscalls/...>.
group("private") {
visibility = [
"//zircon/kernel/lib/syscalls/*",
"//zircon/kernel/lib/userabi/*",
"//zircon/system/ulib/syscalls-headers/*",
]
public_deps = [ ":zx_zither.kernel" ]
metadata = barrier_metadata
}
group("fuchsia-zircon-sys") {
# //src/lib/zircon/rust:fuchsia-zircon re-exports the contents of the
# crate generated by the zither.rust_syscall backend.
visibility = [ "//src/lib/zircon/rust:*" ]
public_deps = [ ":zx_zither.rust_syscall" ]
metadata = barrier_metadata
}
# Used to publish reference documentation.
if (current_toolchain == default_toolchain) {
action("syscall_docs.zip") {
# Depend on the internal backend target.
deps = [ ":zx_zither.syscall_docs.gen" ]
# The output manifest is always first, per a private contract with
# zither_library().
inputs = get_target_outputs(deps[0])
outputs = [ "${target_out_dir}/syscall_docs.zip" ]
script = "//zircon/tools/zither/scripts/create-doc-archive.py"
args = [
"--source-file-manifest",
rebase_path(inputs[0], root_build_dir),
"--output",
rebase_path(outputs[0], root_build_dir),
]
}
}