| # 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. |
| |
| # This file was generated by the `fx create` command. The template |
| # is located at `//tools/create/templates/component-v1/BUILD.gn.tmpl-cpp`. |
| # If you find something broken, we are eager to review fixes. |
| |
| import("//build/components.gni") |
| |
| group("my-component-v1-cpp") { |
| testonly = true |
| deps = [ |
| ":package", |
| ":tests", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":my-component-v1-cpp-unittests" ] |
| } |
| |
| source_set("lib") { |
| sources = [ |
| "my_component_v1_cpp.cc", |
| "my_component_v1_cpp.h", |
| ] |
| |
| public_deps = [ |
| "//sdk/lib/sys/inspect/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//zircon/public/lib/async", |
| "//zircon/public/lib/async-cpp", |
| ] |
| } |
| |
| executable("bin") { |
| output_name = "my-component-v1-cpp" |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ |
| ":lib", |
| "//sdk/lib/sys/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("component") { |
| component_name = "my-component-v1-cpp" |
| manifest = "meta/my-component-v1-cpp.cmx" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "my-component-v1-cpp" |
| deps = [ ":component" ] |
| } |
| |
| executable("unittests") { |
| output_name = "my-component-v1-cpp_test" |
| testonly = true |
| |
| sources = [ "my_component_v1_cpp_unittest.cc" ] |
| |
| deps = [ |
| ":lib", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/loop_fixture", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| # Run with `fx test my-component-v1-cpp-unittests`. |
| fuchsia_unittest_package("my-component-v1-cpp-unittests") { |
| deps = [ ":unittests" ] |
| } |