| # Copyright 2018 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/components.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//src/lib/vulkan/layers.gni") |
| import("//src/sys/core/build/core_shard.gni") |
| |
| declare_args() { |
| # Include the vulkan validation layers in carnelian examples. |
| carnelian_enable_vulkan_validation = is_debug |
| |
| # Point this to the location of external image files to be included as extras |
| carnelian_static_images_extras = [] |
| |
| # Point this to the location of external rive files to be included as extras |
| carnelian_static_rives_extras = [] |
| |
| # Point this to the location of external txt files to be included as extras |
| carnelian_static_txts_extras = [] |
| |
| # Include a config in the example packages to attempt to use Spinel |
| use_spinel_for_carnelian_examples = false |
| |
| # Include a config in the example packages to attempt to use view mode |
| # direct. |
| use_direct_for_carnelian_examples = false |
| } |
| |
| rustc_library("carnelian") { |
| name = "carnelian" |
| with_unit_tests = true |
| version = "0.1.0" |
| edition = "2021" |
| deps = [ |
| "//sdk/fidl/fuchsia.fonts:fuchsia.fonts-rustc", |
| "//sdk/fidl/fuchsia.hardware.display:fuchsia.hardware.display-rustc", |
| "//sdk/fidl/fuchsia.hardware.input:fuchsia.hardware.input-rustc", |
| "//sdk/fidl/fuchsia.images:fuchsia.images-rustc", |
| "//sdk/fidl/fuchsia.input:fuchsia.input-rustc", |
| "//sdk/fidl/fuchsia.input.report:fuchsia.input.report-rustc", |
| "//sdk/fidl/fuchsia.math:fuchsia.math-rustc", |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem-rustc", |
| "//sdk/fidl/fuchsia.scenic.scheduling:fuchsia.scenic.scheduling-rustc", |
| "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem-rustc", |
| "//sdk/fidl/fuchsia.ui.app:fuchsia.ui.app-rustc", |
| "//sdk/fidl/fuchsia.ui.composition:fuchsia.ui.composition-rustc", |
| "//sdk/fidl/fuchsia.ui.gfx:fuchsia.ui.gfx-rustc", |
| "//sdk/fidl/fuchsia.ui.input:fuchsia.ui.input-rustc", |
| "//sdk/fidl/fuchsia.ui.input3:fuchsia.ui.input3-rustc", |
| "//sdk/fidl/fuchsia.ui.pointer:fuchsia.ui.pointer-rustc", |
| "//sdk/fidl/fuchsia.ui.policy:fuchsia.ui.policy-rustc", |
| "//sdk/fidl/fuchsia.ui.scenic:fuchsia.ui.scenic-rustc", |
| "//sdk/fidl/fuchsia.ui.views:fuchsia.ui.views-rustc", |
| "//src/graphics/lib/compute/forma", |
| "//src/graphics/lib/compute/rive-rs", |
| "//src/lib/async-utils", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/mapped-vmo", |
| "//src/lib/storage/fuchsia-vfs-watcher", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/fuchsia-framebuffer", |
| "//src/lib/ui/fuchsia-scenic", |
| "//src/lib/ui/fuchsia-vulkan", |
| "//src/lib/ui/keymaps", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/testing/fidl:placeholders-rustc", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:lipsum", |
| "//third_party/rust_crates:once_cell", |
| "//third_party/rust_crates:png", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:rustc-hash", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:smallvec", |
| "//third_party/rust_crates:static_assertions", |
| "//third_party/rust_crates:toml", |
| "//third_party/rust_crates:ttf-parser", |
| "//third_party/rust_crates:vk-sys", |
| ] |
| |
| sources = [ |
| "src/app.rs", |
| "src/app/strategies.rs", |
| "src/app/strategies/base.rs", |
| "src/app/strategies/framebuffer.rs", |
| "src/app/strategies/scenic.rs", |
| "src/color.rs", |
| "src/drawing.rs", |
| "src/geometry.rs", |
| "src/input.rs", |
| "src/input/flatland.rs", |
| "src/input/key3.rs", |
| "src/input/report.rs", |
| "src/input/scenic.rs", |
| "src/input/tests.rs", |
| "src/input_ext.rs", |
| "src/lib.rs", |
| "src/message.rs", |
| "src/render/dynamic.rs", |
| "src/render/generic/forma/composition.rs", |
| "src/render/generic/forma/context.rs", |
| "src/render/generic/forma/image.rs", |
| "src/render/generic/forma/mod.rs", |
| "src/render/generic/forma/path.rs", |
| "src/render/generic/forma/raster.rs", |
| "src/render/generic/mod.rs", |
| "src/render/mod.rs", |
| "src/render/rive.rs", |
| "src/render/shed.rs", |
| "src/scene/facets.rs", |
| "src/scene/group.rs", |
| "src/scene/layout.rs", |
| "src/scene/mod.rs", |
| "src/scene/scene.rs", |
| "src/view.rs", |
| "src/view/strategies.rs", |
| "src/view/strategies/base.rs", |
| "src/view/strategies/display_direct.rs", |
| "src/view/strategies/flatland.rs", |
| "src/view/strategies/scenic.rs", |
| ] |
| |
| inputs = [ "//prebuilt/third_party/fonts/robotoslab/RobotoSlab-Regular.ttf" ] |
| |
| if (carnelian_enable_vulkan_validation) { |
| features = [ "vulkan-validation" ] |
| } |
| |
| configs += [ ":carnelian-performance" ] |
| } |
| |
| config("carnelian-performance") { |
| # Enable all optimizations that benefit speed, even if they increase size |
| configs = [ |
| "//build/config:optimize_speed", |
| "//build/config/lto:thinlto", |
| ] |
| |
| if (target_cpu == "x64") { |
| # TODO(fxbug.dev/87582): not all x64 targets are haswell. |
| # Consider moving this to a board config. |
| configs += [ "//build/config/x64:haswell" ] |
| } |
| |
| if (target_cpu == "arm64") { |
| # TODO(fxbug.dev/87243): the flag below is not added by default. |
| # It's safe to remove the line below when //build/config/arm64:cortex-a53 |
| # picks up this flag. |
| # Also note that not all arm64 targets are cortex-a53. |
| # Depending on your target board this optimization flag may actually |
| # cause a regression. |
| rustflags = [ "-Ctarget-cpu=cortex-a53" ] |
| } |
| } |
| |
| rustc_binary("button") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/button.rs" |
| sources = [ "examples/button.rs" ] |
| deps = [ |
| "//src/lib/fuchsia-async", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:euclid", |
| ] |
| } |
| |
| rustc_binary("clockface") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/clockface.rs" |
| sources = [ "examples/clockface.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:euclid", |
| ] |
| } |
| |
| rustc_binary("font_metrics") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/font_metrics.rs" |
| sources = [ "examples/font_metrics.rs" ] |
| deps = [ |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:lipsum", |
| ] |
| } |
| |
| rustc_binary("ink") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/ink.rs" |
| sources = [ "examples/ink.rs" ] |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.input:fuchsia.hardware.input-rustc", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:rand", |
| ] |
| } |
| |
| rustc_binary("shapes") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/shapes.rs" |
| sources = [ "examples/shapes.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:rand", |
| ] |
| } |
| |
| rustc_binary("designer") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/designer.rs" |
| sources = [ "examples/designer.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:euclid", |
| ] |
| } |
| |
| rustc_binary("spinning_square") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/spinning_square.rs" |
| sources = [ "examples/spinning_square.rs" ] |
| deps = [ |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/testing/fidl:placeholders-rustc", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:futures", |
| ] |
| } |
| |
| rustc_binary("gamma") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/gamma.rs" |
| sources = [ "examples/gamma.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:euclid", |
| ] |
| } |
| |
| rustc_binary("layout_gallery") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/layout_gallery.rs" |
| sources = [ "examples/layout_gallery.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:toml", |
| ] |
| } |
| |
| rustc_test("layout_gallery_test") { |
| version = "0.1.0" |
| edition = "2018" |
| source_root = "examples/layout_gallery.rs" |
| sources = [ "examples/layout_gallery.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:toml", |
| ] |
| } |
| |
| rustc_binary("png") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/png.rs" |
| sources = [ "examples/png.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:png", |
| ] |
| } |
| |
| rustc_binary("svg") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/svg.rs" |
| sources = [ "examples/svg.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:euclid", |
| ] |
| } |
| |
| rustc_binary("rive") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/rive.rs" |
| sources = [ "examples/rive.rs" ] |
| deps = [ |
| "//src/graphics/lib/compute/rive-rs", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/testing/fidl:placeholders-rustc", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:futures", |
| ] |
| } |
| |
| rustc_binary("textgrid") { |
| version = "0.1.0" |
| edition = "2021" |
| source_root = "examples/textgrid.rs" |
| sources = [ "examples/textgrid.rs" ] |
| deps = [ |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:euclid", |
| "//third_party/rust_crates:rustc-hash", |
| ] |
| } |
| |
| fuchsia_unittest_package("carnelian-render-tests") { |
| manifest = "meta/carnelian_lib_test.cml" |
| deps = [ |
| ":carnelian_test", |
| "//src/lib/vulkan:vulkan_validation_layers", |
| ] |
| } |
| |
| fuchsia_unittest_package("carnelian-tests") { |
| manifest = "meta/carnelian_lib_test.cml" |
| deps = [ ":carnelian_test" ] |
| } |
| |
| fuchsia_unittest_package("carnelian-layout-tests") { |
| deps = [ ":layout_gallery_test" ] |
| } |
| |
| rustc_binary("carnelian_integration_test_bin") { |
| name = "carnelian_integration_test" |
| edition = "2018" |
| source_root = "tests/carnelian_integration_test.rs" |
| sources = [ "tests/carnelian_integration_test.rs" ] |
| deps = [ |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| ] |
| } |
| |
| fuchsia_component("carnelian-integration-test-component") { |
| testonly = true |
| manifest = "meta/carnelian_integration_test.cmx" |
| deps = [ ":carnelian_integration_test_bin" ] |
| } |
| |
| fuchsia_test_package("carnelian-integration-test") { |
| test_components = [ ":carnelian-integration-test-component" ] |
| deps = [ ":carnelian-integration-test-component" ] |
| test_specs = { |
| environments = [ nuc_env ] |
| } |
| } |
| |
| rustc_binary("carnelian_fb_integration_test_bin") { |
| name = "carnelian_fb_integration_test" |
| edition = "2018" |
| source_root = "tests/carnelian_integration_test.rs" |
| sources = [ "tests/carnelian_integration_test.rs" ] |
| deps = [ |
| "//src/lib/ui/carnelian", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| ] |
| } |
| |
| fuchsia_component("carnelian-fb-integration-test-component") { |
| testonly = true |
| manifest = "meta/carnelian_fb_integration_test.cmx" |
| deps = [ ":carnelian_fb_integration_test_bin" ] |
| } |
| |
| fuchsia_test_package("carnelian-fb-integration-test") { |
| test_components = [ ":carnelian-fb-integration-test-component" ] |
| deps = [ ":carnelian-fb-integration-test-component" ] |
| test_specs = { |
| environments = [ nuc_env ] |
| } |
| } |
| |
| resource("robotoslab") { |
| sources = [ "//prebuilt/third_party/fonts/robotoslab/RobotoSlab-Regular.ttf" ] |
| outputs = [ "data/fonts/{{source_file_part}}" ] |
| } |
| |
| resource("quintessential") { |
| sources = [ |
| "//prebuilt/third_party/fonts/quintessential/Quintessential-Regular.ttf", |
| ] |
| outputs = [ "data/fonts/{{source_file_part}}" ] |
| } |
| |
| resource("droidserif") { |
| sources = [ "//prebuilt/third_party/fonts/droidserif/DroidSerif-Regular.ttf" ] |
| outputs = [ "data/fonts/{{source_file_part}}" ] |
| } |
| |
| resource("shortstack") { |
| sources = [ "//prebuilt/third_party/fonts/shortstack/ShortStack-Regular.ttf" ] |
| outputs = [ "data/fonts/{{source_file_part}}" ] |
| } |
| |
| resource("roboto") { |
| sources = [ "//prebuilt/third_party/fonts/roboto/Roboto-Regular.ttf" ] |
| outputs = [ "data/fonts/{{source_file_part}}" ] |
| } |
| |
| resource("robotomono") { |
| sources = [ "//prebuilt/third_party/fonts/robotomono/RobotoMono-Regular.ttf" ] |
| outputs = [ "data/fonts/{{source_file_part}}" ] |
| } |
| |
| resource("static_images") { |
| sources = [ |
| "examples/static/baboon.png", |
| "examples/static/cross.png", |
| "examples/static/lenna.png", |
| ] + carnelian_static_images_extras |
| outputs = [ "data/static/{{source_file_part}}" ] |
| } |
| |
| resource("static_sheds") { |
| sources = [ "examples/static/fuchsia.shed" ] |
| outputs = [ "data/static/{{source_file_part}}" ] |
| } |
| |
| resource("static_rives") { |
| sources = [ |
| "examples/static/juice.riv", |
| "examples/static/knight.riv", |
| ] + carnelian_static_rives_extras |
| outputs = [ "data/static/{{source_file_part}}" ] |
| } |
| |
| resource("static_txts") { |
| sources = [ |
| "examples/static/nyancat.txt", |
| "examples/static/spinningcursor.txt", |
| ] + carnelian_static_txts_extras |
| outputs = [ "data/static/{{source_file_part}}" ] |
| } |
| |
| resource("direct_config") { |
| sources = [ "config/direct_config.toml" ] |
| outputs = [ "data/config/carnelian.toml" ] |
| } |
| |
| # TODO: add example that makes use of a pre-copy shader. |
| # resource("shaders") { |
| # sources = [ |
| # "src/render/shaders/copy.comp.spv", |
| # ] |
| # outputs = [ "data/shaders/{{source_file_part}}" ] |
| # } |
| |
| # A custom template for carnelian examples to support |
| # dynamic enabling of the vulkan validation layers |
| template("carnelian_example") { |
| example_deps = invoker.deps |
| if (carnelian_enable_vulkan_validation) { |
| example_deps += [ "//src/lib/vulkan/validation_layers" ] |
| } |
| if (use_direct_for_carnelian_examples) { |
| example_deps += [ ":direct_config" ] |
| } |
| |
| example_component_target = "$target_name" + "_v2" |
| component_name = "$target_name" |
| fuchsia_component(example_component_target) { |
| component_name = component_name |
| manifest = invoker.manifest |
| deps = example_deps |
| manifest_deps = invoker.manifest_deps |
| } |
| |
| example_v1_component_target = "$target_name" + "_v1" |
| fuchsia_component(example_v1_component_target) { |
| component_name = component_name |
| manifest = invoker.v1_manifest |
| deps = example_deps |
| manifest_deps = invoker.v1_manifest_deps |
| } |
| |
| fuchsia_package(target_name) { |
| deps = [ |
| ":$example_component_target", |
| ":$example_v1_component_target", |
| ] |
| } |
| } |
| |
| # To add an example to the build, add its name |
| # and any addition dependencies like fonts or static image |
| # assets to the list below. |
| carnelian_examples = [ |
| { |
| name = "button" |
| additional_deps = [ ":robotoslab" ] |
| }, |
| { |
| name = "clockface" |
| }, |
| { |
| name = "font_metrics" |
| additional_deps = [ |
| ":droidserif", |
| ":quintessential", |
| ":roboto", |
| ":robotoslab", |
| ":shortstack", |
| ] |
| }, |
| { |
| name = "gamma" |
| }, |
| { |
| name = "ink" |
| }, |
| { |
| name = "layout_gallery" |
| additional_deps = [ ":robotoslab" ] |
| }, |
| { |
| name = "png" |
| additional_deps = [ ":static_images" ] |
| }, |
| { |
| name = "shapes" |
| }, |
| { |
| name = "designer" |
| }, |
| { |
| name = "spinning_square" |
| additional_deps = [ ":robotoslab" ] |
| }, |
| { |
| name = "svg" |
| additional_deps = [ ":static_sheds" ] |
| }, |
| { |
| name = "rive" |
| additional_deps = [ ":static_rives" ] |
| }, |
| { |
| name = "textgrid" |
| additional_deps = [ |
| ":robotomono", |
| ":static_txts", |
| ] |
| }, |
| ] |
| |
| # List for populating the examples group below |
| carnelian_examples_deps = [] |
| |
| # Rebased path to the example shard |
| carnelian_example_manifest_include = |
| "//" + rebase_path("meta/example.shard.cml", "//") |
| |
| # Temporarily generate v1 and v2 components until workstation is migrated |
| # to using the v2 examples exclusively. |
| # TODO(http://fxbug.dev/100933): Remove this. |
| carnelian_example_v1_manifest_include = |
| "//" + rebase_path("meta/example.shard.cmx", "//") |
| |
| foreach(carnelian_example_details, carnelian_examples) { |
| carnelian_example_package_name = |
| string_replace(carnelian_example_details.name, "_", "-") + "-rs" |
| |
| carnelian_example_manifest_label = |
| "generate_${carnelian_example_details.name}_cml" |
| carnelian_example_v1_manifest_label = |
| "generate_${carnelian_example_details.name}_cmx" |
| |
| carnelian_example_manifest_path = |
| "${target_gen_dir}/${carnelian_example_package_name}.cml" |
| carnelian_example_v1_manifest_path = |
| "${target_gen_dir}/${carnelian_example_package_name}.cmx" |
| |
| # Generate a manifest file for the example |
| # that has the name of the binary but otherwise |
| # just depends on the example.shard.cml for needed |
| # content |
| generated_file(carnelian_example_manifest_label) { |
| visibility = [ ":*" ] |
| |
| outputs = [ carnelian_example_manifest_path ] |
| output_conversion = "json" |
| contents = { |
| include = [ carnelian_example_manifest_include ] |
| program = { |
| runner = "elf" |
| binary = "bin/${carnelian_example_details.name}" |
| } |
| } |
| } |
| |
| generated_file(carnelian_example_v1_manifest_label) { |
| visibility = [ ":*" ] |
| |
| outputs = [ carnelian_example_v1_manifest_path ] |
| output_conversion = "json" |
| contents = { |
| include = [ carnelian_example_v1_manifest_include ] |
| program = { |
| binary = "bin/${carnelian_example_details.name}" |
| } |
| } |
| } |
| |
| # Use the carnelian_example template to create a target |
| # for the example |
| carnelian_example(carnelian_example_package_name) { |
| manifest = rebase_path(carnelian_example_manifest_path) |
| v1_manifest = rebase_path(carnelian_example_v1_manifest_path) |
| |
| deps = [ ":" + carnelian_example_details.name ] |
| manifest_deps = [ ":${carnelian_example_manifest_label}" ] |
| v1_manifest_deps = [ ":${carnelian_example_v1_manifest_label}" ] |
| if (defined(carnelian_example_details.additional_deps)) { |
| deps += carnelian_example_details.additional_deps |
| } |
| } |
| carnelian_examples_deps += |
| [ "//src/lib/ui/carnelian:" + carnelian_example_package_name ] |
| } |
| |
| core_shard("carnelian_examples_shard") { |
| shard_file = "meta/carnelian_examples.core_shard.cml" |
| } |
| |
| group("examples") { |
| public_deps = carnelian_examples_deps |
| } |