blob: d830aded1dfbc24dfd8697a03d8b12ab8fa6406c [file] [log] [blame]
xingao03d52e22017-11-21 08:20:29 -08001# Copyright 2016 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Damien Martin-Guillerez8fa5ae62016-03-02 16:24:13 +000015major_version: "local"
16minor_version: ""
17default_target_cpu: "same_as_host"
18
19default_toolchain {
20 cpu: "%{cpu}"
Yun Pengc77eac92017-03-08 13:54:06 +000021 toolchain_identifier: "%{default_toolchain_name}"
Damien Martin-Guillerez8fa5ae62016-03-02 16:24:13 +000022}
23
24default_toolchain {
John Cater78ee50a2018-04-03 08:38:18 -070025 cpu: "local"
26 toolchain_identifier: "stub_armeabi-v7a"
27}
28
29default_toolchain {
ajmichaelcb16c502018-04-02 09:26:42 -070030 cpu: "armeabi-v7a"
Damien Martin-Guillerez8fa5ae62016-03-02 16:24:13 +000031 toolchain_identifier: "stub_armeabi-v7a"
32}
33
Yun Peng56b16e72016-07-12 10:55:57 +000034default_toolchain {
Yun Peng1f614722017-10-16 19:26:06 +020035 cpu: "x64_windows"
36 toolchain_identifier: "msvc_x64"
37}
38
39default_toolchain {
Yun Peng56b16e72016-07-12 10:55:57 +000040 cpu: "x64_windows_msvc"
Yun Pengc77eac92017-03-08 13:54:06 +000041 toolchain_identifier: "msvc_x64"
42}
43
44default_toolchain {
45 cpu: "x64_windows_msys"
46 toolchain_identifier: "msys_x64"
Yun Peng56b16e72016-07-12 10:55:57 +000047}
48
namrata-ibm155bd642016-10-11 09:59:27 +000049default_toolchain {
50 cpu: "s390x"
Nicolas Lopezbcbdb872017-03-28 08:08:50 +000051 toolchain_identifier: "%{toolchain_name}"
namrata-ibm155bd642016-10-11 09:59:27 +000052}
53
Cal Peyserf026e142016-12-19 18:16:26 +000054default_toolchain {
John Cater78ee50a2018-04-03 08:38:18 -070055 cpu: "local"
56 toolchain_identifier: "ios_x86_64"
57}
58
59default_toolchain {
ajmichaelcb16c502018-04-02 09:26:42 -070060 cpu: "ios_x86_64"
Cal Peyserf026e142016-12-19 18:16:26 +000061 toolchain_identifier: "ios_x86_64"
62}
63
Damien Martin-Guillerez8fa5ae62016-03-02 16:24:13 +000064# Android tooling requires a default toolchain for the armeabi-v7a cpu.
65toolchain {
66 abi_version: "armeabi-v7a"
67 abi_libc_version: "armeabi-v7a"
68 builtin_sysroot: ""
69 compiler: "compiler"
70 host_system_name: "armeabi-v7a"
71 needsPic: true
72 supports_gold_linker: false
73 supports_incremental_linker: false
74 supports_fission: false
75 supports_interface_shared_objects: false
76 supports_normalizing_ar: false
77 supports_start_end_lib: false
Damien Martin-Guillerez8fa5ae62016-03-02 16:24:13 +000078 target_libc: "armeabi-v7a"
79 target_cpu: "armeabi-v7a"
80 target_system_name: "armeabi-v7a"
81 toolchain_identifier: "stub_armeabi-v7a"
82
83 tool_path { name: "ar" path: "/bin/false" }
84 tool_path { name: "compat-ld" path: "/bin/false" }
85 tool_path { name: "cpp" path: "/bin/false" }
86 tool_path { name: "dwp" path: "/bin/false" }
87 tool_path { name: "gcc" path: "/bin/false" }
88 tool_path { name: "gcov" path: "/bin/false" }
89 tool_path { name: "ld" path: "/bin/false" }
90
91 tool_path { name: "nm" path: "/bin/false" }
92 tool_path { name: "objcopy" path: "/bin/false" }
93 tool_path { name: "objdump" path: "/bin/false" }
94 tool_path { name: "strip" path: "/bin/false" }
95 linking_mode_flags { mode: DYNAMIC }
96}
97
98toolchain {
Cal Peyserf026e142016-12-19 18:16:26 +000099 toolchain_identifier: "ios_x86_64"
100 host_system_name: "x86_64-apple-macosx"
101 target_system_name: "x86_64-apple-ios"
102 target_cpu: "ios_x86_64"
103 target_libc: "ios"
104 compiler: "compiler"
105 abi_version: "local"
106 abi_libc_version: "local"
107 supports_gold_linker: false
108 supports_incremental_linker: false
109 supports_fission: false
110 supports_interface_shared_objects: false
111 supports_normalizing_ar: false
112 supports_start_end_lib: false
113
114 tool_path { name: "ar" path: "/bin/false" }
115 tool_path { name: "compat-ld" path: "/bin/false" }
116 tool_path { name: "cpp" path: "/bin/false" }
117 tool_path { name: "dwp" path: "/bin/false" }
118 tool_path { name: "gcc" path: "/bin/false" }
119 tool_path { name: "gcov" path: "/bin/false" }
120 tool_path { name: "ld" path: "/bin/false" }
121
122 tool_path { name: "nm" path: "/bin/false" }
123 tool_path { name: "objcopy" path: "/bin/false" }
124 tool_path { name: "objdump" path: "/bin/false" }
125 tool_path { name: "strip" path: "/bin/false" }
126 linking_mode_flags { mode: DYNAMIC }
127}
128
129toolchain {
Yun Pengc77eac92017-03-08 13:54:06 +0000130 toolchain_identifier: "%{toolchain_name}"
Damien Martin-Guillerez8fa5ae62016-03-02 16:24:13 +0000131%{content}
132
133 compilation_mode_flags {
134 mode: DBG
135%{dbg_content}
136 }
137 compilation_mode_flags {
138 mode: OPT
139%{opt_content}
140 }
141 linking_mode_flags { mode: DYNAMIC }
Marcel Hlopko71c72c12017-02-23 14:10:31 +0000142
143%{coverage}
Benjamin Petersonb9e1c8a2017-12-05 06:27:26 -0800144
145 feature {
146 name: 'fdo_optimize'
147 provides: 'profile'
148 flag_set {
149 action: 'c-compile'
150 action: 'c++-compile'
151 expand_if_all_available: 'fdo_profile_path'
152 flag_group {
153 flag: '-fprofile-use=%{fdo_profile_path}'
154 flag: '-fprofile-correction',
155 }
156 }
157 }
Damien Martin-Guillerez8fa5ae62016-03-02 16:24:13 +0000158}
Yun Peng56b16e72016-07-12 10:55:57 +0000159
160toolchain {
Yun Penge9f40902018-01-03 09:20:27 -0800161 toolchain_identifier: "msys_x64_mingw"
162 abi_version: "local"
163 abi_libc_version: "local"
164 builtin_sysroot: ""
165 compiler: "mingw-gcc"
166 host_system_name: "local"
167 needsPic: false
168 target_libc: "mingw"
169 target_cpu: "x64_windows"
170 target_system_name: "local"
171
172%{msys_x64_mingw_content}
173
174 linking_mode_flags { mode: DYNAMIC }
175}
176
177toolchain {
Yun Pengc77eac92017-03-08 13:54:06 +0000178 toolchain_identifier: "msvc_x64"
Yun Peng56b16e72016-07-12 10:55:57 +0000179 host_system_name: "local"
180 target_system_name: "local"
181
182 abi_version: "local"
183 abi_libc_version: "local"
Yun Pengc77eac92017-03-08 13:54:06 +0000184 target_cpu: "x64_windows"
Yun Penge9f40902018-01-03 09:20:27 -0800185 compiler: "msvc-cl"
186 target_libc: "msvcrt"
Yun Peng56b16e72016-07-12 10:55:57 +0000187 default_python_version: "python2.7"
188
189%{cxx_builtin_include_directory}
190
191 tool_path {
192 name: "ar"
Yun Peng284a6112017-06-06 05:32:34 -0400193 path: "%{msvc_lib_path}"
Yun Peng56b16e72016-07-12 10:55:57 +0000194 }
195 tool_path {
Seth Greensteinae760d22017-11-17 02:20:06 -0800196 name: "ml"
197 path: "%{msvc_ml_path}"
198 }
199 tool_path {
Yun Peng56b16e72016-07-12 10:55:57 +0000200 name: "cpp"
Yun Peng284a6112017-06-06 05:32:34 -0400201 path: "%{msvc_cl_path}"
Yun Peng56b16e72016-07-12 10:55:57 +0000202 }
203 tool_path {
204 name: "gcc"
Yun Peng284a6112017-06-06 05:32:34 -0400205 path: "%{msvc_cl_path}"
Yun Peng56b16e72016-07-12 10:55:57 +0000206 }
207 tool_path {
208 name: "gcov"
209 path: "wrapper/bin/msvc_nop.bat"
210 }
211 tool_path {
212 name: "ld"
Yun Peng284a6112017-06-06 05:32:34 -0400213 path: "%{msvc_link_path}"
Yun Peng56b16e72016-07-12 10:55:57 +0000214 }
215 tool_path {
216 name: "nm"
217 path: "wrapper/bin/msvc_nop.bat"
218 }
219 tool_path {
220 name: "objcopy"
221 path: "wrapper/bin/msvc_nop.bat"
222 }
223 tool_path {
224 name: "objdump"
225 path: "wrapper/bin/msvc_nop.bat"
226 }
227 tool_path {
228 name: "strip"
229 path: "wrapper/bin/msvc_nop.bat"
230 }
231 supports_gold_linker: false
Yun Peng56b16e72016-07-12 10:55:57 +0000232 supports_start_end_lib: false
Yun Peng394211b2017-09-15 15:59:14 +0200233 supports_interface_shared_objects: true
Yun Peng56b16e72016-07-12 10:55:57 +0000234 supports_incremental_linker: false
235 supports_normalizing_ar: true
236 needsPic: false
237
Yun Peng56b16e72016-07-12 10:55:57 +0000238 # TODO(pcloudy): Review those flags below, they should be defined by cl.exe
Yun Peng56b16e72016-07-12 10:55:57 +0000239 compiler_flag: "/DCOMPILER_MSVC"
240
pcloudyb9554c12017-07-10 14:09:16 +0200241 # Don't define min/max macros in windows.h.
242 compiler_flag: "/DNOMINMAX"
243
Yun Peng56b16e72016-07-12 10:55:57 +0000244 # Platform defines.
245 compiler_flag: "/D_WIN32_WINNT=0x0600"
246 # Turn off warning messages.
247 compiler_flag: "/D_CRT_SECURE_NO_DEPRECATE"
248 compiler_flag: "/D_CRT_SECURE_NO_WARNINGS"
249 compiler_flag: "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS"
Yun Peng56b16e72016-07-12 10:55:57 +0000250
251 # Useful options to have on for compilation.
Yun Peng56b16e72016-07-12 10:55:57 +0000252 # Increase the capacity of object files to 2^32 sections.
253 compiler_flag: "/bigobj"
254 # Allocate 500MB for precomputed headers.
255 compiler_flag: "/Zm500"
256 # Use unsigned char by default.
257 compiler_flag: "/J"
258 # Use function level linking.
259 compiler_flag: "/Gy"
260 # Use string pooling.
261 compiler_flag: "/GF"
Samer Mastersonfefd1b22018-03-02 01:21:37 -0800262 # Catch C++ exceptions only and tell the compiler to assume that functions declared
263 # as extern "C" never throw a C++ exception.
Yun Peng56b16e72016-07-12 10:55:57 +0000264 compiler_flag: "/EHsc"
265
266 # Globally disabled warnings.
267 # Don't warn about elements of array being be default initialized.
268 compiler_flag: "/wd4351"
269 # Don't warn about no matching delete found.
270 compiler_flag: "/wd4291"
271 # Don't warn about diamond inheritance patterns.
272 compiler_flag: "/wd4250"
273 # Don't warn about insecure functions (e.g. non _s functions).
274 compiler_flag: "/wd4996"
275
Yun Pengf3fd3a42017-04-24 13:37:46 +0200276 linker_flag: "/MACHINE:X64"
277
hlopko26e5a472017-07-05 14:06:39 -0400278 feature {
279 name: "no_legacy_features"
280 }
281
Yun Pengf3fd3a42017-04-24 13:37:46 +0200282 # Suppress startup banner.
283 feature {
284 name: "nologo"
285 flag_set {
286 action: "c-compile"
287 action: "c++-compile"
288 action: "c++-module-compile"
289 action: "c++-module-codegen"
290 action: "c++-header-parsing"
291 action: "c++-header-preprocessing"
292 action: "assemble"
293 action: "preprocess-assemble"
294 action: "c++-link-executable"
295 action: "c++-link-dynamic-library"
hlopkodad22762018-03-01 13:17:23 -0800296 action: "c++-link-nodeps-dynamic-library"
Yun Pengf3fd3a42017-04-24 13:37:46 +0200297 action: "c++-link-static-library"
Yun Pengf3fd3a42017-04-24 13:37:46 +0200298 flag_group {
299 flag: "/nologo"
300 }
301 }
302 }
Yun Peng56b16e72016-07-12 10:55:57 +0000303
Yun Peng394211b2017-09-15 15:59:14 +0200304 feature {
305 name: 'has_configured_linker_path'
306 }
307
Yun Peng02866942017-08-04 10:45:46 +0200308 # This feature indicates strip is not supported, building stripped binary will just result a copy of orignial binary
309 feature {
310 name: 'no_stripping'
311 }
312
Yun Peng394211b2017-09-15 15:59:14 +0200313 # This feature indicates this is a toolchain targeting Windows.
314 feature {
315 name: 'targets_windows'
Yun Peng481657d2017-09-20 10:25:48 +0200316 implies: 'copy_dynamic_libraries_to_binary'
Yun Peng394211b2017-09-15 15:59:14 +0200317 enabled: true
318 }
319
Yun Peng481657d2017-09-20 10:25:48 +0200320 feature {
321 name: 'copy_dynamic_libraries_to_binary'
322 }
323
Yun Peng56b16e72016-07-12 10:55:57 +0000324 action_config {
Seth Greensteinae760d22017-11-17 02:20:06 -0800325 config_name: 'assemble'
326 action_name: 'assemble'
327 tool {
328 tool_path: '%{msvc_ml_path}'
329 }
330 flag_set {
331 expand_if_all_available: 'output_object_file'
332 flag_group {
333 flag: '/Fo%{output_object_file}'
334 flag: '/Zi'
335 flag: '/c'
336 flag: '%{source_file}'
337 }
338 }
339 implies: 'nologo'
340 implies: 'msvc_env'
341 implies: 'sysroot'
342 }
343
344 action_config {
Yun Peng56b16e72016-07-12 10:55:57 +0000345 config_name: 'c-compile'
346 action_name: 'c-compile'
347 tool {
Yun Peng284a6112017-06-06 05:32:34 -0400348 tool_path: '%{msvc_cl_path}'
Yun Peng56b16e72016-07-12 10:55:57 +0000349 }
350 flag_set {
351 flag_group {
352 flag: '/c'
353 flag: '%{source_file}'
354 }
355 }
356 flag_set {
357 expand_if_all_available: 'output_object_file'
358 flag_group {
359 flag: '/Fo%{output_object_file}'
360 }
361 }
362 flag_set {
363 expand_if_all_available: 'output_assembly_file'
364 flag_group {
365 flag: '/Fa%{output_assembly_file}'
366 }
367 }
368 flag_set {
369 expand_if_all_available: 'output_preprocess_file'
370 flag_group {
371 flag: '/P'
372 flag: '/Fi%{output_preprocess_file}'
373 }
374 }
hlopkof322ba72017-09-08 15:17:18 +0200375 implies: 'legacy_compile_flags'
Yun Pengf3fd3a42017-04-24 13:37:46 +0200376 implies: 'nologo'
Yun Peng6a0ddd82017-04-05 13:52:28 +0000377 implies: 'msvc_env'
Yun Peng29d5e9c2017-04-25 14:21:41 +0200378 implies: 'parse_showincludes'
hlopkof322ba72017-09-08 15:17:18 +0200379 implies: 'user_compile_flags'
hlopkob05bff62017-09-12 10:51:44 +0200380 implies: 'sysroot'
hlopkof322ba72017-09-08 15:17:18 +0200381 implies: 'unfiltered_compile_flags'
Yun Peng56b16e72016-07-12 10:55:57 +0000382 }
383
384 action_config {
385 config_name: 'c++-compile'
386 action_name: 'c++-compile'
387 tool {
Yun Peng284a6112017-06-06 05:32:34 -0400388 tool_path: '%{msvc_cl_path}'
Yun Peng56b16e72016-07-12 10:55:57 +0000389 }
390 flag_set {
391 flag_group {
392 flag: '/c'
393 flag: '%{source_file}'
394 }
395 }
396 flag_set {
397 expand_if_all_available: 'output_object_file'
398 flag_group {
399 flag: '/Fo%{output_object_file}'
400 }
401 }
402 flag_set {
403 expand_if_all_available: 'output_assembly_file'
404 flag_group {
405 flag: '/Fa%{output_assembly_file}'
406 }
407 }
408 flag_set {
409 expand_if_all_available: 'output_preprocess_file'
410 flag_group {
411 flag: '/P'
412 flag: '/Fi%{output_preprocess_file}'
413 }
414 }
hlopkof322ba72017-09-08 15:17:18 +0200415 implies: 'legacy_compile_flags'
Yun Pengf3fd3a42017-04-24 13:37:46 +0200416 implies: 'nologo'
Yun Peng6a0ddd82017-04-05 13:52:28 +0000417 implies: 'msvc_env'
Yun Peng29d5e9c2017-04-25 14:21:41 +0200418 implies: 'parse_showincludes'
hlopkof322ba72017-09-08 15:17:18 +0200419 implies: 'user_compile_flags'
hlopkob05bff62017-09-12 10:51:44 +0200420 implies: 'sysroot'
hlopkof322ba72017-09-08 15:17:18 +0200421 implies: 'unfiltered_compile_flags'
Yun Peng56b16e72016-07-12 10:55:57 +0000422 }
423
Yun Peng81aede12016-10-25 13:49:28 +0000424 action_config {
hlopko21903f92017-04-27 17:37:31 +0200425 config_name: 'c++-link-executable'
426 action_name: 'c++-link-executable'
427 tool {
Yun Peng284a6112017-06-06 05:32:34 -0400428 tool_path: '%{msvc_link_path}'
hlopko21903f92017-04-27 17:37:31 +0200429 }
430 implies: 'nologo'
hlopko21903f92017-04-27 17:37:31 +0200431 implies: 'linkstamps'
432 implies: 'output_execpath_flags'
433 implies: 'input_param_flags'
434 implies: 'legacy_link_flags'
Laszlo Csomor1a636442017-07-20 12:38:02 +0200435 implies: 'linker_subsystem_flag'
hlopko21903f92017-04-27 17:37:31 +0200436 implies: 'linker_param_file'
437 implies: 'msvc_env'
Yun Peng284a6112017-06-06 05:32:34 -0400438 implies: 'use_linker'
Yun Peng02866942017-08-04 10:45:46 +0200439 implies: 'no_stripping'
Yun Peng81aede12016-10-25 13:49:28 +0000440 }
441
442 action_config {
hlopko21903f92017-04-27 17:37:31 +0200443 config_name: 'c++-link-dynamic-library'
444 action_name: 'c++-link-dynamic-library'
445 tool {
Yun Peng284a6112017-06-06 05:32:34 -0400446 tool_path: '%{msvc_link_path}'
hlopko21903f92017-04-27 17:37:31 +0200447 }
448 implies: 'nologo'
hlopko21903f92017-04-27 17:37:31 +0200449 implies: 'shared_flag'
450 implies: 'linkstamps'
451 implies: 'output_execpath_flags'
452 implies: 'input_param_flags'
hlopko21903f92017-04-27 17:37:31 +0200453 implies: 'legacy_link_flags'
Laszlo Csomor1a636442017-07-20 12:38:02 +0200454 implies: 'linker_subsystem_flag'
hlopko21903f92017-04-27 17:37:31 +0200455 implies: 'linker_param_file'
456 implies: 'msvc_env'
Yun Peng284a6112017-06-06 05:32:34 -0400457 implies: 'use_linker'
Yun Peng02866942017-08-04 10:45:46 +0200458 implies: 'no_stripping'
Yun Peng394211b2017-09-15 15:59:14 +0200459 implies: 'has_configured_linker_path'
Yun Peng9cc954a2017-11-14 01:45:02 -0800460 implies: 'def_file'
Yun Peng81aede12016-10-25 13:49:28 +0000461 }
462
463 action_config {
hlopkodad22762018-03-01 13:17:23 -0800464 config_name: 'c++-link-nodeps-dynamic-library'
465 action_name: 'c++-link-nodeps-dynamic-library'
466 tool {
467 tool_path: '%{msvc_link_path}'
468 }
469 implies: 'nologo'
470 implies: 'shared_flag'
471 implies: 'linkstamps'
472 implies: 'output_execpath_flags'
473 implies: 'input_param_flags'
474 implies: 'legacy_link_flags'
475 implies: 'linker_subsystem_flag'
476 implies: 'linker_param_file'
477 implies: 'msvc_env'
478 implies: 'use_linker'
479 implies: 'no_stripping'
480 implies: 'has_configured_linker_path'
481 implies: 'def_file'
482 }
483
484 action_config {
hlopko21903f92017-04-27 17:37:31 +0200485 config_name: 'c++-link-static-library'
486 action_name: 'c++-link-static-library'
487 tool {
Yun Peng284a6112017-06-06 05:32:34 -0400488 tool_path: '%{msvc_lib_path}'
hlopko21903f92017-04-27 17:37:31 +0200489 }
490 implies: 'nologo'
hlopkoa4697fd2017-06-01 10:14:40 +0200491 implies: 'archiver_flags'
hlopko21903f92017-04-27 17:37:31 +0200492 implies: 'input_param_flags'
493 implies: 'linker_param_file'
494 implies: 'msvc_env'
Yun Peng81aede12016-10-25 13:49:28 +0000495 }
496
hlopkof322ba72017-09-08 15:17:18 +0200497 # TODO(b/65151735): Remove legacy_compile_flags feature when legacy fields are
498 # not used in this crosstool
499 feature {
500 name: 'legacy_compile_flags'
501 flag_set {
502 expand_if_all_available: 'legacy_compile_flags'
hlopkof322ba72017-09-08 15:17:18 +0200503 action: 'preprocess-assemble'
504 action: 'c-compile'
505 action: 'c++-compile'
506 action: 'c++-header-parsing'
507 action: 'c++-header-preprocessing'
508 action: 'c++-module-compile'
509 action: 'c++-module-codegen'
510 flag_group {
511 iterate_over: 'legacy_compile_flags'
512 flag: '%{legacy_compile_flags}'
513 }
514 }
515 }
516
517 feature {
518 name: "msvc_env"
519 env_set {
520 action: "c-compile"
521 action: "c++-compile"
522 action: "c++-module-compile"
523 action: "c++-module-codegen"
524 action: "c++-header-parsing"
525 action: "c++-header-preprocessing"
526 action: "assemble"
527 action: "preprocess-assemble"
528 action: "c++-link-executable"
529 action: "c++-link-dynamic-library"
hlopkodad22762018-03-01 13:17:23 -0800530 action: "c++-link-nodeps-dynamic-library"
hlopkof322ba72017-09-08 15:17:18 +0200531 action: "c++-link-static-library"
hlopkof322ba72017-09-08 15:17:18 +0200532 env_entry {
533 key: "PATH"
534 value: "%{msvc_env_path}"
535 }
536 env_entry {
537 key: "INCLUDE"
538 value: "%{msvc_env_include}"
539 }
540 env_entry {
541 key: "LIB"
542 value: "%{msvc_env_lib}"
543 }
544 env_entry {
545 key: "TMP"
546 value: "%{msvc_env_tmp}"
547 }
548 env_entry {
549 key: "TEMP"
550 value: "%{msvc_env_tmp}"
551 }
552 }
553 }
554
555 feature {
556 name: "use_linker"
557 env_set {
558 action: "c++-link-executable"
559 action: "c++-link-dynamic-library"
hlopkodad22762018-03-01 13:17:23 -0800560 action: "c++-link-nodeps-dynamic-library"
hlopkof322ba72017-09-08 15:17:18 +0200561 env_entry {
562 key: "USE_LINKER"
563 value: "1"
564 }
565 }
566 }
567
568 feature {
569 name: 'include_paths'
570 flag_set {
Seth Greensteinae760d22017-11-17 02:20:06 -0800571 action: "assemble"
hlopkof322ba72017-09-08 15:17:18 +0200572 action: 'preprocess-assemble'
573 action: 'c-compile'
574 action: 'c++-compile'
575 action: 'c++-header-parsing'
576 action: 'c++-header-preprocessing'
577 action: 'c++-module-compile'
578 flag_group {
579 iterate_over: 'quote_include_paths'
580 flag: '/I%{quote_include_paths}'
581 }
582 flag_group {
583 iterate_over: 'include_paths'
584 flag: '/I%{include_paths}'
585 }
586 flag_group {
587 iterate_over: 'system_include_paths'
588 flag: '/I%{system_include_paths}'
589 }
590 }
591 }
592
593 feature {
594 name: "preprocessor_defines"
595 flag_set {
Seth Greensteinae760d22017-11-17 02:20:06 -0800596 action: "assemble"
hlopkof322ba72017-09-08 15:17:18 +0200597 action: "preprocess-assemble"
598 action: "c-compile"
599 action: "c++-compile"
600 action: "c++-header-parsing"
601 action: "c++-header-preprocessing"
602 action: "c++-module-compile"
603 flag_group {
604 flag: "/D%{preprocessor_defines}"
605 iterate_over: "preprocessor_defines"
606 }
607 }
608 }
609
610 # Tell Bazel to parse the output of /showIncludes
611 feature {
612 name: 'parse_showincludes'
613 flag_set {
hlopkof322ba72017-09-08 15:17:18 +0200614 action: 'preprocess-assemble'
615 action: 'c-compile'
616 action: 'c++-compile'
617 action: 'c++-module-compile'
618 action: 'c++-header-preprocessing'
619 action: 'c++-header-parsing'
620 flag_group {
621 flag: "/showIncludes"
622 }
623 }
624 }
625
626
Yun Peng81aede12016-10-25 13:49:28 +0000627 feature {
Yun Peng997992d2017-04-18 13:33:28 +0200628 name: 'generate_pdb_file'
629 requires: {
630 feature: 'dbg'
631 }
632 requires: {
633 feature: 'fastbuild'
634 }
635 }
636
637 feature {
hlopko21903f92017-04-27 17:37:31 +0200638 name: 'shared_flag'
639 flag_set {
640 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800641 action: "c++-link-nodeps-dynamic-library"
hlopko21903f92017-04-27 17:37:31 +0200642 flag_group {
643 flag: '/DLL'
644 }
645 }
Yun Peng81aede12016-10-25 13:49:28 +0000646 }
647
648 feature {
hlopko21903f92017-04-27 17:37:31 +0200649 name: 'linkstamps'
650 flag_set {
651 action: 'c++-link-executable'
652 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800653 action: "c++-link-nodeps-dynamic-library"
hlopko21903f92017-04-27 17:37:31 +0200654 expand_if_all_available: 'linkstamp_paths'
655 flag_group {
hlopkoec41b8c2017-07-04 04:31:11 -0400656 iterate_over: 'linkstamp_paths'
hlopko21903f92017-04-27 17:37:31 +0200657 flag: '%{linkstamp_paths}'
658 }
659 }
Yun Peng81aede12016-10-25 13:49:28 +0000660 }
661
662 feature {
hlopko21903f92017-04-27 17:37:31 +0200663 name: 'output_execpath_flags'
664 flag_set {
665 expand_if_all_available: 'output_execpath'
666 action: 'c++-link-executable'
667 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800668 action: "c++-link-nodeps-dynamic-library"
hlopko21903f92017-04-27 17:37:31 +0200669 flag_group {
670 flag: '/OUT:%{output_execpath}'
671 }
672 }
Yun Peng81aede12016-10-25 13:49:28 +0000673 }
674
675 feature {
hlopkoa4697fd2017-06-01 10:14:40 +0200676 name: 'archiver_flags'
677 flag_set {
678 expand_if_all_available: 'output_execpath'
679 action: 'c++-link-static-library'
hlopkoa4697fd2017-06-01 10:14:40 +0200680 flag_group {
Yun Peng284a6112017-06-06 05:32:34 -0400681 flag: '/OUT:%{output_execpath}'
hlopkoa4697fd2017-06-01 10:14:40 +0200682 }
683 }
684 }
685
686 feature {
Marcel Hlopko0ca9d7e2016-12-09 15:32:56 +0000687 name: 'input_param_flags'
688 flag_set {
Yun Peng394211b2017-09-15 15:59:14 +0200689 expand_if_all_available: 'interface_library_output_path'
Marcel Hlopko5374d4f2016-12-22 08:04:06 +0000690 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800691 action: "c++-link-nodeps-dynamic-library"
Marcel Hlopko5374d4f2016-12-22 08:04:06 +0000692 flag_group {
Yun Peng394211b2017-09-15 15:59:14 +0200693 flag: "/IMPLIB:%{interface_library_output_path}"
Marcel Hlopko5374d4f2016-12-22 08:04:06 +0000694 }
695 }
696 flag_set {
Marcel Hlopko0ca9d7e2016-12-09 15:32:56 +0000697 expand_if_all_available: 'libopts'
698 action: 'c++-link-executable'
699 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800700 action: "c++-link-nodeps-dynamic-library"
Marcel Hlopko0ca9d7e2016-12-09 15:32:56 +0000701 flag_group {
hlopkoec41b8c2017-07-04 04:31:11 -0400702 iterate_over: 'libopts'
hlopko21903f92017-04-27 17:37:31 +0200703 flag: '%{libopts}'
Marcel Hlopko0ca9d7e2016-12-09 15:32:56 +0000704 }
705 }
706 flag_set {
707 expand_if_all_available: 'libraries_to_link'
708 action: 'c++-link-executable'
709 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800710 action: "c++-link-nodeps-dynamic-library"
Marcel Hlopko0ca9d7e2016-12-09 15:32:56 +0000711 action: 'c++-link-static-library'
Marcel Hlopko0ca9d7e2016-12-09 15:32:56 +0000712 flag_group {
713 iterate_over: 'libraries_to_link'
714 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000715 expand_if_equal: {
716 variable: 'libraries_to_link.type'
717 value: 'object_file_group'
718 }
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000719 iterate_over: 'libraries_to_link.object_files'
720 flag_group {
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000721 flag: '%{libraries_to_link.object_files}'
722 }
Marcel Hlopko0ca9d7e2016-12-09 15:32:56 +0000723 }
724 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000725 expand_if_equal: {
726 variable: 'libraries_to_link.type'
727 value: 'object_file'
728 }
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000729 flag_group {
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000730 flag: '%{libraries_to_link.name}'
731 }
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000732 }
733 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000734 expand_if_equal: {
735 variable: 'libraries_to_link.type'
736 value: 'interface_library'
737 }
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000738 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000739 expand_if_false: 'libraries_to_link.is_whole_archive'
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000740 flag: '%{libraries_to_link.name}'
741 }
742 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000743 expand_if_true: 'libraries_to_link.is_whole_archive'
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000744 flag: '/WHOLEARCHIVE:%{libraries_to_link.name}'
745 }
746 }
747 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000748 expand_if_equal: {
749 variable: 'libraries_to_link.type'
750 value: 'static_library'
751 }
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000752 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000753 expand_if_false: 'libraries_to_link.is_whole_archive'
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000754 flag: '%{libraries_to_link.name}'
755 }
756 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000757 expand_if_true: 'libraries_to_link.is_whole_archive'
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000758 flag: '/WHOLEARCHIVE:%{libraries_to_link.name}'
759 }
760 }
761 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000762 expand_if_equal: {
763 variable: 'libraries_to_link.type'
764 value: 'dynamic_library'
765 }
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000766 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000767 expand_if_false: 'libraries_to_link.is_whole_archive'
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000768 flag: '%{libraries_to_link.name}'
769 }
770 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000771 expand_if_true: 'libraries_to_link.is_whole_archive'
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000772 flag: '/WHOLEARCHIVE:%{libraries_to_link.name}'
773 }
774 }
775 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000776 expand_if_equal: {
777 variable: 'libraries_to_link.type'
778 value: 'versioned_dynamic_library'
779 }
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000780 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000781 expand_if_false: 'libraries_to_link.is_whole_archive'
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000782 flag: '%{libraries_to_link.name}'
783 }
784 flag_group {
Marcel Hlopko1410c212017-02-27 11:24:36 +0000785 expand_if_true: 'libraries_to_link.is_whole_archive'
Marcel Hlopkof63ea7a2017-01-23 12:34:38 +0000786 flag: '/WHOLEARCHIVE:%{libraries_to_link.name}'
787 }
Marcel Hlopko0ca9d7e2016-12-09 15:32:56 +0000788 }
789 }
790 }
Yun Peng81aede12016-10-25 13:49:28 +0000791 }
792
Laszlo Csomor1a636442017-07-20 12:38:02 +0200793 # Since this feature is declared earlier in the CROSSTOOL than
794 # "legacy_link_flags", this feature will be applied prior to it anwyhere they
795 # are both implied. And since "legacy_link_flags" contains the linkopts from
796 # the build rule, this allows the user to override the /SUBSYSTEM in the BUILD
797 # file.
798 feature {
799 name: 'linker_subsystem_flag'
800 flag_set {
801 action: 'c++-link-executable'
802 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800803 action: "c++-link-nodeps-dynamic-library"
Laszlo Csomor1a636442017-07-20 12:38:02 +0200804 flag_group {
805 flag: '/SUBSYSTEM:CONSOLE'
806 }
807 }
808 }
809
810 # The "legacy_link_flags" may contain user-defined linkopts (from build rules)
811 # so it should be defined after features that declare user-overridable flags.
812 # For example the "linker_subsystem_flag" defines a default "/SUBSYSTEM" flag
813 # but we want to let the user override it, therefore "link_flag_subsystem" is
814 # defined earlier in the CROSSTOOL file than "legacy_link_flags".
Marcel Hlopko5b630242016-12-22 08:48:05 +0000815 feature {
Marcel Hlopko75c95ac2016-12-22 16:10:54 +0000816 name: 'legacy_link_flags'
Marcel Hlopko5b630242016-12-22 08:48:05 +0000817 flag_set {
Marcel Hlopko75c95ac2016-12-22 16:10:54 +0000818 expand_if_all_available: 'legacy_link_flags'
Marcel Hlopko5b630242016-12-22 08:48:05 +0000819 action: 'c++-link-executable'
820 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800821 action: "c++-link-nodeps-dynamic-library"
Marcel Hlopko5b630242016-12-22 08:48:05 +0000822 flag_group {
hlopkoec41b8c2017-07-04 04:31:11 -0400823 iterate_over: 'legacy_link_flags'
Marcel Hlopko75c95ac2016-12-22 16:10:54 +0000824 flag: '%{legacy_link_flags}'
Marcel Hlopko5b630242016-12-22 08:48:05 +0000825 }
826 }
827 }
828
Marcel Hlopko46d36322017-01-24 10:39:40 +0000829 feature {
830 name: 'linker_param_file'
831 flag_set {
832 expand_if_all_available: 'linker_param_file'
833 action: 'c++-link-executable'
834 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800835 action: "c++-link-nodeps-dynamic-library"
Marcel Hlopko46d36322017-01-24 10:39:40 +0000836 action: 'c++-link-static-library'
Marcel Hlopko46d36322017-01-24 10:39:40 +0000837 flag_group {
838 flag: '@%{linker_param_file}'
839 }
840 }
841 }
842
Yun Peng997992d2017-04-18 13:33:28 +0200843 feature {
Yun Peng1edcd0f2017-09-26 10:30:44 +0200844 name: 'static_link_msvcrt'
Yun Peng3b08f772017-05-04 06:17:42 -0400845 }
846
847 feature {
Yun Peng1edcd0f2017-09-26 10:30:44 +0200848 name: 'static_link_msvcrt_no_debug'
Yun Peng3b08f772017-05-04 06:17:42 -0400849 flag_set {
850 action: 'c-compile'
851 action: 'c++-compile'
852 flag_group {
Yun Peng1edcd0f2017-09-26 10:30:44 +0200853 flag: "/MT"
Yun Peng3b08f772017-05-04 06:17:42 -0400854 }
855 }
856 flag_set {
857 action: 'c++-link-executable'
858 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800859 action: "c++-link-nodeps-dynamic-library"
Yun Peng3b08f772017-05-04 06:17:42 -0400860 flag_group {
Yun Peng1edcd0f2017-09-26 10:30:44 +0200861 flag: "/DEFAULTLIB:libcmt.lib"
Yun Peng3b08f772017-05-04 06:17:42 -0400862 }
863 }
Yun Peng1edcd0f2017-09-26 10:30:44 +0200864 requires: { feature: 'fastbuild'}
865 requires: { feature: 'opt'}
866 }
867
868 feature {
869 name: 'dynamic_link_msvcrt_no_debug'
870 flag_set {
871 action: 'c-compile'
872 action: 'c++-compile'
873 flag_group {
874 flag: "/MD"
875 }
876 }
877 flag_set {
878 action: 'c++-link-executable'
879 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800880 action: "c++-link-nodeps-dynamic-library"
Yun Peng1edcd0f2017-09-26 10:30:44 +0200881 flag_group {
882 flag: "/DEFAULTLIB:msvcrt.lib"
883 }
884 }
885 requires: { feature: 'fastbuild'}
886 requires: { feature: 'opt'}
887 }
888
889 feature {
890 name: 'static_link_msvcrt_debug'
891 flag_set {
892 action: 'c-compile'
893 action: 'c++-compile'
894 flag_group {
895 flag: "/MTd"
896 }
897 }
898 flag_set {
899 action: 'c++-link-executable'
900 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800901 action: "c++-link-nodeps-dynamic-library"
Yun Peng1edcd0f2017-09-26 10:30:44 +0200902 flag_group {
903 flag: "/DEFAULTLIB:libcmtd.lib"
904 }
905 }
906 requires: { feature: 'dbg'}
907 }
908
909 feature {
910 name: 'dynamic_link_msvcrt_debug'
911 flag_set {
912 action: 'c-compile'
913 action: 'c++-compile'
914 flag_group {
915 flag: "/MDd"
916 }
917 }
918 flag_set {
919 action: 'c++-link-executable'
920 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800921 action: "c++-link-nodeps-dynamic-library"
Yun Peng1edcd0f2017-09-26 10:30:44 +0200922 flag_group {
923 flag: "/DEFAULTLIB:msvcrtd.lib"
924 }
925 }
926 requires: { feature: 'dbg'}
Yun Peng3b08f772017-05-04 06:17:42 -0400927 }
928
929 feature {
Yun Peng997992d2017-04-18 13:33:28 +0200930 name: 'dbg'
931 flag_set {
932 action: 'c-compile'
933 action: 'c++-compile'
934 flag_group {
935 flag: "/Od"
Yun Peng997992d2017-04-18 13:33:28 +0200936 flag: "/Z7"
pcloudy7585dcd2017-11-22 06:05:30 -0800937 flag: "/DDEBUG"
Yun Peng997992d2017-04-18 13:33:28 +0200938 }
939 }
940 flag_set {
941 action: 'c++-link-executable'
942 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800943 action: "c++-link-nodeps-dynamic-library"
Yun Peng997992d2017-04-18 13:33:28 +0200944 flag_group {
Yun Peng09a6a9f2017-12-11 07:24:45 -0800945 flag: "%{dbg_mode_debug}"
Yun Peng997992d2017-04-18 13:33:28 +0200946 flag: "/INCREMENTAL:NO"
947 }
948 }
949 implies: 'generate_pdb_file'
950 }
951
952 feature {
953 name: 'fastbuild'
954 flag_set {
955 action: 'c-compile'
956 action: 'c++-compile'
957 flag_group {
958 flag: "/Od"
Yun Peng997992d2017-04-18 13:33:28 +0200959 flag: "/Z7"
pcloudy7585dcd2017-11-22 06:05:30 -0800960 flag: "/DDEBUG"
Yun Peng997992d2017-04-18 13:33:28 +0200961 }
962 }
963 flag_set {
964 action: 'c++-link-executable'
965 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -0800966 action: "c++-link-nodeps-dynamic-library"
Yun Peng997992d2017-04-18 13:33:28 +0200967 flag_group {
Yun Peng09a6a9f2017-12-11 07:24:45 -0800968 flag: "%{fastbuild_mode_debug}"
Yun Peng997992d2017-04-18 13:33:28 +0200969 flag: "/INCREMENTAL:NO"
970 }
971 }
972 implies: 'generate_pdb_file'
973 }
974
975 feature {
976 name: 'opt'
977 flag_set {
978 action: 'c-compile'
979 action: 'c++-compile'
980 flag_group {
981 flag: "/O2"
pcloudyebdb4ac2017-11-22 05:14:23 -0800982 flag: "/DNDEBUG"
Yun Peng997992d2017-04-18 13:33:28 +0200983 }
984 }
985 }
986
hlopko646cfd82017-08-01 22:26:37 +0200987 feature {
hlopkof322ba72017-09-08 15:17:18 +0200988 name: 'user_compile_flags'
hlopko646cfd82017-08-01 22:26:37 +0200989 flag_set {
hlopkof322ba72017-09-08 15:17:18 +0200990 expand_if_all_available: 'user_compile_flags'
hlopko646cfd82017-08-01 22:26:37 +0200991 action: 'preprocess-assemble'
992 action: 'c-compile'
993 action: 'c++-compile'
994 action: 'c++-header-parsing'
995 action: 'c++-header-preprocessing'
996 action: 'c++-module-compile'
997 action: 'c++-module-codegen'
998 flag_group {
hlopkof322ba72017-09-08 15:17:18 +0200999 iterate_over: 'user_compile_flags'
1000 flag: '%{user_compile_flags}'
hlopko646cfd82017-08-01 22:26:37 +02001001 }
1002 }
1003 }
1004
hlopkof322ba72017-09-08 15:17:18 +02001005 feature {
hlopkob05bff62017-09-12 10:51:44 +02001006 name: 'sysroot'
1007 flag_set {
1008 expand_if_all_available: 'sysroot'
1009 action: 'assemble'
1010 action: 'preprocess-assemble'
1011 action: 'c-compile'
1012 action: 'c++-compile'
1013 action: 'c++-header-parsing'
1014 action: 'c++-header-preprocessing'
1015 action: 'c++-module-compile'
1016 action: 'c++-module-codegen'
1017 action: 'c++-link-executable'
1018 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -08001019 action: "c++-link-nodeps-dynamic-library"
hlopkob05bff62017-09-12 10:51:44 +02001020 flag_group {
1021 iterate_over: 'sysroot'
1022 flag: '--sysroot=%{sysroot}'
1023 }
1024 }
1025 }
1026
1027 feature {
hlopkof322ba72017-09-08 15:17:18 +02001028 name: 'unfiltered_compile_flags'
1029 flag_set {
1030 expand_if_all_available: 'unfiltered_compile_flags'
hlopkof322ba72017-09-08 15:17:18 +02001031 action: 'preprocess-assemble'
1032 action: 'c-compile'
1033 action: 'c++-compile'
1034 action: 'c++-header-parsing'
1035 action: 'c++-header-preprocessing'
1036 action: 'c++-module-compile'
1037 action: 'c++-module-codegen'
1038 flag_group {
1039 iterate_over: 'unfiltered_compile_flags'
1040 flag: '%{unfiltered_compile_flags}'
1041 }
1042 }
1043 }
1044
Yun Peng394211b2017-09-15 15:59:14 +02001045 feature {
Yun Peng9cc954a2017-11-14 01:45:02 -08001046 name : 'def_file',
Yun Peng394211b2017-09-15 15:59:14 +02001047 flag_set {
1048 expand_if_all_available: 'def_file_path'
1049 action: 'c++-link-executable'
1050 action: 'c++-link-dynamic-library'
hlopkodad22762018-03-01 13:17:23 -08001051 action: "c++-link-nodeps-dynamic-library"
Yun Peng394211b2017-09-15 15:59:14 +02001052 flag_group {
1053 flag: "/DEF:%{def_file_path}"
1054 # We can specify a different DLL name in DEF file, /ignore:4070 suppresses
1055 # the warning message about DLL name doesn't match the default one.
1056 # See https://msdn.microsoft.com/en-us/library/sfkk2fz7.aspx
1057 flag: "/ignore:4070"
1058 }
1059 }
1060 }
1061
1062 feature {
Yun Peng9cc954a2017-11-14 01:45:02 -08001063 name: 'windows_export_all_symbols'
1064 }
1065
1066 feature {
Yun Peng394211b2017-09-15 15:59:14 +02001067 name: 'no_windows_export_all_symbols'
1068 }
1069
1070 linking_mode_flags { mode: DYNAMIC }
hlopkof322ba72017-09-08 15:17:18 +02001071
Yun Peng284a6112017-06-06 05:32:34 -04001072%{compilation_mode_content}
Yun Peng997992d2017-04-18 13:33:28 +02001073
Lukacs Berki76a2bbc2016-08-22 14:53:38 +00001074}