| # Copyright 2019 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/extract_imported_symbols.gni") | |
| import("//build/cpp/library_headers.gni") | |
| import("//build/cpp/verify_imported_symbols.gni") | |
| import("//build/cpp/verify_public_symbols.gni") | |
| library_headers("headers") { | |
| headers = [ | |
| "lib/zxio/cpp/vector.h", | |
| "lib/zxio/extensions.h", | |
| "lib/zxio/null.h", | |
| "lib/zxio/ops.h", | |
| "lib/zxio/posix_mode.h", | |
| "lib/zxio/types.h", | |
| "lib/zxio/zxio.h", | |
| ] | |
| } | |
| # This is a header-only library that provides type safe C++ wrappers around the | |
| # zxio_create_with_type() entry point. | |
| library_headers("create_with_type") { | |
| headers = [ "lib/zxio/cpp/create_with_type.h" ] | |
| public_deps = [ | |
| ":zxio", | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", | |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_llcpp", | |
| "//sdk/fidl/fuchsia.posix.socket.packet:fuchsia.posix.socket.packet_llcpp", | |
| "//sdk/fidl/fuchsia.posix.socket.raw:fuchsia.posix.socket.raw_llcpp", | |
| "//zircon/system/ulib/zx", | |
| ] | |
| } | |
| # This header exposes implementation details of the zxio library in order to | |
| # facilitate moving logic from fdio into zxio. It should not be used outside of | |
| # these two libraries. | |
| library_headers("inception") { | |
| headers = [ "lib/zxio/cpp/inception.h" ] | |
| public_deps = [ | |
| ":headers", | |
| # <lib/zxio/cpp/inception.h> has #include <fidl/fuchsia.io/cpp/wire.h>. | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", | |
| # <lib/zxio/inception.h> has #include <fidl/fuchsia.posix.socket/cpp/wire.h>. | |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_llcpp", | |
| # <lib/zxio/inception.h> has #include <fidl/fuchsia.posix.socket.packet/cpp/wire.h>. | |
| "//sdk/fidl/fuchsia.posix.socket.packet:fuchsia.posix.socket.packet_llcpp", | |
| # <lib/zxio/inception.h> has #include <fidl/fuchsia.posix.socket.raw/cpp/wire.h>. | |
| "//sdk/fidl/fuchsia.posix.socket.raw:fuchsia.posix.socket.raw_llcpp", | |
| ] | |
| visibility = [ | |
| "//sdk/lib/fdio/*", | |
| "//sdk/lib/zxio/*", | |
| ] | |
| } | |
| config("zxio_config") { | |
| # This define is to provide a source code soft transition for the mesa library which uses | |
| # zxio_dirent_iterator_next() and needs to transition to the new API. | |
| # TODO(https://fxbug.dev/91172): Remove after mesa has updated and rolled. | |
| defines = [ "ZXIO_HAS_NEW_DIRENT_ITERATOR_NEXT" ] | |
| } | |
| source_set("zxio") { | |
| sources = [ | |
| "create.cc", | |
| "debuglog.cc", | |
| "extensions.cc", | |
| "get_vmo.cc", | |
| "inception.cc", | |
| "null.cc", | |
| "pipe.cc", | |
| "remote.cc", | |
| "remote_v2/common_utils.cc", | |
| "remote_v2/dirent_iterator.cc", | |
| "remote_v2/remote_v2.cc", | |
| "socket.cc", | |
| "vmo.cc", | |
| "vmofile.cc", | |
| "zxio.cc", | |
| ] | |
| public_deps = [ ":headers" ] | |
| public_configs = [ ":zxio_config" ] | |
| deps = [ | |
| "//sdk/fidl/fuchsia.device:fuchsia.device_llcpp", | |
| "//sdk/fidl/fuchsia.hardware.pty:fuchsia.hardware.pty_llcpp", | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", | |
| "//sdk/lib/stdcompat", | |
| "//sdk/lib/zxio:inception", | |
| "//zircon/system/ulib/fbl", | |
| "//zircon/system/ulib/zx", | |
| ] | |
| # TODO(fxbug.dev/94768): This target uses mutable tables which are deprecated, | |
| # rather than builders. | |
| configs += [ "//build/cpp:fidl-wire-deprecated-mutable-tables" ] | |
| } | |
| shared_library("zxio_standalone") { | |
| visibility = [ ":*" ] | |
| public_deps = [ ":zxio" ] | |
| configs += [ "//build/config/fuchsia:static_cpp_standard_library" ] | |
| version_script = "zxio_standalone.ld" | |
| inputs = [ version_script ] | |
| ldflags = | |
| [ "-Wl,--version-script=" + rebase_path(version_script, root_build_dir) ] | |
| } | |
| shared_out_dir = | |
| get_label_info(":zxio_standalone($shlib_toolchain)", "root_out_dir") | |
| zxio_standalone_library = "$shared_out_dir/libzxio_standalone.so" | |
| generated_imported_symbols_list = | |
| "$target_gen_dir/zxio_standalone.imported_symbols.list" | |
| generated_public_symbols_list = "$shared_out_dir/libzxio_standalone.ifs" | |
| extract_imported_symbols("zxio_standalone_extract_imported_symbols") { | |
| library = zxio_standalone_library | |
| symbols = generated_imported_symbols_list | |
| deps = [ ":zxio_standalone($shlib_toolchain)" ] | |
| } | |
| verify_imported_symbols("zxio_standalone_verify_imported_symbols") { | |
| current = generated_imported_symbols_list | |
| allowlist = rebase_path("zxio_standalone.imported_symbols.allowlist") | |
| library_name = "zxio_standalone" | |
| deps = [ ":zxio_standalone_extract_imported_symbols" ] | |
| } | |
| verify_public_symbols("zxio_standalone_verify_public_symbols") { | |
| current = generated_public_symbols_list | |
| reference = rebase_path("zxio_standalone.public_symbols.ifs") | |
| library_name = "zxio_standalone" | |
| deps = [ ":zxio_standalone($shlib_toolchain)" ] | |
| } | |
| group("standalone") { | |
| public_deps = [ ":zxio_standalone" ] | |
| deps = [ ":zxio_standalone_verify_public_symbols" ] | |
| # Only verify the imported symbols in uninstrumented variants as some variants | |
| # such as ASan / UBSan insert additional runtime dependencies. | |
| if (!toolchain_variant.instrumented) { | |
| deps += [ ":zxio_standalone_verify_imported_symbols" ] | |
| } | |
| } | |
| group("tests") { | |
| testonly = true | |
| deps = [ "tests" ] | |
| } |