| {{>copyright comment="#"}} |
| |
| {{>generated comment="#"}} |
| |
| import("//src/sys/build/components.gni") |
| |
| group("{{PROJECT_NAME}}") { |
| testonly = true |
| deps = [ |
| ":package", |
| ":tests", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":{{PROJECT_NAME}}-unittests" ] |
| } |
| |
| source_set("lib") { |
| sources = [ |
| "{{snake_case PROJECT_NAME}}.cc", |
| "{{snake_case PROJECT_NAME}}.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 = "{{PROJECT_NAME}}" |
| |
| 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 = "{{PROJECT_NAME}}" |
| manifest = "meta/{{PROJECT_NAME}}.cmx" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "{{PROJECT_NAME}}" |
| deps = [ ":component" ] |
| } |
| |
| executable("unittests") { |
| output_name = "{{PROJECT_NAME}}_test" |
| testonly = true |
| |
| sources = [ "{{snake_case PROJECT_NAME}}_unittest.cc" ] |
| |
| deps = [ |
| ":lib", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/loop_fixture", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| # Run with `fx test {{PROJECT_NAME}}-unittests`. |
| fuchsia_unittest_package("{{PROJECT_NAME}}-unittests") { |
| executable_path = "bin/{{PROJECT_NAME}}_test" |
| deps = [ ":unittests" ] |
| } |