skia2/tools/sk_app/BUILD.bazel
Jorge Betancourt 9be648ad64 set up GL sample app to build through Bazel Mac toolchain
Suggested review order.
1) tools/sk_app/* and src/gpu/ganesh/*
sets up the actual target to be built by the toolchain
2) toolchain/* and .bazelrc
changes to the mac hermetic toolchain, including support for framework dependencies, objc compilation, and dynamic lib dependency resolution

Change-Id: Ic8209b97a0d8448f984d43a579e600ba4e9118e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549897
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-06-17 13:54:14 +00:00

132 lines
3.2 KiB
Python

load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "select_multi", "selects")
#TODO: shim through macros.bzl for g3 compatability
load("@rules_cc//cc:defs.bzl", "objc_library")
licenses(["notice"])
exports_files_legacy()
selects.config_setting_group(
name = "dawn_unix",
match_all = [
"//bazel/common_config_settings:dawn_backend",
"@platforms//os:linux",
],
)
selects.config_setting_group(
name = "gl_unix",
match_all = [
"//bazel/common_config_settings:gl_backend",
"@platforms//os:linux",
],
)
selects.config_setting_group(
name = "gl_mac",
match_all = [
"//bazel/common_config_settings:gl_backend",
"@platforms//os:macos",
],
)
selects.config_setting_group(
name = "vulkan_unix",
match_all = [
"//bazel/common_config_settings:vulkan_backend",
"@platforms//os:linux",
],
)
cc_library(
name = "sk_app",
testonly = True,
srcs = [
"Window.cpp",
"WindowContext.cpp",
"RasterWindowContext.h",
] + select_multi(
{
"//bazel/common_config_settings:dawn_backend": [
"DawnWindowContext.h",
"DawnWindowContext.cpp",
],
"//bazel/common_config_settings:gl_backend": [
"GLWindowContext.cpp",
"GLWindowContext.h",
],
"//bazel/common_config_settings:vulkan_backend": [
"VulkanWindowContext.h",
"VulkanWindowContext.cpp",
],
},
default = [],
) + select({
"@platforms//os:linux": ["//tools/sk_app/unix:srcs"],
"//conditions:default": [],
# TODO(kjlubick) add Windows/Mac support
}),
hdrs = [
"Application.h",
"DisplayParams.h",
"Window.h",
"WindowContext.h",
],
visibility = ["//:__subpackages__"],
deps = [
"//:skia_internal",
"//tools/skui",
"//tools/timer",
] + select({
"@platforms//os:linux": ["//tools/sk_app/unix:deps"],
"//conditions:default": [],
}),
)
objc_library(
name = "sk_app_objc",
testonly = True,
srcs = [
"Window.cpp",
"WindowContext.cpp",
"RasterWindowContext.h",
] + select_multi(
{
"//bazel/common_config_settings:gl_backend": [
"GLWindowContext.cpp",
"GLWindowContext.h",
],
#TODO dawn and metal backend
},
default = [],
) + select({
"@platforms//os:macos": ["//tools/sk_app/mac:srcs"],
"//conditions:default": [],
# TODO ios support
}),
hdrs = [
"Application.h",
"DisplayParams.h",
"Window.h",
"WindowContext.h",
],
copts = [
"-Wno-deprecated-declarations",
],
sdk_frameworks = [
"QuartzCore",
"Cocoa",
"Foundation",
],
visibility = ["//:__subpackages__"],
deps = [
"//:skia_internal",
"//tools/skui",
"//tools/timer",
] + select({
"@platforms//os:macos": ["//tools/sk_app/mac:deps"],
"//conditions:default": [],
}),
)