| # 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/cpp/sdk_shared_library.gni") |
| import("//build/cpp/sdk_source_set.gni") |
| import("//build/test.gni") |
| import("//build/test/test_package.gni") |
| |
| sdk_source_set("cpp") { |
| # Keep internal for now until the API stabilizes. |
| category = "internal" |
| |
| sdk_name = "syslog_cpp" |
| |
| include_base = "//sdk" |
| |
| sources = [ |
| "log_level.h", |
| "log_settings.cc", |
| "log_settings.h", |
| "logging_backend.h", |
| "macros.cc", |
| "macros.h", |
| ] |
| |
| public_deps = [ "//zircon/public/lib/fit" ] |
| |
| public_configs = [ "//sdk/config" ] |
| |
| configs += [ |
| # TODO(fxb/58162): delete the below and fix compiler warnings |
| "//build/config:Wno-conversion", |
| ] |
| } |
| |
| sdk_source_set("backend_host") { |
| # Keep internal for now until the API stabilizes. |
| category = "internal" |
| |
| sdk_name = "syslog_cpp_backend_host" |
| |
| include_base = "//sdk" |
| |
| sources = [ "logging_backend_host.cc" ] |
| |
| deps = [ |
| ":cpp", |
| "//zircon/public/lib/fit", |
| ] |
| |
| public_configs = [ "//sdk/config" ] |
| } |
| |
| sdk_source_set("backend_legacy") { |
| # Keep internal for now until the API stabilizes. |
| category = "internal" |
| |
| sdk_name = "syslog_cpp_backend_legacy" |
| |
| include_base = "//sdk" |
| |
| if (is_fuchsia) { |
| sources = [ "logging_backend_fuchsia_legacy.cc" ] |
| |
| libs = [ "zircon" ] |
| |
| deps = [ ":cpp" ] |
| |
| public_deps = [ |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/zx", |
| "//zircon/system/ulib/syslog", |
| ] |
| |
| public_configs = [ "//sdk/config" ] |
| } else { |
| public_deps = [ ":backend_host" ] |
| } |
| } |
| |
| sdk_shared_library("backend_fuchsia_globals") { |
| category = "internal" |
| |
| sources = [ |
| "logging_backend_fuchsia_globals.cc", |
| "logging_backend_fuchsia_globals.h", |
| ] |
| |
| libs = [ "zircon" ] |
| } |
| |
| sdk_source_set("backend") { |
| # Keep internal for now until the API stabilizes. |
| category = "internal" |
| |
| sdk_name = "syslog_cpp_backend" |
| |
| if (is_fuchsia) { |
| sources = [ |
| "logging_backend_fuchsia.cc", |
| "logging_backend_fuchsia_globals.h", |
| ] |
| |
| deps = [ |
| ":backend_fuchsia_globals", |
| ":cpp", |
| "//sdk/fidl/fuchsia.diagnostics.stream", |
| "//sdk/fidl/fuchsia.logger:fuchsia.logger", |
| "//sdk/lib/fdio", |
| "//sdk/lib/syslog/streams/cpp:streams-encoder", |
| "//zircon/public/lib/fit", |
| ] |
| |
| include_base = "//sdk" |
| |
| public_configs = [ "//sdk/config" ] |
| } else { |
| public_deps = [ ":backend_host" ] |
| } |
| } |
| |
| executable("logging_cpp_unittests") { |
| testonly = true |
| |
| sources = [ |
| "log_settings_unittest.cc", |
| "logging_unittest.cc", |
| ] |
| |
| deps = [ |
| ":cpp", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| ] |
| |
| if (is_fuchsia) { |
| sources += [ "logging_socket_unittest.cc" ] |
| deps += [ ":backend_legacy" ] |
| } |
| |
| configs += [ |
| # TODO(fxb/58162): delete the below and fix compiler warnings |
| "//build/config:Wno-conversion", |
| ] |
| } |
| |
| executable("logging_cpp_unittests_structured") { |
| testonly = true |
| |
| sources = [ "log_structure_unittest.cc" ] |
| |
| deps = [ |
| ":backend", |
| ":cpp", |
| "//third_party/googletest:gtest", |
| "//third_party/googletest:gtest_main", |
| ] |
| } |
| |
| test_package("logging-cpp-tests") { |
| deps = [ |
| ":logging_cpp_unittests", |
| ":logging_cpp_unittests_structured", |
| ] |
| |
| tests = [ |
| { |
| name = "logging_cpp_unittests" |
| }, |
| { |
| name = "logging_cpp_unittests_structured" |
| }, |
| ] |
| } |