| # 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("../gn/build_rules.gni") |
| |
| # |
| # Common targets that only depend on Vulkan and the Vulkan API. |
| # |
| source_set("common") { |
| sources = [ |
| "common/demo_app_base.cc", |
| "common/demo_app_base.h", |
| "common/demo_image.h", |
| "common/demo_image_group.h", |
| "common/demo_utils.cc", |
| "common/demo_utils.h", |
| "common/vulkan_device.cc", |
| "common/vulkan_device.h", |
| "common/vulkan_window.cc", |
| "common/vulkan_window.h", |
| ] |
| public_deps = [ |
| "${graphics_compute_dir}/tests:common_vk", |
| "${graphics_compute_dir}/tests/common/spinel:spinel_utils", |
| ] |
| } |
| |
| graphics_compute_unittests("common_vk_unittests") { |
| sources = [ "common/demo_vulkan_app_unittest.cc" ] |
| deps = [ ":common" ] |
| } |
| |
| # |
| # Common source files for demos that use Spinel. |
| # |
| source_set("common_spinel") { |
| sources = [ |
| "common/demo_app_spinel.cc", |
| "common/demo_app_spinel.h", |
| "common/vulkan_device_spinel.cc", |
| ] |
| public_deps = [ |
| ":common", |
| "${graphics_compute_dir}/spinel:spinel_vk_for_tests", |
| "${graphics_compute_dir}/tests/common/spinel_vk:spinel_vk_utils", |
| ] |
| } |
| |
| # |
| # A template used to define a set of demo programs that use Spinel |
| # as backends for the Spinel API. |
| # |
| # Accepts all variables from graphics_compute_executable() plus: |
| # |
| # spinel_backend: A required string that must be "spinel" |
| # |
| template("graphics_compute_spinel_demo_executable") { |
| assert(defined(invoker.spinel_backend), "spinel_backend must be defined!") |
| |
| graphics_compute_executable(target_name) { |
| forward_variables_from(invoker, "*", [ "spinel_backend" ]) |
| |
| if (!defined(defines)) { |
| defines = [] |
| } |
| defines += [ "PROGRAM_NAME=\"${target_name}\"" ] |
| |
| if (!defined(deps)) { |
| deps = [] |
| } |
| |
| if (invoker.spinel_backend == "spinel") { |
| deps += [ |
| ":common", |
| ":common_spinel", |
| ] |
| } else { |
| assert(false, "Invalid spinel_backend value: ${invoker.spinel_backend}") |
| } |
| |
| needs_vulkan = true |
| } |
| } |
| |
| # Defines several executable targets for a Spinel API demo. |
| # |
| # Each one with a spinel_${target_name} or mold_${target_name} prefix. |
| # This makes it easy to share common demo code between several backends. |
| # |
| template("graphics_compute_spinel_demo") { |
| graphics_compute_spinel_demo_executable("spinel-${target_name}") { |
| forward_variables_from(invoker, "*", [ "target_name" ]) |
| spinel_backend = "spinel" |
| } |
| |
| group(target_name) { |
| deps = [ ":spinel-${target_name}" ] |
| } |
| } |
| |
| # |
| # Demo programs that display an input SVG file |
| # |
| graphics_compute_spinel_demo("svg-demo") { |
| sources = [ "main_svg_demo.cc" ] |
| deps = [ "${graphics_compute_dir}/tests/common/svg" ] |
| } |
| |
| # |
| # Demo programs that display an input SVG file in a ring. |
| # |
| source_set("svg_scene_demo_image") { |
| sources = [ |
| "svg_scene_demo_image.cc", |
| "svg_scene_demo_image.h", |
| ] |
| deps = [ |
| ":common", |
| "${graphics_compute_dir}/spinel/ext/color", |
| "${graphics_compute_dir}/spinel/ext/transform_stack", |
| "${graphics_compute_dir}/tests/common/svg", |
| ] |
| } |
| |
| graphics_compute_spinel_demo("ring-demo") { |
| sources = [ "main_svg_ring_demo.cc" ] |
| deps = [ |
| ":svg_scene_demo_image", |
| "${graphics_compute_dir}/tests/common/svg", |
| ] |
| } |
| |
| # |
| # All examples in this group. |
| # |
| group("examples") { |
| deps = [ |
| ":ring-demo", |
| ":svg-demo", |
| ] |
| } |