Skip to content

Commit e29e2c3

Browse files
bigfootjonfacebook-github-bot
authored andcommitted
migrate backends/vulkan/tools/gpuinfo (TARGETS+BUCK with similar rules) (#21432)
Summary: Both files defined the same target names with cell-specific differences (TARGETS: is_fbcode=True for vulkan_spv_shader_lib, no compiler_flags; BUCK: extra arvr opencl + folly:json deps, compiler_flags select). Combined into a new targets.bzl that branches on is_fbcode for the fb_xplat_cxx_binary, with the buck_filegroup and vulkan_spv_shader_lib shared. Reviewed By: ndmitchell Differential Revision: D109082051
1 parent 9cbb110 commit e29e2c3

3 files changed

Lines changed: 80 additions & 105 deletions

File tree

backends/vulkan/tools/gpuinfo/BUCK

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,9 @@
1-
load("@fbcode_macros//build_defs:native_rules.bzl", "buck_filegroup")
2-
load("@fbsource//tools/build_defs:fb_xplat_cxx_binary.bzl", "fb_xplat_cxx_binary")
3-
load(
4-
"@fbsource//tools/build_defs:platform_defs.bzl",
5-
"ANDROID",
6-
)
7-
load(
8-
"@fbsource//xplat/executorch/backends/vulkan:targets.bzl",
9-
"vulkan_spv_shader_lib",
10-
)
1+
# Any targets that should be shared between fbcode and xplat must be defined in
2+
# targets.bzl.
113

12-
oncall("executorch")
13-
14-
buck_filegroup(
15-
name = "gpuinfo_shaders",
16-
srcs = glob([
17-
"glsl/*",
18-
]),
19-
visibility = [
20-
"PUBLIC",
21-
],
22-
)
4+
load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode")
5+
load(":targets.bzl", "define_common_targets")
236

24-
vulkan_spv_shader_lib(
25-
name = "gpuinfo_shader_lib",
26-
spv_filegroups = {
27-
":gpuinfo_shaders": "glsl",
28-
},
29-
)
7+
oncall("executorch")
308

31-
fb_xplat_cxx_binary(
32-
name = "vulkan_gpuinfo",
33-
srcs = glob([
34-
"**/*.cpp",
35-
]),
36-
headers = glob([
37-
"**/*.h",
38-
]),
39-
compiler_flags = select({
40-
"DEFAULT": [
41-
"-Wno-header-hygiene",
42-
],
43-
"ovr_config//compiler:cl": [],
44-
}),
45-
header_namespace = "/include",
46-
include_directories = ["/include"],
47-
platforms = ANDROID,
48-
raw_headers = glob([
49-
"**/*.h",
50-
]),
51-
deps = [
52-
":gpuinfo_shader_lib",
53-
"//arvr/third-party/opencl:headers",
54-
"//arvr/third-party/opencl:runtime",
55-
"//xplat/executorch/backends/vulkan:vulkan_graph_runtime",
56-
"//xplat/folly:json",
57-
],
58-
)
9+
define_common_targets(is_fbcode = is_fbcode())

backends/vulkan/tools/gpuinfo/TARGETS

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
load("@fbcode_macros//build_defs:native_rules.bzl", "buck_filegroup")
2+
load("@fbsource//tools/build_defs:fb_xplat_cxx_binary.bzl", "fb_xplat_cxx_binary")
3+
load("@fbsource//tools/build_defs:platform_defs.bzl", "ANDROID")
4+
load("@fbsource//xplat/executorch/backends/vulkan:targets.bzl", "vulkan_spv_shader_lib")
5+
6+
def define_common_targets(is_fbcode = False):
7+
"""Combined fbcode + xplat targets for backends/vulkan/tools/gpuinfo."""
8+
buck_filegroup(
9+
name = "gpuinfo_shaders",
10+
srcs = native.glob([
11+
"glsl/*",
12+
]),
13+
visibility = [
14+
"PUBLIC",
15+
],
16+
)
17+
18+
vulkan_spv_shader_lib(
19+
name = "gpuinfo_shader_lib",
20+
is_fbcode = is_fbcode,
21+
spv_filegroups = {
22+
":gpuinfo_shaders": "glsl",
23+
},
24+
)
25+
26+
if is_fbcode:
27+
fb_xplat_cxx_binary(
28+
name = "vulkan_gpuinfo",
29+
srcs = native.glob([
30+
"**/*.cpp",
31+
]),
32+
headers = native.glob([
33+
"**/*.h",
34+
]),
35+
header_namespace = "/include",
36+
include_directories = ["/include"],
37+
platforms = ANDROID,
38+
raw_headers = native.glob([
39+
"**/*.h",
40+
]),
41+
deps = [
42+
":gpuinfo_shader_lib",
43+
"//executorch/backends/vulkan:vulkan_graph_runtime",
44+
],
45+
)
46+
else:
47+
fb_xplat_cxx_binary(
48+
name = "vulkan_gpuinfo",
49+
srcs = native.glob([
50+
"**/*.cpp",
51+
]),
52+
headers = native.glob([
53+
"**/*.h",
54+
]),
55+
compiler_flags = select({
56+
"DEFAULT": [
57+
"-Wno-header-hygiene",
58+
],
59+
"ovr_config//compiler:cl": [],
60+
}),
61+
header_namespace = "/include",
62+
include_directories = ["/include"],
63+
platforms = ANDROID,
64+
raw_headers = native.glob([
65+
"**/*.h",
66+
]),
67+
deps = [
68+
":gpuinfo_shader_lib",
69+
"//arvr/third-party/opencl:headers",
70+
"//arvr/third-party/opencl:runtime",
71+
"//xplat/executorch/backends/vulkan:vulkan_graph_runtime",
72+
"//xplat/folly:json",
73+
],
74+
)

0 commit comments

Comments
 (0)