forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD
168 lines (147 loc) · 4.23 KB
/
BUILD
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
# -*- python -*-
load("//tools/lint:lint.bzl", "add_lint_tests")
package(default_visibility = ["//visibility:public"])
# Note that we would typically name this file BUILD.bazel, however Bazel fails
# to find the CROSSTOOL file if we do that.
# The default toolchain selector for Drake.
#
# On OS X, we do not support any custom values for the --compiler flag. It
# must be unspecified. The CROSSTOOL file maps this to the system default
# Clang via osx_cc_wrapper.sh. Confusingly, Clang is installed on Mac as
# /usr/bin/gcc as well as /usr/bin/clang, and the wrapper script invokes the
# former.
#
# On Linux, we support --compiler strings "clang-3.9", "gcc-4.9", and "gcc-5",
# each of which does exactly what you would expect. "clang-3.9" is the default.
# No wrapper script is needed for any of these compilers, so the cc_toolchain
# rule does not provide one. Support for "gcc-6" is experimental without any
# guarantees. Note that it is not in our supported configurations yet. See
# http://drake.mit.edu/developers.html#supported-configurations for more
# information.
cc_toolchain_suite(
name = "default-toolchain",
toolchains = {
"darwin|compiler": "cc_toolchain_apple",
"k8|clang-3.9": "cc_toolchain_linux",
"k8|clang-4.0": "cc_toolchain_linux",
"k8|gcc-5": "cc_toolchain_linux",
"k8|gcc-6": "cc_toolchain_linux",
},
)
filegroup(
name = "empty",
srcs = [],
visibility = ["//visibility:private"],
)
# This filegroup contains the files on which every toolchain component should
# always depend, regardless of platform. It is a useful place for the outputs
# of rules that check preconditions for the entire build. (At the moment, we
# do not have any such files, although we once did.)
filegroup(
name = "universal_toolchain_deps",
visibility = ["//visibility:private"],
)
# A compiler wrapper script that adjusts linker paths on macOS.
filegroup(
name = "osx_cc_wrapper",
srcs = [
"osx_cc_wrapper.sh",
"//third_party:com_github_bazelbuild_bazel/tools/cpp/osx_cc_wrapper.sh", # noqa
],
visibility = ["//visibility:private"],
)
filegroup(
name = "osx_ar_wrapper",
srcs = ["osx_ar_wrapper.sh"],
visibility = ["//visibility:private"],
)
filegroup(
name = "apple_toolchain_deps",
srcs = [
":osx_ar_wrapper",
":osx_cc_wrapper",
":universal_toolchain_deps",
],
visibility = ["//visibility:private"],
)
filegroup(
name = "linux_toolchain_deps",
srcs = [
":universal_toolchain_deps",
],
visibility = ["//visibility:private"],
)
cc_toolchain(
name = "cc_toolchain_linux",
all_files = ":linux_toolchain_deps",
compiler_files = ":linux_toolchain_deps",
cpu = "k8",
dwp_files = ":linux_toolchain_deps",
dynamic_runtime_libs = [":empty"],
linker_files = ":linux_toolchain_deps",
objcopy_files = ":linux_toolchain_deps",
static_runtime_libs = [":empty"],
strip_files = ":linux_toolchain_deps",
supports_param_files = 0,
)
cc_toolchain(
name = "cc_toolchain_apple",
all_files = ":apple_toolchain_deps",
compiler_files = ":apple_toolchain_deps",
cpu = "darwin",
dwp_files = ":apple_toolchain_deps",
dynamic_runtime_libs = [":empty"],
linker_files = ":apple_toolchain_deps",
objcopy_files = ":apple_toolchain_deps",
static_runtime_libs = [":empty"],
strip_files = ":apple_toolchain_deps",
supports_param_files = 0,
)
config_setting(
name = "debug",
values = {"compilation_mode": "dbg"},
)
config_setting(
name = "apple_debug",
values = {
"compilation_mode": "dbg",
"cpu": "darwin",
},
)
config_setting(
name = "linux",
values = {"cpu": "k8"},
)
config_setting(
name = "apple",
values = {"cpu": "darwin"},
)
config_setting(
name = "gcc6-linux",
values = {
"compiler": "gcc-6",
"cpu": "k8",
},
)
config_setting(
name = "gcc5-linux",
values = {
"compiler": "gcc-5",
"cpu": "k8",
},
)
config_setting(
name = "gcc4.9-linux",
values = {
"compiler": "gcc-4.9",
"cpu": "k8",
},
)
config_setting(
name = "clang3.9-linux",
values = {
"compiler": "clang-3.9",
"cpu": "k8",
},
)
add_lint_tests()