-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
181 lines (168 loc) · 4.5 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit")
##################################
# Linux RBE toolchain container. #
##################################
# Generates a Linux RBE toolchain container image for SkCMS.
#
# This container can be pushed to GCR via the //:push_rbe_container_skcms_linux rule.
#
# To debug this image:
#
# # Build the container image.
# $ bazel build //:rbe_container_skcms_linux
#
# # Load the container.
# $ docker load -i bazel-bin/rbe_container_skcms_linux_commit.tar
# Loaded image: bazel-bin/default:rbe_container_skcms_linux
#
# # Run the container.
# $ docker run -it bazel/default:rbe_container_skcms_linux /bin/bash
container_run_and_commit(
name = "rbe_container_skcms_linux",
commands = [
# Install the packages needed to build SkCMS.
"apt-get update",
"apt-get install -y clang"
],
image = "@ubuntu1804//image",
tags = [
"manual", # Exclude it from wildcard queries, e.g. "bazel build //...".
"no-remote",
],
)
# This target can be used to upload the custom RBE container toolchain to GCR. It will be available
# as gcr.io/skia-public/rbe-container-skcms-linux.
#
# Note: this can take several minutes to finish because it will upload a >3GB .tar file to GCR.
container_push(
name = "push_rbe_container_skcms_linux",
format = "Docker",
image = ":rbe_container_skcms_linux_commit.tar", # Generated by //:rbe_container_skcms_linux.
registry = "gcr.io",
repository = "skia-public/rbe-container-skcms-linux",
tag = "{STABLE_DOCKER_TAG}",
tags = [
"manual", # Exclude it from wildcard queries, e.g. "bazel build //...".
"no-remote", # We cannot build containers on RBE.
],
)
#########
# SkCMS #
#########
cc_library(
name = "skcms_public",
srcs = [
"skcms.cc",
"src/skcms_internals.h",
"src/skcms_public.h",
],
hdrs = ["skcms.h"],
deps = [":skcms_TransformBaseline"] +
select({
"@platforms//cpu:x86_64": [
":skcms_TransformHsw",
":skcms_TransformSkx",
],
"//conditions:default": [],
}),
)
cc_library(
name = "skcms_TransformBaseline",
srcs = [
"src/skcms_Transform.h",
"src/skcms_TransformBaseline.cc",
"src/skcms_internals.h",
"src/skcms_public.h",
],
# This header does not compile on its own and is meant to be included from skcms_Transform*.cc
textual_hdrs = [
"src/Transform_inl.h",
],
)
cc_library(
name = "skcms_TransformHsw",
srcs = [
"src/skcms_Transform.h",
"src/skcms_TransformHsw.cc",
"src/skcms_internals.h",
"src/skcms_public.h",
],
copts = select({
"@platforms//cpu:x86_64": [
"-mavx2",
"-mf16c",
],
"//conditions:default": [],
}),
# This header does not compile on its own and is meant to be included from skcms_Transform*.cc
textual_hdrs = [
"src/Transform_inl.h",
],
)
cc_library(
name = "skcms_TransformSkx",
srcs = [
"src/skcms_Transform.h",
"src/skcms_TransformSkx.cc",
"src/skcms_internals.h",
"src/skcms_public.h",
],
copts = select({
"@platforms//cpu:x86_64": [
"-mavx512f",
"-mavx512dq",
"-mavx512cd",
"-mavx512bw",
"-mavx512vl",
],
"//conditions:default": [],
}),
# This header does not compile on its own and is meant to be included from skcms_Transform*.cc
textual_hdrs = [
"src/Transform_inl.h",
],
)
cc_library(
name = "skcms",
hdrs = ["skcms.h"],
visibility = ["//visibility:public"],
deps = [
":skcms_TransformBaseline",
":skcms_TransformHsw",
":skcms_TransformSkx",
":skcms_public",
],
)
cc_library(
name = "test_only",
testonly = True,
srcs = ["test_only.c"],
hdrs = ["test_only.h"],
deps = [":skcms"],
)
cc_test(
name = "tests",
size = "small",
srcs = ["tests.c"],
data = glob(["profiles/**"]),
deps = [
":skcms",
":test_only",
],
)
cc_binary(
name = "iccdump",
testonly = True,
srcs = ["iccdump.c"],
linkopts = ["-ldl"],
deps = [
":skcms",
":test_only",
],
)
cc_binary(
name = "bench",
srcs = ["bench.c"],
deps = [":skcms"],
)