blob: 08b622cbd914d7fe5fe39f07a5708f5d2bfc7f3a [file] [log] [blame]
# Copyright {{COPYRIGHT_YEAR}} 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 component-v2` command. The template
# is located at `//tools/create/templates/component-v2/BUILD.gn.tmpl-cpp`.
# If something is broken, consider authoring a fix.
import("//build/package.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
group("{{PROJECT_NAME}}") {
testonly = true
public_deps = [
":pkg",
":tests",
]
}
group("tests") {
testonly = true
public_deps = [ ":{{PROJECT_NAME}}-tests" ]
}
source_set("lib") {
sources = [
"{{PROJECT_NAME}}.cc",
"{{PROJECT_NAME}}.h",
]
public_deps = [ "//zircon/public/lib/async-cpp" ]
}
executable("bin") {
output_name = "{{PROJECT_NAME}}"
sources = [ "main.cc" ]
deps = [
":lib",
"//zircon/public/lib/async-default",
"//zircon/public/lib/async-loop-cpp",
"//zircon/public/lib/async-loop-default",
]
}
executable("unittests") {
output_name = "{{PROJECT_NAME}}_unittests"
testonly = true
sources = [ "{{PROJECT_NAME}}_test.cc" ]
deps = [
":lib",
"//third_party/googletest:gtest",
"//third_party/googletest:gtest_main",
"//zircon/public/lib/async-default",
"//zircon/public/lib/async-loop-cpp",
"//zircon/public/lib/async-loop-default",
]
}
package("pkg") {
package_name = "{{PROJECT_NAME}}"
deps = [ ":bin" ]
binaries = [
{
name = "{{PROJECT_NAME}}"
},
]
meta = [
# Compile the package's CML manifest.
# The resulting component manifest can be referenced through the URL
# fuchsia-pkg://fuchsia.com/{{PROJECT_NAME}}#meta/{{PROJECT_NAME}}.cm.
{
path = rebase_path("meta/{{PROJECT_NAME}}.cml")
dest = "{{PROJECT_NAME}}.cm"
},
]
}
# Run with `fx test {{PROJECT_NAME}}-tests`.
test_package("{{PROJECT_NAME}}-tests") {
deps = [ ":unittests" ]
v2_tests = [
{
name = "{{PROJECT_NAME}}_unittests"
environments = basic_envs
},
]
}