| # Copyright 2019 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. |
| |
| import("//build/bind/bind.gni") |
| import("//build/components.gni") |
| import("//build/drivers.gni") |
| import("//build/test.gni") |
| |
| driver_bind_rules("buttons-bind") { |
| rules = "buttons.bind" |
| bind_output = "buttons.bindbc" |
| tests = "bind-tests.json" |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.gpio:fuchsia.hardware.gpio_bindlib", |
| "//src/devices/bind/fuchsia.devicetree", |
| "//src/devices/bind/fuchsia.gpio", |
| "//src/devices/bind/fuchsia.platform", |
| ] |
| } |
| |
| fuchsia_driver("buttons-driver") { |
| output_name = "buttons" |
| deps = [ |
| ":buttons-bind", |
| ":common", |
| ] |
| } |
| |
| fuchsia_driver_component("buttons") { |
| visibility = [ ":*" ] |
| component_name = "buttons" |
| deps = [ ":buttons-driver" ] |
| info = "buttons-info.json" |
| manifest = "meta/buttons.cml" |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "buttons" |
| driver_components = [ ":buttons" ] |
| } |
| |
| source_set("common") { |
| configs += [ "//build/config:all_source" ] |
| sources = [ |
| "buttons-device.cc", |
| "buttons.cc", |
| ] |
| |
| public_deps = [ |
| "//sdk/fidl/fuchsia.driver.compat:fuchsia.driver.compat_cpp", |
| "//sdk/fidl/fuchsia.hardware.gpio:fuchsia.hardware.gpio_cpp", |
| "//sdk/fidl/fuchsia.input.report:fuchsia.input.report_cpp", |
| "//sdk/lib/driver/compat/cpp:cpp", |
| "//sdk/lib/driver/component/cpp:cpp", |
| "//sdk/lib/driver/devfs/cpp", |
| "//src/devices/bin/driver_runtime", |
| "//src/devices/bus/lib/device-protocol-pdev", |
| "//src/lib/ddk:ddk-metadata-headers", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/inspect", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| test("buttons-test") { |
| configs += [ "//build/config:all_source" ] |
| output_name = "buttons-test" |
| sources = [ "buttons-test.cc" ] |
| deps = [ |
| ":common", |
| "//sdk/lib/async_patterns/testing/cpp", |
| "//sdk/lib/driver/testing/cpp:cpp", |
| "//src/devices/gpio/testing/fake-gpio", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("buttons-test-package") { |
| package_name = "buttons-test" |
| deps = [ ":buttons-test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":buttons-bind_test", |
| ":buttons-test-package", |
| ] |
| } |