| # 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/components.gni") |
| import("//build/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/test.gni") |
| import("udp_serde_include_dirs.gni") |
| |
| udp_serde_public_deps = |
| [ "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_cpp" ] |
| |
| # Source set for use by targets in the SDK, which can't depend on a |
| # shared library defined outside the SDK. |
| source_set("udp_serde") { |
| sources = [ "udp_serde.cc" ] |
| public_deps = udp_serde_public_deps |
| public = [ "udp_serde.h" ] |
| } |
| |
| # Shared library for use by golang targets. Fuchsia's build system doesn't |
| # support directly compiling C++ files that #include generated FIDL headers |
| # from CGo. This library lets golang targets get around this limitation by |
| # using LLCPP internally while exposing a header without referencing any |
| # generated FIDL types. |
| shared_library("udp_serde_for_cgo") { |
| sources = [ "udp_serde.cc" ] |
| public = [ "udp_serde.h" ] |
| public_deps = udp_serde_public_deps |
| } |
| |
| source_set("udp_serde_test_util") { |
| testonly = true |
| |
| sources = [ |
| "udp_serde_test_util.cc", |
| "udp_serde_test_util.h", |
| ] |
| |
| public_deps = [ |
| ":udp_serde", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_cpp", |
| ] |
| } |
| |
| test("udp_serde_cpp_test") { |
| sources = [ "udp_serde_test.cc" ] |
| |
| deps = [ |
| ":udp_serde", |
| ":udp_serde_test_util", |
| "//sdk/lib/fidl/cpp/wire", |
| "//src/lib/fxl/test:gtest_main", |
| ] |
| |
| # TODO(https://fxbug.dev/42085293): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-vla-cxx-extension" ] |
| } |
| |
| test("udp_serde_c_compilation_test") { |
| sources = [ "udp_serde_c_compilation_test.c" ] |
| |
| deps = [ |
| ":udp_serde", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("udp_serde-unittests") { |
| deps = [ ":udp_serde_cpp_test" ] |
| } |
| |
| fuchsia_unittest_package("udp_serde_c_compilation-unittest") { |
| deps = [ ":udp_serde_c_compilation_test" ] |
| } |
| |
| go_library("golib") { |
| non_go_deps = [ ":udp_serde_for_cgo" ] |
| deps = [ "//src/connectivity/network/netstack/fidlconv" ] |
| |
| sources = [ |
| "errors.go", |
| "udp_serde.go", |
| "udp_serde.h", |
| "udp_serde_test.go", |
| ] |
| } |
| |
| go_test("udp_serde_test") { |
| library = ":golib" |
| } |
| |
| fuchsia_unittest_package("udp_serde-gotests") { |
| deps = [ ":udp_serde_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":udp_serde-gotests", |
| ":udp_serde-unittests", |
| ":udp_serde_c_compilation-unittest", |
| ] |
| } |