Skip to content

Commit 0593f0d

Browse files
yifeifcopybara-github
authored andcommitted
Add TensorFlow pip package's manylinux2010 toolchain to graphics so that we can build custom TensorFlow ops for OpenGL rasterizer.
PiperOrigin-RevId: 312554787
1 parent 832c607 commit 0593f0d

File tree

4 files changed

+1969
-0
lines changed

4 files changed

+1969
-0
lines changed

third_party/preconfig/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Preconfigured toolchain
2+
3+
Preconfigured toolchain for building custom C++ ops for OpenGL rasterizer.
4+
5+
Please use these toolchain configs with the Dockerfiles mentioned in
6+
[custom op repo](https://github.com/tensorflow/custom-op).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# This file is expanded from a template by cuda_configure.bzl
2+
# Update cuda_configure.bzl#verify_build_defines when adding new variables.
3+
4+
load(":cc_toolchain_config.bzl", "cc_toolchain_config")
5+
6+
licenses(["restricted"])
7+
8+
package(default_visibility = ["//visibility:public"])
9+
10+
toolchain(
11+
name = "toolchain-linux-x86_64",
12+
exec_compatible_with = [
13+
"@bazel_tools//platforms:linux",
14+
"@bazel_tools//platforms:x86_64",
15+
],
16+
target_compatible_with = [
17+
"@bazel_tools//platforms:linux",
18+
"@bazel_tools//platforms:x86_64",
19+
],
20+
toolchain = ":cc-compiler-local",
21+
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
22+
)
23+
24+
cc_toolchain_suite(
25+
name = "toolchain",
26+
toolchains = {
27+
"local|compiler": ":cc-compiler-local",
28+
"darwin|compiler": ":cc-compiler-darwin",
29+
"x64_windows|msvc-cl": ":cc-compiler-windows",
30+
"x64_windows": ":cc-compiler-windows",
31+
"arm": ":cc-compiler-local",
32+
"aarch64": ":cc-compiler-local",
33+
"k8": ":cc-compiler-local",
34+
"piii": ":cc-compiler-local",
35+
"ppc": ":cc-compiler-local",
36+
"darwin": ":cc-compiler-darwin",
37+
},
38+
)
39+
40+
cc_toolchain(
41+
name = "cc-compiler-local",
42+
all_files = ":crosstool_wrapper_driver_is_not_gcc",
43+
ar_files = ":crosstool_wrapper_driver_is_not_gcc",
44+
as_files = ":crosstool_wrapper_driver_is_not_gcc",
45+
compiler_files = ":crosstool_wrapper_driver_is_not_gcc",
46+
dwp_files = ":empty",
47+
linker_files = ":crosstool_wrapper_driver_is_not_gcc",
48+
objcopy_files = ":empty",
49+
strip_files = ":empty",
50+
# To support linker flags that need to go to the start of command line
51+
# we need the toolchain to support parameter files. Parameter files are
52+
# last on the command line and contain all shared libraries to link, so all
53+
# regular options will be left of them.
54+
supports_param_files = 1,
55+
toolchain_config = ":cc-compiler-local-config",
56+
toolchain_identifier = "local_linux",
57+
)
58+
59+
cc_toolchain_config(
60+
name = "cc-compiler-local-config",
61+
builtin_include_directories = [
62+
"/dt7/usr/include/c++/7",
63+
"/dt7/usr/include/c++/7/x86_64-pc-linux-gnu",
64+
"/dt7/usr/include/c++/7/backward",
65+
"/dt7/usr/lib/gcc/x86_64-pc-linux-gnu/7/include",
66+
"/dt7/usr/lib/gcc/x86_64-pc-linux-gnu/7/include-fixed",
67+
"/dt7/usr/include",
68+
"/usr/local/cuda-10.1/targets/x86_64-linux/include",
69+
"/usr/local/cuda-10.1/include",
70+
"/usr/local/cuda-10.1/extras/CUPTI/include",
71+
"/usr/include",
72+
],
73+
builtin_sysroot = "",
74+
cpu = "local",
75+
cuda_path = "",
76+
extra_no_canonical_prefixes_flags = ["-fno-canonical-system-headers"],
77+
host_compiler_path = "clang/bin/crosstool_wrapper_driver_is_not_gcc",
78+
host_compiler_prefix = "/usr/bin",
79+
host_compiler_warnings = [],
80+
host_unfiltered_compile_flags = [],
81+
linker_bin_path = "/usr/bin",
82+
)
83+
84+
cc_toolchain(
85+
name = "cc-compiler-darwin",
86+
all_files = ":crosstool_wrapper_driver_is_not_gcc",
87+
ar_files = ":crosstool_wrapper_driver_is_not_gcc",
88+
as_files = ":crosstool_wrapper_driver_is_not_gcc",
89+
compiler_files = ":crosstool_wrapper_driver_is_not_gcc",
90+
dwp_files = ":empty",
91+
linker_files = ":crosstool_wrapper_driver_is_not_gcc",
92+
objcopy_files = ":empty",
93+
strip_files = ":empty",
94+
supports_param_files = 0,
95+
toolchain_config = ":cc-compiler-local-darwin",
96+
toolchain_identifier = "local_darwin",
97+
)
98+
99+
cc_toolchain_config(
100+
name = "cc-compiler-local-darwin",
101+
builtin_include_directories = [
102+
"/dt7/usr/include/c++/7",
103+
"/dt7/usr/include/c++/7/x86_64-pc-linux-gnu",
104+
"/dt7/usr/include/c++/7/backward",
105+
"/dt7/usr/lib/gcc/x86_64-pc-linux-gnu/7/include",
106+
"/dt7/usr/lib/gcc/x86_64-pc-linux-gnu/7/include-fixed",
107+
"/dt7/usr/include",
108+
"/usr/local/cuda-10.1/targets/x86_64-linux/include",
109+
"/usr/local/cuda-10.1/include",
110+
"/usr/local/cuda-10.1/extras/CUPTI/include",
111+
"/usr/include",
112+
],
113+
cpu = "darwin",
114+
extra_no_canonical_prefixes_flags = ["-fno-canonical-system-headers"],
115+
host_compiler_path = "clang/bin/crosstool_wrapper_driver_is_not_gcc",
116+
host_compiler_prefix = "/usr/bin",
117+
host_compiler_warnings = [],
118+
host_unfiltered_compile_flags = [],
119+
linker_bin_path = "/usr/bin",
120+
)
121+
122+
cc_toolchain(
123+
name = "cc-compiler-windows",
124+
all_files = ":windows_msvc_wrapper_files",
125+
ar_files = ":windows_msvc_wrapper_files",
126+
as_files = ":windows_msvc_wrapper_files",
127+
compiler_files = ":windows_msvc_wrapper_files",
128+
dwp_files = ":empty",
129+
linker_files = ":windows_msvc_wrapper_files",
130+
objcopy_files = ":empty",
131+
strip_files = ":empty",
132+
supports_param_files = 1,
133+
toolchain_config = ":cc-compiler-windows-config",
134+
toolchain_identifier = "local_windows",
135+
)
136+
137+
cc_toolchain_config(
138+
name = "cc-compiler-windows-config",
139+
builtin_include_directories = [
140+
"/dt7/usr/include/c++/7",
141+
"/dt7/usr/include/c++/7/x86_64-pc-linux-gnu",
142+
"/dt7/usr/include/c++/7/backward",
143+
"/dt7/usr/lib/gcc/x86_64-pc-linux-gnu/7/include",
144+
"/dt7/usr/lib/gcc/x86_64-pc-linux-gnu/7/include-fixed",
145+
"/dt7/usr/include",
146+
"/usr/local/cuda-10.1/targets/x86_64-linux/include",
147+
"/usr/local/cuda-10.1/include",
148+
"/usr/local/cuda-10.1/extras/CUPTI/include",
149+
"/usr/include",
150+
],
151+
cpu = "x64_windows",
152+
msvc_cl_path = "msvc_not_used",
153+
msvc_env_include = "msvc_not_used",
154+
msvc_env_lib = "msvc_not_used",
155+
msvc_env_path = "msvc_not_used",
156+
msvc_env_tmp = "msvc_not_used",
157+
msvc_lib_path = "msvc_not_used",
158+
msvc_link_path = "msvc_not_used",
159+
msvc_ml_path = "msvc_not_used",
160+
)
161+
162+
filegroup(
163+
name = "empty",
164+
srcs = [],
165+
)
166+
167+
filegroup(
168+
name = "crosstool_wrapper_driver_is_not_gcc",
169+
srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
170+
)
171+
172+
filegroup(
173+
name = "windows_msvc_wrapper_files",
174+
srcs = glob(["windows/msvc_*"]),
175+
)

0 commit comments

Comments
 (0)