blob: d69a8f0d1180b22b4094fbecb15f5601f6a52565 [file] [log] [blame]
Marat Dukhan08c4a432019-10-03 09:29:21 -07001"""Build definitions and rules for XNNPACK."""
2
3load(":emscripten.bzl", "xnnpack_emscripten_benchmark_linkopts", "xnnpack_emscripten_deps", "xnnpack_emscripten_minimal_linkopts", "xnnpack_emscripten_test_linkopts")
4
5def xnnpack_visibility():
6 """Visibility of :XNNPACK target.
7
8 All other targets have private visibility, and can not have external
9 dependencies.
10 """
Marat Dukhan9d056a42019-10-03 12:13:35 -070011 return ["//visibility:public"]
Marat Dukhan08c4a432019-10-03 09:29:21 -070012
13def xnnpack_min_size_copts():
14 """Compiler flags for size-optimized builds."""
15 return ["-Os"]
16
Marat Dukhan10a38082020-04-17 03:58:35 -070017def xnnpack_gcc_std_copts():
18 """GCC-like compiler flags to specify language standard for C sources."""
Marat Dukhan08c4a432019-10-03 09:29:21 -070019 return ["-std=c99"]
20
Marat Dukhan10a38082020-04-17 03:58:35 -070021def xnnpack_msvc_std_copts():
22 """MSVC compiler flags to specify language standard for C sources."""
23 return ["/Drestrict="]
24
Marat Dukhan08c4a432019-10-03 09:29:21 -070025def xnnpack_std_cxxopts():
26 """Compiler flags to specify language standard for C++ sources."""
27 return ["-std=gnu++11"]
28
29def xnnpack_optional_ruy_copts():
30 """Compiler flags to optionally enable Ruy benchmarks."""
31 return []
32
33def xnnpack_optional_gemmlowp_copts():
34 """Compiler flags to optionally enable Gemmlowp benchmarks."""
35 return []
36
37def xnnpack_optional_tflite_copts():
38 """Compiler flags to optionally enable TensorFlow Lite benchmarks."""
39 return []
40
41def xnnpack_optional_armcl_copts():
42 """Compiler flags to optionally enable ARM ComputeLibrary benchmarks."""
43 return []
44
Marat Dukhan8d3c6932020-03-06 20:27:27 -080045def xnnpack_optional_dnnl_copts():
46 """Compiler flags to optionally enable Intel DNNL benchmarks."""
47 return []
48
Marat Dukhan08c4a432019-10-03 09:29:21 -070049def xnnpack_optional_ruy_deps():
50 """Optional Ruy dependencies."""
51 return []
52
53def xnnpack_optional_gemmlowp_deps():
54 """Optional Gemmlowp dependencies."""
55 return []
56
57def xnnpack_optional_tflite_deps():
58 """Optional TensorFlow Lite dependencies."""
59 return []
60
61def xnnpack_optional_armcl_deps():
62 """Optional ARM ComputeLibrary dependencies."""
63 return []
64
Marat Dukhan8d3c6932020-03-06 20:27:27 -080065def xnnpack_optional_dnnl_deps():
66 """Optional Intel DNNL dependencies."""
67 return []
68
Marat Dukhan08c4a432019-10-03 09:29:21 -070069def xnnpack_cc_library(
70 name,
71 srcs = [],
Marat Dukhan10a38082020-04-17 03:58:35 -070072 psimd_srcs = [],
Marat Dukhan08c4a432019-10-03 09:29:21 -070073 x86_srcs = [],
74 aarch32_srcs = [],
75 aarch64_srcs = [],
Marat Dukhancf056b22019-10-07 10:26:29 -070076 asmjs_srcs = [],
77 wasm_srcs = [],
78 wasmsimd_srcs = [],
Marat Dukhan08c4a432019-10-03 09:29:21 -070079 copts = [],
Marat Dukhan10a38082020-04-17 03:58:35 -070080 gcc_copts = [],
81 msvc_copts = [],
82 mingw_copts = [],
83 msys_copts = [],
84 gcc_x86_copts = [],
85 msvc_x86_32_copts = [],
86 msvc_x86_64_copts = [],
Marat Dukhanbc69ed62020-06-09 21:34:56 -070087 apple_aarch32_copts = [],
Marat Dukhan08c4a432019-10-03 09:29:21 -070088 aarch32_copts = [],
89 aarch64_copts = [],
Marat Dukhancf056b22019-10-07 10:26:29 -070090 asmjs_copts = [],
91 wasm_copts = [],
92 wasmsimd_copts = [],
Marat Dukhan08c4a432019-10-03 09:29:21 -070093 optimized_copts = ["-O2"],
94 hdrs = [],
Marat Dukhan10a38082020-04-17 03:58:35 -070095 defines = [],
96 includes = [],
97 deps = [],
98 visibility = []):
Marat Dukhancf056b22019-10-07 10:26:29 -070099 """C/C++/assembly library with architecture-specific configuration.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700100
101 Define a static library with architecture- and instruction-specific
Marat Dukhancf056b22019-10-07 10:26:29 -0700102 source files and/or compiler flags.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700103
104 Args:
105 name: The name of the library target to define.
106 srcs: The list of architecture-independent source files.
Marat Dukhan500b8892020-04-15 17:09:50 -0700107 psimd_srcs: The list of psimd-specific source files.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700108 x86_srcs: The list of x86-specific source files.
109 aarch32_srcs: The list of AArch32-specific source files.
110 aarch64_srcs: The list of AArch64-specific source files.
Marat Dukhancf056b22019-10-07 10:26:29 -0700111 asmjs_srcs: The list of Asm.js-specific source files.
112 wasm_srcs: The list of WebAssembly/MVP-specific source files.
113 wasmsimd_srcs: The list of WebAssembly/SIMD-specific source files.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700114 copts: The list of compiler flags to use in all builds. -I flags for
115 include/ and src/ directories of XNNPACK are always prepended
116 before these user-specified flags.
Marat Dukhan10a38082020-04-17 03:58:35 -0700117 gcc_copts: The list of compiler flags to use with GCC-like compilers.
118 msvc_copts: The list of compiler flags to use with MSVC compiler.
119 mingw_copts: The list of compiler flags to use with MinGW GCC compilers.
Marat Dukhanbc69ed62020-06-09 21:34:56 -0700120 msys_copts: The list of compiler flags to use with MSYS (Cygwin) GCC
121 compilers.
122 gcc_x86_copts: The list of GCC-like compiler flags to use in x86 (32-bit
123 and 64-bit) builds.
124 msvc_x86_32_copts: The list of MSVC compiler flags to use in x86 (32-bit)
125 builds.
126 msvc_x86_64_copts: The list of MSVC compiler flags to use in x86 (64-bit)
127 builds.
128 apple_aarch32_copts: The list of compiler flags to use in AArch32 builds
129 with Apple Clang.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700130 aarch32_copts: The list of compiler flags to use in AArch32 builds.
131 aarch64_copts: The list of compiler flags to use in AArch64 builds.
Marat Dukhancf056b22019-10-07 10:26:29 -0700132 asmjs_copts: The list of compiler flags to use in Asm.js builds.
133 wasm_copts: The list of compiler flags to use in WebAssembly/MVP builds.
134 wasmsimd_copts: The list of compiler flags to use in WebAssembly/SIMD
135 builds.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700136 optimized_copts: The list of compiler flags to use in optimized builds.
137 Defaults to -O2.
138 hdrs: The list of header files published by this library to be textually
139 included by sources in dependent rules.
Marat Dukhan10a38082020-04-17 03:58:35 -0700140 defines: List of predefines macros to be added to the compile line.
141 includes: List of include dirs to be added to the compile line.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700142 deps: The list of other libraries to be linked.
Marat Dukhan10a38082020-04-17 03:58:35 -0700143 visibility: The list of packages that can depend on this target.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700144 """
145 native.cc_library(
146 name = name,
147 srcs = srcs + select({
Marat Dukhan500b8892020-04-15 17:09:50 -0700148 ":linux_k8": psimd_srcs + x86_srcs,
Marat Dukhan582094e2020-04-30 17:21:25 -0700149 ":linux_arm": psimd_srcs + aarch32_srcs,
Marat Dukhanf0bd4de2020-06-15 15:53:19 -0700150 ":linux_armeabi": psimd_srcs + aarch32_srcs,
Marat Dukhan500b8892020-04-15 17:09:50 -0700151 ":linux_armhf": psimd_srcs + aarch32_srcs,
Marat Dukhan24567892020-06-10 13:15:48 -0700152 ":linux_armv7a": psimd_srcs + aarch32_srcs,
Marat Dukhan582094e2020-04-30 17:21:25 -0700153 ":linux_aarch64": psimd_srcs + aarch64_srcs,
Marat Dukhan500b8892020-04-15 17:09:50 -0700154 ":macos_x86_64": psimd_srcs + x86_srcs,
Marat Dukhan10a38082020-04-17 03:58:35 -0700155 ":windows_x86_64_clang": psimd_srcs + x86_srcs,
156 ":windows_x86_64_mingw": psimd_srcs + x86_srcs,
157 ":windows_x86_64_msys": psimd_srcs + x86_srcs,
158 ":windows_x86_64": x86_srcs,
Marat Dukhan500b8892020-04-15 17:09:50 -0700159 ":android_armv7": psimd_srcs + aarch32_srcs,
160 ":android_arm64": psimd_srcs + aarch64_srcs,
161 ":android_x86": psimd_srcs + x86_srcs,
162 ":android_x86_64": psimd_srcs + x86_srcs,
163 ":ios_armv7": psimd_srcs + aarch32_srcs,
164 ":ios_arm64": psimd_srcs + aarch64_srcs,
165 ":ios_arm64e": psimd_srcs + aarch64_srcs,
166 ":ios_x86": psimd_srcs + x86_srcs,
167 ":ios_x86_64": psimd_srcs + x86_srcs,
168 ":watchos_armv7k": psimd_srcs + aarch32_srcs,
169 ":watchos_arm64_32": psimd_srcs + aarch64_srcs,
170 ":watchos_x86": psimd_srcs + x86_srcs,
171 ":watchos_x86_64": psimd_srcs + x86_srcs,
172 ":tvos_arm64": psimd_srcs + aarch64_srcs,
173 ":tvos_x86_64": psimd_srcs + x86_srcs,
Marat Dukhancf056b22019-10-07 10:26:29 -0700174 ":emscripten_asmjs": asmjs_srcs,
175 ":emscripten_wasm": wasm_srcs,
Marat Dukhan500b8892020-04-15 17:09:50 -0700176 ":emscripten_wasmsimd": psimd_srcs + wasmsimd_srcs,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700177 "//conditions:default": [],
178 }),
179 copts = [
180 "-Iinclude",
181 "-Isrc",
182 ] + copts + select({
Marat Dukhan10a38082020-04-17 03:58:35 -0700183 ":linux_k8": gcc_x86_copts,
Marat Dukhan582094e2020-04-30 17:21:25 -0700184 ":linux_arm": aarch32_copts,
Marat Dukhanf0bd4de2020-06-15 15:53:19 -0700185 ":linux_armeabi": aarch32_copts,
Terry Heo68eef3f2020-04-13 22:53:52 -0700186 ":linux_armhf": aarch32_copts,
Marat Dukhan24567892020-06-10 13:15:48 -0700187 ":linux_armv7a": aarch32_copts,
Marat Dukhan582094e2020-04-30 17:21:25 -0700188 ":linux_aarch64": aarch64_copts,
Marat Dukhan10a38082020-04-17 03:58:35 -0700189 ":macos_x86_64": gcc_x86_copts,
190 ":windows_x86_64_clang": ["/clang:" + opt for opt in gcc_x86_copts],
191 ":windows_x86_64_mingw": mingw_copts + gcc_x86_copts,
192 ":windows_x86_64_msys": msys_copts + gcc_x86_copts,
193 ":windows_x86_64": msvc_x86_64_copts,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700194 ":android_armv7": aarch32_copts,
195 ":android_arm64": aarch64_copts,
Marat Dukhan10a38082020-04-17 03:58:35 -0700196 ":android_x86": gcc_x86_copts,
197 ":android_x86_64": gcc_x86_copts,
Marat Dukhanbc69ed62020-06-09 21:34:56 -0700198 ":ios_armv7": apple_aarch32_copts,
Marat Dukhan1498d1d2020-02-11 20:00:05 -0800199 ":ios_arm64": aarch64_copts,
200 ":ios_arm64e": aarch64_copts,
Marat Dukhan10a38082020-04-17 03:58:35 -0700201 ":ios_x86": gcc_x86_copts,
202 ":ios_x86_64": gcc_x86_copts,
Marat Dukhanbc69ed62020-06-09 21:34:56 -0700203 ":watchos_armv7k": apple_aarch32_copts,
Marat Dukhan1498d1d2020-02-11 20:00:05 -0800204 ":watchos_arm64_32": aarch64_copts,
Marat Dukhan10a38082020-04-17 03:58:35 -0700205 ":watchos_x86": gcc_x86_copts,
206 ":watchos_x86_64": gcc_x86_copts,
Marat Dukhan1498d1d2020-02-11 20:00:05 -0800207 ":tvos_arm64": aarch64_copts,
Marat Dukhan10a38082020-04-17 03:58:35 -0700208 ":tvos_x86_64": gcc_x86_copts,
Marat Dukhancf056b22019-10-07 10:26:29 -0700209 ":emscripten_asmjs": asmjs_copts,
210 ":emscripten_wasm": wasm_copts,
211 ":emscripten_wasmsimd": wasmsimd_copts,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700212 "//conditions:default": [],
213 }) + select({
Marat Dukhan10a38082020-04-17 03:58:35 -0700214 ":windows_x86_64_clang": ["/clang:" + opt for opt in gcc_copts],
215 ":windows_x86_64_mingw": gcc_copts,
216 ":windows_x86_64_msys": gcc_copts,
217 ":windows_x86_64": msvc_copts,
218 "//conditions:default": gcc_copts,
219 }) + select({
Marat Dukhan08c4a432019-10-03 09:29:21 -0700220 ":optimized_build": optimized_copts,
221 "//conditions:default": [],
222 }),
Marat Dukhan10a38082020-04-17 03:58:35 -0700223 defines = defines,
224 deps = deps,
225 includes = ["include", "src"] + includes,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700226 linkstatic = True,
227 linkopts = select({
228 ":linux_k8": ["-lpthread"],
Marat Dukhan582094e2020-04-30 17:21:25 -0700229 ":linux_arm": ["-lpthread"],
Marat Dukhanf0bd4de2020-06-15 15:53:19 -0700230 ":linux_armeabi": ["-lpthread"],
Terry Heo68eef3f2020-04-13 22:53:52 -0700231 ":linux_armhf": ["-lpthread"],
Marat Dukhan24567892020-06-10 13:15:48 -0700232 ":linux_armv7a": ["-lpthread"],
Marat Dukhan582094e2020-04-30 17:21:25 -0700233 ":linux_aarch64": ["-lpthread"],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700234 ":android": ["-lm"],
235 "//conditions:default": [],
236 }),
237 textual_hdrs = hdrs,
Marat Dukhan10a38082020-04-17 03:58:35 -0700238 visibility = visibility,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700239 )
240
241def xnnpack_aggregate_library(
242 name,
243 generic_deps = [],
Marat Dukhan500b8892020-04-15 17:09:50 -0700244 psimd_deps = [],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700245 x86_deps = [],
246 aarch32_deps = [],
247 aarch64_deps = [],
248 wasm_deps = [],
249 wasmsimd_deps = []):
250 """Static library that aggregates architecture-specific dependencies.
251
252 Args:
253 name: The name of the library target to define.
254 generic_deps: The list of libraries to link on all architectures.
Marat Dukhan500b8892020-04-15 17:09:50 -0700255 psimd_deps: The list of libraries to link in psimd-enabled builds.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700256 x86_deps: The list of libraries to link in x86 and x86-64 builds.
257 aarch32_deps: The list of libraries to link in AArch32 builds.
258 aarch64_deps: The list of libraries to link in AArch32 builds.
259 wasm_deps: The list of libraries to link in WebAssembly (MVP) builds.
260 wasmsimd_deps: The list of libraries to link in WebAssembly SIMD builds.
261 """
262
263 native.cc_library(
264 name = name,
265 linkstatic = True,
266 deps = generic_deps + select({
Marat Dukhan500b8892020-04-15 17:09:50 -0700267 ":linux_k8": psimd_deps + x86_deps,
Marat Dukhan582094e2020-04-30 17:21:25 -0700268 ":linux_arm": psimd_deps + aarch32_deps,
Marat Dukhanf0bd4de2020-06-15 15:53:19 -0700269 ":linux_armeabi": psimd_deps + aarch32_deps,
Marat Dukhan500b8892020-04-15 17:09:50 -0700270 ":linux_armhf": psimd_deps + aarch32_deps,
Marat Dukhan24567892020-06-10 13:15:48 -0700271 ":linux_armv7a": psimd_deps + aarch32_deps,
Marat Dukhan582094e2020-04-30 17:21:25 -0700272 ":linux_aarch64": psimd_deps + aarch64_deps,
Marat Dukhan500b8892020-04-15 17:09:50 -0700273 ":macos_x86_64": psimd_deps + x86_deps,
Marat Dukhan10a38082020-04-17 03:58:35 -0700274 ":windows_x86_64_clang": psimd_deps + x86_deps,
275 ":windows_x86_64_mingw": psimd_deps + x86_deps,
276 ":windows_x86_64_msys": psimd_deps + x86_deps,
277 ":windows_x86_64": x86_deps,
Marat Dukhan500b8892020-04-15 17:09:50 -0700278 ":android_armv7": psimd_deps + aarch32_deps,
279 ":android_arm64": psimd_deps + aarch64_deps,
280 ":android_x86": psimd_deps + x86_deps,
281 ":android_x86_64": psimd_deps + x86_deps,
282 ":ios_armv7": psimd_deps + aarch32_deps,
283 ":ios_arm64": psimd_deps + aarch64_deps,
284 ":ios_arm64e": psimd_deps + aarch64_deps,
285 ":ios_x86": psimd_deps + x86_deps,
286 ":ios_x86_64": psimd_deps + x86_deps,
287 ":watchos_armv7k": psimd_deps + aarch32_deps,
288 ":watchos_arm64_32": psimd_deps + aarch64_deps,
289 ":watchos_x86": psimd_deps + x86_deps,
290 ":watchos_x86_64": psimd_deps + x86_deps,
291 ":tvos_arm64": psimd_deps + aarch64_deps,
292 ":tvos_x86_64": psimd_deps + x86_deps,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700293 ":emscripten_wasm": wasm_deps,
Marat Dukhan500b8892020-04-15 17:09:50 -0700294 ":emscripten_wasmsimd": psimd_deps + wasmsimd_deps,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700295 ":emscripten_asmjs": [],
296 }),
297 )
298
Marat Dukhan22eed3d2020-05-11 20:13:37 -0700299def xnnpack_unit_test(name, srcs, copts = [], mingw_copts = [], msys_copts = [], deps = [], tags = [], automatic = True):
Marat Dukhan08c4a432019-10-03 09:29:21 -0700300 """Unit test binary based on Google Test.
301
302 Args:
303 name: The name of the test target to define.
304 srcs: The list of source and header files.
305 copts: The list of additional compiler flags for the target. -I flags
306 for include/ and src/ directories of XNNPACK are always prepended
307 before these user-specified flags.
Marat Dukhan10a38082020-04-17 03:58:35 -0700308 mingw_copts: The list of compiler flags to use with MinGW GCC compilers.
309 msys_copts: The list of compiler flags to use with MSYS (Cygwin) GCC compilers.
Marat Dukhan08c4a432019-10-03 09:29:21 -0700310 deps: The list of additional libraries to be linked. Google Test library
311 (with main() function) is always added as a dependency and does not
312 need to be explicitly specified.
313 """
314
Marat Dukhan22eed3d2020-05-11 20:13:37 -0700315 if automatic:
316 native.cc_test(
317 name = name,
318 srcs = srcs,
319 copts = xnnpack_std_cxxopts() + [
320 "-Iinclude",
321 "-Isrc",
322 ] + select({
323 ":windows_x86_64_mingw": mingw_copts,
324 ":windows_x86_64_msys": msys_copts,
325 "//conditions:default": [],
326 }) + select({
327 ":windows_x86_64_clang": ["/clang:-Wno-unused-function"],
328 ":windows_x86_64_mingw": ["-Wno-unused-function"],
329 ":windows_x86_64_msys": ["-Wno-unused-function"],
330 ":windows_x86_64": [],
331 "//conditions:default": ["-Wno-unused-function"],
332 }) + copts,
333 linkopts = select({
334 ":emscripten": xnnpack_emscripten_test_linkopts(),
335 "//conditions:default": [],
336 }),
337 linkstatic = True,
338 deps = [
339 "@com_google_googletest//:gtest_main",
340 ] + deps + select({
341 ":emscripten": xnnpack_emscripten_deps(),
342 "//conditions:default": [],
343 }),
344 tags = tags,
345 )
346 else:
347 native.cc_binary(
348 name = name,
349 srcs = srcs,
350 copts = xnnpack_std_cxxopts() + [
351 "-Iinclude",
352 "-Isrc",
353 ] + select({
354 ":windows_x86_64_mingw": mingw_copts,
355 ":windows_x86_64_msys": msys_copts,
356 "//conditions:default": [],
357 }) + select({
358 ":windows_x86_64_clang": ["/clang:-Wno-unused-function"],
359 ":windows_x86_64_mingw": ["-Wno-unused-function"],
360 ":windows_x86_64_msys": ["-Wno-unused-function"],
361 ":windows_x86_64": [],
362 "//conditions:default": ["-Wno-unused-function"],
363 }) + copts,
364 linkopts = select({
365 ":emscripten": xnnpack_emscripten_test_linkopts(),
366 "//conditions:default": [],
367 }),
368 linkstatic = True,
369 deps = [
370 "@com_google_googletest//:gtest_main",
371 ] + deps + select({
372 ":emscripten": xnnpack_emscripten_deps(),
373 "//conditions:default": [],
374 }),
375 testonly = True,
376 tags = tags,
377 )
Marat Dukhan08c4a432019-10-03 09:29:21 -0700378
379def xnnpack_binary(name, srcs, copts = [], deps = []):
380 """Minimal binary
381
382 Args:
383 name: The name of the binary target to define.
384 srcs: The list of source and header files.
385 copts: The list of additional compiler flags for the target. -I flags
386 for include/ and src/ directories of XNNPACK are always prepended
387 before these user-specified flags.
388 deps: The list of libraries to be linked.
389 """
390 native.cc_binary(
391 name = name,
392 srcs = srcs,
393 copts = [
394 "-Iinclude",
395 "-Isrc",
396 ] + copts,
397 linkopts = select({
398 ":emscripten": xnnpack_emscripten_minimal_linkopts(),
399 "//conditions:default": [],
400 }),
401 linkstatic = True,
402 deps = deps,
403 )
404
Marat Dukhana98efa12020-05-04 17:07:49 -0700405def xnnpack_benchmark(name, srcs, copts = [], deps = [], tags = []):
Marat Dukhan08c4a432019-10-03 09:29:21 -0700406 """Microbenchmark binary based on Google Benchmark
407
408 Args:
409 name: The name of the binary target to define.
410 srcs: The list of source and header files.
411 copts: The list of additional compiler flags for the target. -I flags
412 for include/ and src/ directories of XNNPACK are always prepended
413 before these user-specified flags.
414 deps: The list of additional libraries to be linked. Google Benchmark
415 library is always added as a dependency and does not need to be
416 explicitly specified.
417 """
418 native.cc_binary(
419 name = name,
420 srcs = srcs,
421 copts = xnnpack_std_cxxopts() + [
422 "-Iinclude",
423 "-Isrc",
Marat Dukhana98efa12020-05-04 17:07:49 -0700424 ] + select({
425 ":windows_x86_64_clang": ["/clang:-Wno-unused-function"],
426 ":windows_x86_64_mingw": ["-Wno-unused-function"],
427 ":windows_x86_64_msys": ["-Wno-unused-function"],
428 ":windows_x86_64": [],
429 "//conditions:default": ["-Wno-unused-function"],
430 }) + copts,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700431 linkopts = select({
432 ":emscripten": xnnpack_emscripten_benchmark_linkopts(),
Marat Dukhan10a38082020-04-17 03:58:35 -0700433 ":windows_x86_64_mingw": ["-lshlwapi"],
434 ":windows_x86_64_msys": ["-lshlwapi"],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700435 "//conditions:default": [],
436 }),
437 linkstatic = True,
438 deps = [
439 "@com_google_benchmark//:benchmark",
440 ] + deps + select({
441 ":emscripten": xnnpack_emscripten_deps(),
442 "//conditions:default": [],
443 }),
Marat Dukhan8ea0b072020-04-23 16:12:18 -0700444 tags = tags,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700445 )