| # Copyright 2026 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. | |
| # Support libraries for C++ DSO components. See //src/sys/runners/dso/README.md | |
| # for more information. | |
| # | |
| # DSO runner supports two kinds of components: "sync" and "async". Sync | |
| # components receive a dedicated thread -- their dso_main() is very similar to | |
| # standard main(). Async components may share a thread and run on a Fuchsia | |
| # Driver Framework dispatcher (`fdf_dispatcher_t*`). DSO components that are | |
| # written in C++ should depend on the corresponding library depending on if they | |
| # are sync or async. Most users should use the convenience "fuchsia_cc_dso" | |
| # wrapper in `fuchsia_dso.gni` to do this for them. | |
| load("//build/bazel/rules/cc:fx_cc_library.bzl", "fx_cc_library") | |
| package(default_applicable_licenses = ["//:license"]) | |
| fx_cc_library( | |
| name = "sync", | |
| srcs = ["sync.cc"], | |
| hdrs = ["sync.h"], | |
| implementation_deps = [ | |
| # On Fuchsia, //zircon/system/public would shadow the sysroot's | |
| # <zircon/syscalls.h> without the generated syscalls/gen/*.inc files. | |
| "//src/zircon/lib/zircon:headers", # @bazel2gn:path_overwrite://zircon/system/public | |
| ], | |
| target_compatible_with = ["@platforms//os:fuchsia"], | |
| # fuchsia_cc_dso() in //src/lib/dso/fuchsia_dso.gni expands in callers' GN packages. | |
| visibility = [ | |
| "//examples/components/dso:__pkg__", | |
| "//src/lib/dso:__pkg__", | |
| "//src/sys/runners/dso:__subpackages__", | |
| "//src/ui/bin/scene_manager:__pkg__", | |
| "//src/ui/scenic/bin:__pkg__", | |
| ], | |
| alwayslink = True, | |
| ) | |
| # TODO(https://fxbug.dev/503359085): Migrate to Bazel once | |
| # //src/devices/bin/driver_runtime is available in Bazel. | |
| fx_cc_library( | |
| name = "async", | |
| srcs = ["async.cc"], | |
| hdrs = ["async.h"], | |
| implementation_deps = [ | |
| "//src/devices/lib/driver:driver_runtime", # @bazel2gn:path_overwrite://src/devices/bin/driver_runtime | |
| ], | |
| target_compatible_with = ["@platforms//os:fuchsia"], | |
| # fuchsia_cc_dso() in //src/lib/dso/fuchsia_dso.gni expands in callers' GN packages. | |
| visibility = [ | |
| "//examples/components/dso:__pkg__", | |
| "//src/lib/dso:__pkg__", | |
| "//src/sys/runners/dso:__subpackages__", | |
| "//src/ui/scenic/bin:__pkg__", | |
| ], | |
| deps = [ | |
| "//sdk/lib/driver/runtime:driver_runtime", | |
| # On Fuchsia, //zircon/system/public would shadow the sysroot's | |
| # <zircon/syscalls.h> without the generated syscalls/gen/*.inc files. | |
| "//src/zircon/lib/zircon:headers", # @bazel2gn:path_overwrite://zircon/system/public | |
| ], | |
| alwayslink = True, | |
| ) |