pytorch
415 строк · 13.4 Кб
1load("//third_party:glog.buck.bzl", "define_glog")
2load("//third_party:xnnpack.buck.bzl", "define_xnnpack")
3load("//third_party:kineto.buck.bzl", "define_kineto")
4load("//:buckbuild.bzl", "third_party")
5
6define_glog()
7
8define_xnnpack(third_party)
9
10define_kineto()
11
12# a placeholder for libraries that are not implemented in OSS
13cxx_library(
14name = "no-op",
15visibility = ['PUBLIC'],
16)
17
18cxx_library(
19name = "rt",
20exported_platform_linker_flags = [
21("^linux-.*$", ["-lrt"]),
22],
23visibility = ['PUBLIC'],
24)
25
26cxx_library(
27name = "fmt",
28srcs = ['fmt/src/format.cc'],
29deps = [],
30compiler_flags = ['-w', '-Wno-error=format-zero-length', '-Wno-error=vla', '-Wno-incompatible-pointer-types-discards-qualifiers', '-Wno-unused-label', '-Wno-deprecated-declarations', '-Wno-implicit-function-declaration', '-Wno-error', '-Wno-non-pod-varargs', '-Wno-format-security', '-Wno-c++11-narrowing', '-Wno-ignored-attributes', '-Wno-return-std-move', '-Wno-shadow', '-Wno-sign-compare', '-Wno-switch', '-Wno-undef', '-Wno-uninitialized', '-Wno-unknown-pragmas', '-Wno-unknown-warning-option', '-Wno-unused-function', '-Wno-unused-local-typedef', '-Wno-unused-value', '-Wno-unused-variable', '-Wno-register', '-Wno-format', '-Wno-unused-lambda-capture', '-Wno-missing-braces', '-Wno-unused-parameter', '-Wno-unreachable-code', '-Wno-inconsistent-missing-destructor-override', '-Wno-implicit-fallthrough', '-Wno-ignored-qualifiers', '-Wno-pedantic', '-Wno-deprecated-copy', '-Wno-non-virtual-dtor', '-Wno-null-pointer-arithmetic', '-Wno-implicit-const-int-float-conversion', '-Wno-tautological-unsigned-enum-zero-compare', '-Wno-embedded-directive', '-Wno-int-conversion', '-Wno-nonnull', '-Wno-variadic-macros', '-Wno-zero-length-array', '-Wno-missing-prototypes', '-fno-exceptions', '-fno-rtti', '-Wno-braced-scalar-init', '-fvisibility-inlines-hidden'],
31preferred_linkage = "static",
32exported_preprocessor_flags = ['-DFMT_EXCEPTIONS=0'],
33header_namespace = "third_party/fmt",
34public_system_include_directories = ['fmt/include'],
35raw_headers = glob(["fmt/include/fmt/*.h"]),
36soname = "libthird-party_fmt_fmt.$(ext)",
37visibility = ['PUBLIC'],
38)
39
40cxx_library(
41name = "pthreadpool",
42srcs = ['pthreadpool/src/legacy-api.c', 'pthreadpool/src/memory.c', 'pthreadpool/src/portable-api.c', 'pthreadpool/src/pthreads.c'],
43deps = [
44":FXdiv",
45":pthreadpool_header",
46],
47compiler_flags = [
48"-w",
49"-Os",
50"-fstack-protector-strong",
51"-fno-delete-null-pointer-checks"
52],
53headers = {
54'threadpool-atomics.h': 'pthreadpool/src/threadpool-atomics.h',
55'threadpool-common.h': 'pthreadpool/src/threadpool-common.h',
56'threadpool-object.h': 'pthreadpool/src/threadpool-object.h',
57'threadpool-utils.h': 'pthreadpool/src/threadpool-utils.h',
58},
59header_namespace = "",
60preferred_linkage = "static",
61link_whole = False,
62platform_preprocessor_flags = [['windows', ['-D_WINDOWS', '-D_WIN32', '-DWIN32', '-DNOMINMAX', '-D_CRT_SECURE_NO_WARNINGS', '-D_USE_MATH_DEFINES']], ['windows.*64$', ['-D_WIN64']]],
63preprocessor_flags = ['-DPTHREADPOOL_USE_FUTEX=0', '-DPTHREADPOOL_USE_GCD=0'],
64reexport_all_header_dependencies = True,
65visibility = ['PUBLIC'],
66)
67
68cxx_library(
69name = "pthreadpool_header",
70header_namespace = "",
71exported_headers = {
72"pthreadpool.h": "pthreadpool/include/pthreadpool.h",
73},
74reexport_all_header_dependencies = True,
75visibility = ["PUBLIC"],
76)
77
78cxx_library(
79name = "pocketfft_header",
80header_namespace = "",
81exported_headers = {
82"pocketfft_hdronly.h": "pocketfft/pocketfft_hdronly.h",
83},
84reexport_all_header_dependencies = True,
85visibility = ["PUBLIC"],
86)
87
88cxx_library(
89name = "FXdiv",
90header_namespace = "",
91exported_headers = {
92"fxdiv.h": "FXdiv/include/fxdiv.h",
93},
94reexport_all_header_dependencies = True,
95visibility = ["PUBLIC"],
96)
97
98cxx_library(
99name = "psimd",
100header_namespace = "",
101exported_headers = {
102"psimd.h": "psimd/include/psimd.h",
103},
104preferred_linkage = "static",
105visibility = ["PUBLIC"],
106)
107
108cxx_library(
109name = "cpuinfo",
110srcs = [
111"cpuinfo/wrappers/api.c",
112"cpuinfo/wrappers/arm/android/properties.c",
113"cpuinfo/wrappers/arm/cache.c",
114"cpuinfo/wrappers/arm/linux/aarch32-isa.c",
115"cpuinfo/wrappers/arm/linux/aarch64-isa.c",
116"cpuinfo/wrappers/arm/linux/chipset.c",
117"cpuinfo/wrappers/arm/linux/clusters.c",
118"cpuinfo/wrappers/arm/linux/cpuinfo.c",
119"cpuinfo/wrappers/arm/linux/hwcap.c",
120"cpuinfo/wrappers/arm/linux/init.c",
121"cpuinfo/wrappers/arm/linux/midr.c",
122"cpuinfo/wrappers/arm/mach/init.c",
123"cpuinfo/wrappers/arm/uarch.c",
124"cpuinfo/wrappers/cache.c",
125"cpuinfo/wrappers/init.c",
126"cpuinfo/wrappers/linux/cpulist.c",
127"cpuinfo/wrappers/linux/multiline.c",
128"cpuinfo/wrappers/linux/processors.c",
129"cpuinfo/wrappers/linux/smallfile.c",
130"cpuinfo/wrappers/log.c",
131"cpuinfo/wrappers/mach/topology.c",
132"cpuinfo/wrappers/x86/cache/descriptor.c",
133"cpuinfo/wrappers/x86/cache/deterministic.c",
134"cpuinfo/wrappers/x86/cache/init.c",
135"cpuinfo/wrappers/x86/info.c",
136"cpuinfo/wrappers/x86/init.c",
137"cpuinfo/wrappers/x86/isa.c",
138"cpuinfo/wrappers/x86/linux/cpuinfo.c",
139"cpuinfo/wrappers/x86/linux/init.c",
140"cpuinfo/wrappers/x86/mach/init.c",
141"cpuinfo/wrappers/x86/name.c",
142"cpuinfo/wrappers/x86/topology.c",
143"cpuinfo/wrappers/x86/uarch.c",
144"cpuinfo/wrappers/x86/vendor.c",
145"cpuinfo/wrappers/x86/windows/init.c",
146],
147include_directories = ["cpuinfo/src"],
148public_include_directories = ["cpuinfo/include"],
149raw_headers = glob([
150"cpuinfo/src/**/*.h",
151"cpuinfo/src/**/*.c",
152]),
153preferred_linkage = "static",
154preprocessor_flags = [
155"-DCPUINFO_LOG_LEVEL=2",
156"-D_GNU_SOURCE=1",
157],
158visibility = ["PUBLIC"],
159deps = [
160":clog",
161],
162)
163
164cxx_library(
165name = "clog",
166srcs = [
167"cpuinfo/deps/clog/src/clog.c",
168],
169raw_headers = glob([
170"cpuinfo/deps/clog/include/*.h",
171]),
172public_include_directories = [
173"cpuinfo/deps/clog/include/",
174],
175force_static = True,
176visibility = ["PUBLIC"],
177)
178
179cxx_library(
180name = "FP16",
181raw_headers = glob([
182"FP16/include/*.h",
183]),
184public_include_directories = [
185"FP16/include/",
186],
187force_static = True,
188visibility = ["PUBLIC"],
189)
190
191
192cxx_library(
193name = "miniz",
194srcs = ["miniz-2.1.0/miniz.c"],
195header_namespace = "",
196exported_headers = {"miniz.h": "miniz-2.1.0/miniz.h"},
197exported_preprocessor_flags = [
198"-DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS",
199],
200visibility = ["PUBLIC"],
201)
202
203remote_file(
204name = "typing-extensions-download",
205url = "https://files.pythonhosted.org/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl",
206sha1 = "ff0849420e94f425818bff5d0f25e3cdfaba8601",
207out = "typing_extensions-4.2.0-py3-none-any.whl",
208)
209
210prebuilt_python_library(
211name = "typing-extensions",
212binary_src = ":typing-extensions-download",
213visibility = ["PUBLIC"],
214deps = [":typing-extensions-download"],
215)
216
217remote_file(
218name = "pyyaml-download",
219url = "https://files.pythonhosted.org/packages/12/fc/a4d5a7554e0067677823f7265cb3ae22aed8a238560b5133b58cda252dad/PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl",
220sha1 = "11aa9c5fe2d890b6a73212beadc7c8a4265ebc39",
221out = "pyyaml.whl",
222)
223
224prebuilt_python_library(
225name = "pyyaml",
226binary_src = ":pyyaml-download",
227visibility = ["PUBLIC"],
228deps = [":pyyaml-download"],
229)
230
231cxx_library(
232name = "ruy_lib",
233srcs = glob(
234["ruy/**/*.cc"],
235exclude = [
236"ruy/ruy/test_*.cc",
237"ruy/ruy/*_test.cc",
238"ruy/example/*.cc",
239"ruy/ruy/profiler/test.cc",
240"ruy/ruy/benchmark.cc",
241],
242),
243compiler_flags = ["-Os"],
244preferred_linkage = "static",
245public_include_directories = ["ruy"],
246raw_headers = glob(["ruy/**/*.h"]),
247visibility = [
248"PUBLIC",
249],
250)
251
252cxx_library(
253name = "flatbuffers-api",
254public_include_directories = ["flatbuffers/include"],
255raw_headers = [
256"flatbuffers/include/flatbuffers/base.h",
257"flatbuffers/include/flatbuffers/flatbuffers.h",
258"flatbuffers/include/flatbuffers/stl_emulation.h",
259],
260preferred_linkage = "static",
261visibility = ["PUBLIC"],
262)
263
264cxx_library(
265name = "flatc_library",
266srcs = [
267"flatbuffers/src/code_generators.cpp",
268"flatbuffers/src/flatc.cpp",
269"flatbuffers/src/idl_gen_fbs.cpp",
270"flatbuffers/src/idl_gen_text.cpp",
271"flatbuffers/src/idl_parser.cpp",
272"flatbuffers/src/reflection.cpp",
273"flatbuffers/src/util.cpp",
274],
275public_include_directories = [
276"flatbuffers/grpc",
277"flatbuffers/include",
278],
279raw_headers = [
280"flatbuffers/include/flatbuffers/flatc.h",
281"flatbuffers/include/flatbuffers/base.h",
282"flatbuffers/include/flatbuffers/flatbuffers.h",
283"flatbuffers/include/flatbuffers/stl_emulation.h",
284"flatbuffers/include/flatbuffers/code_generators.h",
285"flatbuffers/include/flatbuffers/flexbuffers.h",
286"flatbuffers/include/flatbuffers/hash.h",
287"flatbuffers/include/flatbuffers/idl.h",
288"flatbuffers/include/flatbuffers/minireflect.h",
289"flatbuffers/include/flatbuffers/reflection.h",
290"flatbuffers/include/flatbuffers/reflection_generated.h",
291"flatbuffers/include/flatbuffers/util.h",
292],
293preferred_linkage = "static",
294visibility = ["PUBLIC"],
295)
296
297cxx_binary(
298name = "flatc",
299srcs = [
300"flatbuffers/grpc/src/compiler/cpp_generator.cc",
301"flatbuffers/grpc/src/compiler/go_generator.cc",
302"flatbuffers/grpc/src/compiler/java_generator.cc",
303"flatbuffers/grpc/src/compiler/python_generator.cc",
304"flatbuffers/grpc/src/compiler/swift_generator.cc",
305"flatbuffers/grpc/src/compiler/ts_generator.cc",
306"flatbuffers/src/annotated_binary_text_gen.cpp",
307"flatbuffers/src/binary_annotator.cpp",
308"flatbuffers/src/bfbs_gen_lua.cpp",
309"flatbuffers/src/bfbs_gen_nim.cpp",
310"flatbuffers/src/flatc_main.cpp",
311"flatbuffers/src/idl_gen_binary.cpp",
312"flatbuffers/src/idl_gen_cpp.cpp",
313"flatbuffers/src/idl_gen_csharp.cpp",
314"flatbuffers/src/idl_gen_dart.cpp",
315"flatbuffers/src/idl_gen_go.cpp",
316"flatbuffers/src/idl_gen_grpc.cpp",
317"flatbuffers/src/idl_gen_java.cpp",
318"flatbuffers/src/idl_gen_ts.cpp", # idl_gen_js_ts.cpp in fbsource
319"flatbuffers/src/idl_gen_json_schema.cpp",
320"flatbuffers/src/idl_gen_kotlin.cpp",
321"flatbuffers/src/idl_gen_lobster.cpp",
322"flatbuffers/src/idl_gen_lua.cpp",
323"flatbuffers/src/idl_gen_php.cpp",
324"flatbuffers/src/idl_gen_python.cpp",
325"flatbuffers/src/idl_gen_rust.cpp",
326"flatbuffers/src/idl_gen_swift.cpp",
327"flatbuffers/src/idl_gen_text.cpp",
328"flatbuffers/src/util.cpp",
329],
330include_directories = [
331"flatbuffers/grpc",
332"flatbuffers/include",
333],
334raw_headers = [
335"flatbuffers/grpc/src/compiler/cpp_generator.h",
336"flatbuffers/grpc/src/compiler/go_generator.h",
337"flatbuffers/grpc/src/compiler/java_generator.h",
338"flatbuffers/grpc/src/compiler/python_generator.h",
339"flatbuffers/grpc/src/compiler/schema_interface.h",
340"flatbuffers/grpc/src/compiler/swift_generator.h",
341"flatbuffers/grpc/src/compiler/ts_generator.h",
342],
343visibility = ["PUBLIC"],
344deps = [":flatc_library"],
345)
346
347cxx_library(
348name = "gtest_headers",
349exported_preprocessor_flags = [
350"-DGTEST_USE_OWN_TR1_TUPLE=0",
351"-DGTEST_HAS_TR1_TUPLE=0",
352"-D_CRT_DECLARE_NONSTDC_NAMES",
353"-D_CRT_NONSTDC_NO_WARNINGS",
354"-D_CRT_NONSTDC_NO_DEPRECATE",
355],
356include_directories = [
357"googletest/googletest",
358],
359public_system_include_directories = [
360"googletest/googletest/include",
361],
362raw_headers = glob([
363"googletest/googletest/src/**/*.h",
364"googletest/googletest/include/**/*.h",
365]),
366visibility = [
367"PUBLIC",
368],
369)
370
371cxx_library(
372name = "gtest",
373srcs = [
374"googletest/googletest/src/gtest-all.cc",
375"googletest/googletest/src/gtest_main.cc",
376],
377include_directories = [
378"googletest/googletest",
379],
380raw_headers = glob([
381"googletest/googletest/src/**/*.cc",
382"googletest/googletest/src/**/*.h",
383]),
384visibility = [
385"PUBLIC",
386],
387xcode_public_headers_symlinks = True,
388exported_deps = [
389":gtest_headers",
390],
391)
392
393cxx_library(
394name = "gmock",
395srcs = [
396"googletest/googlemock/src/gmock-all.cc",
397],
398include_directories = [
399"googletest/googlemock",
400],
401public_system_include_directories = [
402"googletest/googlemock/include",
403],
404raw_headers = glob([
405"googletest/googlemock/include/**/*.h",
406"googletest/googlemock/src/**/*.cc",
407]),
408visibility = ["PUBLIC"],
409deps = [
410":gtest",
411],
412exported_deps = [
413":gtest_headers",
414],
415)
416