| 1 |
# Rules for building C++ things in general |
| 2 |
bazel_dep(name = "rules_cc", version = "0.1.1") |
| 3 |
bazel_dep(name = "platforms", version = "0.0.11") |
| 4 |
|
| 5 |
# TODO(kjlubick) publish to https://registry.bazel.build/ for better interop |
| 6 |
# bazel_dep(name = "skia", version = "137.0.0") |
| 7 |
|
| 8 |
# A real client should download a pinned version of Skia by putting the following |
| 9 |
# in a file called skia.bzl: |
| 10 |
# |
| 11 |
# load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") |
| 12 |
# |
| 13 |
# def _skia_ext_impl(ctx): |
| 14 |
# git_repository( |
| 15 |
# name = "skia", |
| 16 |
# commit = "99822dd8249dfe3773cbd7ca56bb1767bf92fa22", |
| 17 |
# remote = "https://skia.googlesource.com/skia", |
| 18 |
# ) |
| 19 |
# |
| 20 |
# skia_ext = module_extension( |
| 21 |
# implementation = _skia_ext_impl, |
| 22 |
# ) |
| 23 |
# |
| 24 |
# and then in MODULE.bazel: |
| 25 |
# skia_ext = use_extension("//:skia.bzl", "skia_ext") |
| 26 |
# use_repo(skia_ext, "skia") |
| 27 |
|
| 28 |
# We use local_repository to allow us to test Skia at head as if it were checked |
| 29 |
# out via git_repository. |
| 30 |
bazel_dep(name = "skia") |
| 31 |
local_path_override( |
| 32 |
module_name = "skia", |
| 33 |
path = "../..", |
| 34 |
) |
| 35 |
|
| 36 |
# Clients need to define a target here named "skia_user_config" that points to a |
| 37 |
# Bazel workspace with: |
| 38 |
# - a user_config cc_library rule that has SkiaUserConfig.h available and |
| 39 |
# the SK_USE_BAZEL_CONFIG_HEADER define set. |
| 40 |
# - A copts.bzl file with at least two string lists: DEFAULT_COPTS, DEFAULT_OBJC_COPTS |
| 41 |
# These lists can be empty if you want to use the toolchain's default. |
| 42 |
# - a linkopts.bzl file with at least the string list DEFAULT_LINKOPTS |
| 43 |
# This list can be empty if you want to use the toolchain's default. |
| 44 |
bazel_dep(name = "skia_user_config") |
| 45 |
local_path_override( |
| 46 |
module_name = "skia_user_config", |
| 47 |
path = "custom_skia_config", |
| 48 |
) |
| 49 |
|
| 50 |
# bzlmod doesn't allow for transitive dependencies, so if your rules depend on |
| 51 |
# these headers directly, you must include them. Ideally, you'd use bazel_dep |
| 52 |
# from the registry, but some of them aren't there, so you may have to make |
| 53 |
# your own rules. Feel free to crib them off Skia's bazel/external directory. |
| 54 |
|
| 55 |
skia_deps = use_extension("@skia//bazel:cpp_modules.bzl", "cpp_modules") |
| 56 |
skia_deps.from_file(deps_json = "@skia//bazel:deps.json") |
| 57 |
use_repo( |
| 58 |
skia_deps, |
| 59 |
"dawn", |
| 60 |
"delaunator", |
| 61 |
"dng_sdk", |
| 62 |
"expat", |
| 63 |
"freetype", |
| 64 |
"harfbuzz", |
| 65 |
"icu", |
| 66 |
"icu4x", |
| 67 |
"imgui", |
| 68 |
"libavif", |
| 69 |
"libgav1", |
| 70 |
"libjpeg_turbo", |
| 71 |
"libjxl", |
| 72 |
"libpng", |
| 73 |
"libwebp", |
| 74 |
"libyuv", |
| 75 |
"perfetto", |
| 76 |
"piex", |
| 77 |
"spirv_cross", |
| 78 |
"spirv_headers", |
| 79 |
"spirv_tools", |
| 80 |
"vello", |
| 81 |
"vulkan_headers", |
| 82 |
"vulkan_tools", |
| 83 |
"vulkan_utility_libraries", |
| 84 |
"vulkanmemoryallocator", |
| 85 |
"wuffs", |
| 86 |
"zlib", |
| 87 |
) |