| # Copyright 2022 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/cpp/sdk_source_set.gni") |
| |
| # Header-only library for transaction header utilities. |
| # |
| # If an early bootstrapping library cannot be built with sanitizers, it may |
| # depend on this library to initialize and validate transaction headers, as |
| # opposed to `fidl_base` which might be built with sanitizers, or manually |
| # initializing transaction headers which is brittle. |
| source_set("fidl_txn_header") { |
| public = [ "include/lib/fidl/txn_header.h" ] |
| public_deps = [ "//src/zircon/lib/zircon" ] |
| public_configs = [ ":fidl_base.headers" ] |
| } |
| |
| # Base library used by both Fuchsia and host |
| # |
| # "fidl_base" is used in low-level contexts such as early system |
| # boot, hence cannot depend on the C++ standard library, and must only introduce |
| # minimal symbols into dependent targets. As such, these libraries need to be |
| # static libraries rather than source sets, as we need the Unix librarian |
| # algorithm to apply so that only object files corresponding to the used |
| # functions will be linked to the final binary. |
| sdk_source_set("fidl_base") { |
| category = "partner" |
| api = "//sdk/lib/fidl_base/fidl_base.api" |
| sdk_name = "fidl_base" |
| stable = true |
| |
| # TODO(https://fxbug.dev/42172264): We should represent the library as a |
| # `sdk_static_library` when supported. |
| build_as_static = true |
| |
| public = [ |
| "include/lib/fidl/coding.h", |
| "include/lib/fidl/cpp/framework_err.h", |
| "include/lib/fidl/cpp/transaction_header.h", |
| "include/lib/fidl/cpp/wire_format_metadata.h", |
| "include/lib/fidl/internal.h", |
| "include/lib/fidl/internal_callable_traits.h", |
| "include/lib/fidl/txn_header.h", |
| "include/lib/fidl/visitor.h", |
| "include/lib/fidl/walker.h", |
| ] |
| |
| sources = [ |
| "decoding_and_validating.cc", |
| "formatting.cc", |
| "handle_close_many.cc", |
| "internal.c", |
| "wire_format_metadata.cc", |
| ] |
| |
| deps = [ |
| "//sdk/lib/fit", |
| "//sdk/lib/stdcompat", |
| "//sdk/lib/utf-utils", |
| ] |
| |
| public_deps = [ "//src/zircon/lib/zircon" ] |
| |
| # TODO(https://fxbug.dev/42052612): GN check fails without this condition. |
| if (zircon_toolchain != false) { |
| public_deps += [ "//zircon/system/public" ] |
| } |
| |
| public_configs = [ ":fidl_base.headers" ] |
| |
| if (is_fuchsia) { |
| configs += [ "//build/config/fuchsia:no_cpp_standard_library" ] |
| } |
| } |
| |
| config("fidl_base.headers") { |
| include_dirs = [ "include" ] |
| } |