| # Copyright 2021 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. |
| |
| load( |
| "@rules_fuchsia//fuchsia:defs.bzl", |
| "fuchsia_cc_test", |
| "fuchsia_component_manifest", |
| "fuchsia_driver_bind_bytecode", |
| "fuchsia_driver_component", |
| "fuchsia_package", |
| "fuchsia_test_package", |
| "if_fuchsia", |
| ) |
| |
| fuchsia_driver_bind_bytecode( |
| name = "bind_bytecode", |
| output = "example_driver.bindbc", |
| rules = "example_driver.bind", |
| deps = [ |
| "@fuchsia_sdk//bind/fuchsia.acpi", |
| ], |
| ) |
| |
| cc_binary( |
| name = "example_driver", |
| srcs = [ |
| "example_driver.cc", |
| "example_driver.h", |
| "greeter.h", |
| ], |
| linkshared = True, |
| deps = [ |
| "@fuchsia_sdk//fidl/fuchsia.driver.compat:fuchsia.driver.compat_llcpp_cc", |
| "@fuchsia_sdk//pkg/driver2_cpp", |
| ], |
| ) |
| |
| fuchsia_component_manifest( |
| name = "manifest", |
| src = "meta/example_driver.cml", |
| includes = [ |
| "@fuchsia_sdk//pkg/syslog:client", |
| ], |
| ) |
| |
| fuchsia_driver_component( |
| name = "component", |
| bind_bytecode = ":bind_bytecode", |
| driver_lib = ":example_driver", |
| manifest = ":manifest", |
| ) |
| |
| fuchsia_package( |
| name = "pkg", |
| package_name = "example_driver", |
| visibility = ["//visibility:public"], |
| deps = [ |
| ":component", |
| ], |
| ) |
| |
| fuchsia_cc_test( |
| name = "example_driver_unittest", |
| size = "small", |
| srcs = [ |
| "example_driver_unittest.cc", |
| "greeter.h", |
| ], |
| deps = ["@com_google_googletest//:gtest_main"] + if_fuchsia([ |
| "@fuchsia_sdk//pkg/fdio", |
| "@fuchsia_sdk//pkg/syslog", |
| ]), |
| ) |
| |
| fuchsia_test_package( |
| name = "test_pkg", |
| package_name = "example_driver_test", |
| visibility = ["//visibility:public"], |
| deps = [ |
| ":example_driver_unittest", |
| ], |
| ) |