| # 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. |
| |
| assert(is_fuchsia, "These targets are only compiled in the fuchsia toolchain.") |
| |
| # [START imports] |
| import("//build/components.gni") |
| |
| # [END imports] |
| |
| group("hermetic_tests") { |
| testonly = true |
| deps = [ ":echo-cpp-unittests" ] |
| } |
| |
| # [START executable] |
| executable("bin") { |
| output_name = "echo_example_cpp" |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ |
| ":cpp-lib", |
| "//sdk/lib/async-default", |
| "//sdk/lib/async-loop:async-loop-cpp", |
| "//sdk/lib/async-loop:async-loop-default", |
| "//sdk/lib/syslog/cpp", |
| ] |
| } |
| |
| source_set("cpp-lib") { |
| sources = [ |
| "echo_component.cc", |
| "echo_component.h", |
| ] |
| } |
| |
| # [END executable] |
| |
| # [START component] |
| fuchsia_component("component") { |
| component_name = "echo_cpp" |
| manifest = "meta/echo.cml" |
| deps = [ ":bin" ] |
| } |
| |
| # [END component] |
| |
| #[START unittest] |
| executable("unittests") { |
| output_name = "echo-cpp-test" |
| testonly = true |
| |
| sources = [ "echo_unittest.cc" ] |
| |
| deps = [ |
| ":cpp-lib", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("echo-cpp-unittests") { |
| deps = [ ":unittests" ] |
| } |
| #[END unittest] |