| # 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") |
| |
| source_set("shared") { |
| visibility = [ ":*" ] |
| sources = [ |
| "simple-display.cc", |
| "simple-display.h", |
| ] |
| public_deps = [ |
| "//sdk/banjo/fuchsia.hardware.display.controller:fuchsia.hardware.display.controller_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.pci:fuchsia.hardware.pci_cpp", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_cpp", |
| "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem_cpp", |
| "//sdk/fidl/fuchsia.sysmem2:fuchsia.sysmem2_cpp", |
| "//sdk/lib/zbi-format", |
| "//src/devices/bind/fuchsia.sysmem.heap:fuchsia.sysmem.heap_cpp", |
| "//src/devices/lib/driver", |
| "//src/devices/lib/mmio", |
| "//src/devices/pci/lib/device-protocol-pci", |
| "//src/devices/pci/lib/pci", |
| "//src/graphics/display/lib/api-types-cpp", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/image-format", |
| "//zircon/system/ulib/sysmem-version", |
| "//zircon/system/ulib/zircon-internal", |
| ] |
| } |
| |
| test("simple-display-test-bin") { |
| sources = [ "simple-display-test.cc" ] |
| deps = [ |
| ":shared", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_cpp_testing", |
| "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem_cpp_testing", |
| "//src/devices/testing/fake-mmio-reg", |
| "//src/devices/testing/no_ddk", |
| "//src/lib/fsl", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/predicates", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("simple-display-test") { |
| package_name = "simple-display-test" |
| deps = [ ":simple-display-test-bin" ] |
| } |
| |
| # Creates a Fuchsia driver assuming the driver's files start with the same |
| # naming scheme: "simple-${target_name}" where `target_name` is the name of the |
| # driver. |
| # |
| # This template assumes that the following files exist for the driver: |
| # * simple-${target_name}.bind - the driver's bind rules |
| # * ${target_name}_bind_tests.json - the driver's bind tests |
| # * simple-${target_name}.cc - the driver's C++ source code |
| # * simple.${target_name}-info.json - the driver's info |
| # |
| # Parameters |
| # |
| # is_fallback (optional) |
| # Whether or not the driver is a fallback driver |
| # Type: boolean |
| # Default: false |
| template("simple_fuchsia_driver") { |
| not_needed(invoker, "*") |
| driver_name = target_name |
| driver_bind_rules("simple-${driver_name}-bind") { |
| rules = "simple-${driver_name}.bind" |
| tests = "${driver_name}_bind_tests.json" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.pci:fuchsia.hardware.pci_bindlib", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_bindlib", |
| "//src/devices/bind/fuchsia.acpi", |
| "//src/devices/bind/fuchsia.pci", |
| ] |
| } |
| |
| fuchsia_driver("simple.${driver_name}-driver") { |
| output_name = "simple.${driver_name}" |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| sources = [ "simple-${driver_name}.cc" ] |
| deps = [ |
| ":shared", |
| ":simple-${driver_name}-bind", |
| "//sdk/banjo/fuchsia.hardware.display.controller:fuchsia.hardware.display.controller_banjo_cpp", |
| "//src/devices/pci/lib/device-protocol-pci", |
| "//src/devices/pci/lib/pci", |
| "//src/lib/ddk", |
| ] |
| } |
| |
| fuchsia_driver_component("simple.${driver_name}") { |
| component_name = "simple.${driver_name}" |
| deps = [ ":simple.${driver_name}-driver" ] |
| info = "simple.${driver_name}-info.json" |
| manifest = "meta/${driver_name}.cml" |
| } |
| |
| fuchsia_driver_package("simple-${driver_name}-package") { |
| package_name = "simple.${driver_name}" |
| driver_components = [ ":simple.${driver_name}" ] |
| } |
| } |
| |
| simple_fuchsia_driver("bochs") { |
| } |
| simple_fuchsia_driver("intel") { |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":simple-bochs-bind_test", |
| ":simple-display-test", |
| ":simple-intel-bind_test", |
| ] |
| } |