xingao | 03d52e2 | 2017-11-21 08:20:29 -0800 | [diff] [blame] | 1 | # 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-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 15 | major_version: "local" |
| 16 | minor_version: "" |
| 17 | default_target_cpu: "same_as_host" |
| 18 | |
| 19 | default_toolchain { |
| 20 | cpu: "%{cpu}" |
Yun Peng | c77eac9 | 2017-03-08 13:54:06 +0000 | [diff] [blame] | 21 | toolchain_identifier: "%{default_toolchain_name}" |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | default_toolchain { |
John Cater | 78ee50a | 2018-04-03 08:38:18 -0700 | [diff] [blame] | 25 | cpu: "local" |
| 26 | toolchain_identifier: "stub_armeabi-v7a" |
| 27 | } |
| 28 | |
| 29 | default_toolchain { |
ajmichael | cb16c50 | 2018-04-02 09:26:42 -0700 | [diff] [blame] | 30 | cpu: "armeabi-v7a" |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 31 | toolchain_identifier: "stub_armeabi-v7a" |
| 32 | } |
| 33 | |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 34 | default_toolchain { |
Yun Peng | 1f61472 | 2017-10-16 19:26:06 +0200 | [diff] [blame] | 35 | cpu: "x64_windows" |
| 36 | toolchain_identifier: "msvc_x64" |
| 37 | } |
| 38 | |
| 39 | default_toolchain { |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 40 | cpu: "x64_windows_msvc" |
Yun Peng | c77eac9 | 2017-03-08 13:54:06 +0000 | [diff] [blame] | 41 | toolchain_identifier: "msvc_x64" |
| 42 | } |
| 43 | |
| 44 | default_toolchain { |
| 45 | cpu: "x64_windows_msys" |
| 46 | toolchain_identifier: "msys_x64" |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 47 | } |
| 48 | |
namrata-ibm | 155bd64 | 2016-10-11 09:59:27 +0000 | [diff] [blame] | 49 | default_toolchain { |
| 50 | cpu: "s390x" |
Nicolas Lopez | bcbdb87 | 2017-03-28 08:08:50 +0000 | [diff] [blame] | 51 | toolchain_identifier: "%{toolchain_name}" |
namrata-ibm | 155bd64 | 2016-10-11 09:59:27 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Cal Peyser | f026e14 | 2016-12-19 18:16:26 +0000 | [diff] [blame] | 54 | default_toolchain { |
John Cater | 78ee50a | 2018-04-03 08:38:18 -0700 | [diff] [blame] | 55 | cpu: "local" |
| 56 | toolchain_identifier: "ios_x86_64" |
| 57 | } |
| 58 | |
| 59 | default_toolchain { |
ajmichael | cb16c50 | 2018-04-02 09:26:42 -0700 | [diff] [blame] | 60 | cpu: "ios_x86_64" |
Cal Peyser | f026e14 | 2016-12-19 18:16:26 +0000 | [diff] [blame] | 61 | toolchain_identifier: "ios_x86_64" |
| 62 | } |
| 63 | |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 64 | # Android tooling requires a default toolchain for the armeabi-v7a cpu. |
| 65 | toolchain { |
| 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-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 78 | 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 | |
| 98 | toolchain { |
Cal Peyser | f026e14 | 2016-12-19 18:16:26 +0000 | [diff] [blame] | 99 | 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 | |
| 129 | toolchain { |
Yun Peng | c77eac9 | 2017-03-08 13:54:06 +0000 | [diff] [blame] | 130 | toolchain_identifier: "%{toolchain_name}" |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 131 | %{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 Hlopko | 71c72c1 | 2017-02-23 14:10:31 +0000 | [diff] [blame] | 142 | |
| 143 | %{coverage} |
Benjamin Peterson | b9e1c8a | 2017-12-05 06:27:26 -0800 | [diff] [blame] | 144 | |
| 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-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 158 | } |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 159 | |
| 160 | toolchain { |
Yun Peng | e9f4090 | 2018-01-03 09:20:27 -0800 | [diff] [blame] | 161 | 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 | |
| 177 | toolchain { |
Yun Peng | c77eac9 | 2017-03-08 13:54:06 +0000 | [diff] [blame] | 178 | toolchain_identifier: "msvc_x64" |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 179 | host_system_name: "local" |
| 180 | target_system_name: "local" |
| 181 | |
| 182 | abi_version: "local" |
| 183 | abi_libc_version: "local" |
Yun Peng | c77eac9 | 2017-03-08 13:54:06 +0000 | [diff] [blame] | 184 | target_cpu: "x64_windows" |
Yun Peng | e9f4090 | 2018-01-03 09:20:27 -0800 | [diff] [blame] | 185 | compiler: "msvc-cl" |
| 186 | target_libc: "msvcrt" |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 187 | default_python_version: "python2.7" |
| 188 | |
| 189 | %{cxx_builtin_include_directory} |
| 190 | |
| 191 | tool_path { |
| 192 | name: "ar" |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 193 | path: "%{msvc_lib_path}" |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 194 | } |
| 195 | tool_path { |
Seth Greenstein | ae760d2 | 2017-11-17 02:20:06 -0800 | [diff] [blame] | 196 | name: "ml" |
| 197 | path: "%{msvc_ml_path}" |
| 198 | } |
| 199 | tool_path { |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 200 | name: "cpp" |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 201 | path: "%{msvc_cl_path}" |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 202 | } |
| 203 | tool_path { |
| 204 | name: "gcc" |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 205 | path: "%{msvc_cl_path}" |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 206 | } |
| 207 | tool_path { |
| 208 | name: "gcov" |
| 209 | path: "wrapper/bin/msvc_nop.bat" |
| 210 | } |
| 211 | tool_path { |
| 212 | name: "ld" |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 213 | path: "%{msvc_link_path}" |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 214 | } |
| 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 Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 232 | supports_start_end_lib: false |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 233 | supports_interface_shared_objects: true |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 234 | supports_incremental_linker: false |
| 235 | supports_normalizing_ar: true |
| 236 | needsPic: false |
| 237 | |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 238 | # TODO(pcloudy): Review those flags below, they should be defined by cl.exe |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 239 | compiler_flag: "/DCOMPILER_MSVC" |
| 240 | |
pcloudy | b9554c1 | 2017-07-10 14:09:16 +0200 | [diff] [blame] | 241 | # Don't define min/max macros in windows.h. |
| 242 | compiler_flag: "/DNOMINMAX" |
| 243 | |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 244 | # 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 Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 250 | |
| 251 | # Useful options to have on for compilation. |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 252 | # 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 Masterson | fefd1b2 | 2018-03-02 01:21:37 -0800 | [diff] [blame] | 262 | # Catch C++ exceptions only and tell the compiler to assume that functions declared |
| 263 | # as extern "C" never throw a C++ exception. |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 264 | 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 Peng | f3fd3a4 | 2017-04-24 13:37:46 +0200 | [diff] [blame] | 276 | linker_flag: "/MACHINE:X64" |
| 277 | |
hlopko | 26e5a47 | 2017-07-05 14:06:39 -0400 | [diff] [blame] | 278 | feature { |
| 279 | name: "no_legacy_features" |
| 280 | } |
| 281 | |
Yun Peng | f3fd3a4 | 2017-04-24 13:37:46 +0200 | [diff] [blame] | 282 | # 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" |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 296 | action: "c++-link-nodeps-dynamic-library" |
Yun Peng | f3fd3a4 | 2017-04-24 13:37:46 +0200 | [diff] [blame] | 297 | action: "c++-link-static-library" |
Yun Peng | f3fd3a4 | 2017-04-24 13:37:46 +0200 | [diff] [blame] | 298 | flag_group { |
| 299 | flag: "/nologo" |
| 300 | } |
| 301 | } |
| 302 | } |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 303 | |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 304 | feature { |
| 305 | name: 'has_configured_linker_path' |
| 306 | } |
| 307 | |
Yun Peng | 0286694 | 2017-08-04 10:45:46 +0200 | [diff] [blame] | 308 | # 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 Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 313 | # This feature indicates this is a toolchain targeting Windows. |
| 314 | feature { |
| 315 | name: 'targets_windows' |
Yun Peng | 481657d | 2017-09-20 10:25:48 +0200 | [diff] [blame] | 316 | implies: 'copy_dynamic_libraries_to_binary' |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 317 | enabled: true |
| 318 | } |
| 319 | |
Yun Peng | 481657d | 2017-09-20 10:25:48 +0200 | [diff] [blame] | 320 | feature { |
| 321 | name: 'copy_dynamic_libraries_to_binary' |
| 322 | } |
| 323 | |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 324 | action_config { |
Seth Greenstein | ae760d2 | 2017-11-17 02:20:06 -0800 | [diff] [blame] | 325 | 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 Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 345 | config_name: 'c-compile' |
| 346 | action_name: 'c-compile' |
| 347 | tool { |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 348 | tool_path: '%{msvc_cl_path}' |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 349 | } |
| 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 | } |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 375 | implies: 'legacy_compile_flags' |
Yun Peng | f3fd3a4 | 2017-04-24 13:37:46 +0200 | [diff] [blame] | 376 | implies: 'nologo' |
Yun Peng | 6a0ddd8 | 2017-04-05 13:52:28 +0000 | [diff] [blame] | 377 | implies: 'msvc_env' |
Yun Peng | 29d5e9c | 2017-04-25 14:21:41 +0200 | [diff] [blame] | 378 | implies: 'parse_showincludes' |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 379 | implies: 'user_compile_flags' |
hlopko | b05bff6 | 2017-09-12 10:51:44 +0200 | [diff] [blame] | 380 | implies: 'sysroot' |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 381 | implies: 'unfiltered_compile_flags' |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 382 | } |
| 383 | |
| 384 | action_config { |
| 385 | config_name: 'c++-compile' |
| 386 | action_name: 'c++-compile' |
| 387 | tool { |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 388 | tool_path: '%{msvc_cl_path}' |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 389 | } |
| 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 | } |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 415 | implies: 'legacy_compile_flags' |
Yun Peng | f3fd3a4 | 2017-04-24 13:37:46 +0200 | [diff] [blame] | 416 | implies: 'nologo' |
Yun Peng | 6a0ddd8 | 2017-04-05 13:52:28 +0000 | [diff] [blame] | 417 | implies: 'msvc_env' |
Yun Peng | 29d5e9c | 2017-04-25 14:21:41 +0200 | [diff] [blame] | 418 | implies: 'parse_showincludes' |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 419 | implies: 'user_compile_flags' |
hlopko | b05bff6 | 2017-09-12 10:51:44 +0200 | [diff] [blame] | 420 | implies: 'sysroot' |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 421 | implies: 'unfiltered_compile_flags' |
Yun Peng | 56b16e7 | 2016-07-12 10:55:57 +0000 | [diff] [blame] | 422 | } |
| 423 | |
Yun Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 424 | action_config { |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 425 | config_name: 'c++-link-executable' |
| 426 | action_name: 'c++-link-executable' |
| 427 | tool { |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 428 | tool_path: '%{msvc_link_path}' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 429 | } |
| 430 | implies: 'nologo' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 431 | implies: 'linkstamps' |
| 432 | implies: 'output_execpath_flags' |
| 433 | implies: 'input_param_flags' |
| 434 | implies: 'legacy_link_flags' |
Laszlo Csomor | 1a63644 | 2017-07-20 12:38:02 +0200 | [diff] [blame] | 435 | implies: 'linker_subsystem_flag' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 436 | implies: 'linker_param_file' |
| 437 | implies: 'msvc_env' |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 438 | implies: 'use_linker' |
Yun Peng | 0286694 | 2017-08-04 10:45:46 +0200 | [diff] [blame] | 439 | implies: 'no_stripping' |
Yun Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | action_config { |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 443 | config_name: 'c++-link-dynamic-library' |
| 444 | action_name: 'c++-link-dynamic-library' |
| 445 | tool { |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 446 | tool_path: '%{msvc_link_path}' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 447 | } |
| 448 | implies: 'nologo' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 449 | implies: 'shared_flag' |
| 450 | implies: 'linkstamps' |
| 451 | implies: 'output_execpath_flags' |
| 452 | implies: 'input_param_flags' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 453 | implies: 'legacy_link_flags' |
Laszlo Csomor | 1a63644 | 2017-07-20 12:38:02 +0200 | [diff] [blame] | 454 | implies: 'linker_subsystem_flag' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 455 | implies: 'linker_param_file' |
| 456 | implies: 'msvc_env' |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 457 | implies: 'use_linker' |
Yun Peng | 0286694 | 2017-08-04 10:45:46 +0200 | [diff] [blame] | 458 | implies: 'no_stripping' |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 459 | implies: 'has_configured_linker_path' |
Yun Peng | 9cc954a | 2017-11-14 01:45:02 -0800 | [diff] [blame] | 460 | implies: 'def_file' |
Yun Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | action_config { |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 464 | 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 { |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 485 | config_name: 'c++-link-static-library' |
| 486 | action_name: 'c++-link-static-library' |
| 487 | tool { |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 488 | tool_path: '%{msvc_lib_path}' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 489 | } |
| 490 | implies: 'nologo' |
hlopko | a4697fd | 2017-06-01 10:14:40 +0200 | [diff] [blame] | 491 | implies: 'archiver_flags' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 492 | implies: 'input_param_flags' |
| 493 | implies: 'linker_param_file' |
| 494 | implies: 'msvc_env' |
Yun Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 495 | } |
| 496 | |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 497 | # 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' |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 503 | 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" |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 530 | action: "c++-link-nodeps-dynamic-library" |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 531 | action: "c++-link-static-library" |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 532 | 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" |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 560 | action: "c++-link-nodeps-dynamic-library" |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 561 | env_entry { |
| 562 | key: "USE_LINKER" |
| 563 | value: "1" |
| 564 | } |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | feature { |
| 569 | name: 'include_paths' |
| 570 | flag_set { |
Seth Greenstein | ae760d2 | 2017-11-17 02:20:06 -0800 | [diff] [blame] | 571 | action: "assemble" |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 572 | 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 Greenstein | ae760d2 | 2017-11-17 02:20:06 -0800 | [diff] [blame] | 596 | action: "assemble" |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 597 | 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 { |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 614 | 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 Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 627 | feature { |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 628 | name: 'generate_pdb_file' |
| 629 | requires: { |
| 630 | feature: 'dbg' |
| 631 | } |
| 632 | requires: { |
| 633 | feature: 'fastbuild' |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | feature { |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 638 | name: 'shared_flag' |
| 639 | flag_set { |
| 640 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 641 | action: "c++-link-nodeps-dynamic-library" |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 642 | flag_group { |
| 643 | flag: '/DLL' |
| 644 | } |
| 645 | } |
Yun Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 646 | } |
| 647 | |
| 648 | feature { |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 649 | name: 'linkstamps' |
| 650 | flag_set { |
| 651 | action: 'c++-link-executable' |
| 652 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 653 | action: "c++-link-nodeps-dynamic-library" |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 654 | expand_if_all_available: 'linkstamp_paths' |
| 655 | flag_group { |
hlopko | ec41b8c | 2017-07-04 04:31:11 -0400 | [diff] [blame] | 656 | iterate_over: 'linkstamp_paths' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 657 | flag: '%{linkstamp_paths}' |
| 658 | } |
| 659 | } |
Yun Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 660 | } |
| 661 | |
| 662 | feature { |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 663 | 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' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 668 | action: "c++-link-nodeps-dynamic-library" |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 669 | flag_group { |
| 670 | flag: '/OUT:%{output_execpath}' |
| 671 | } |
| 672 | } |
Yun Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 673 | } |
| 674 | |
| 675 | feature { |
hlopko | a4697fd | 2017-06-01 10:14:40 +0200 | [diff] [blame] | 676 | name: 'archiver_flags' |
| 677 | flag_set { |
| 678 | expand_if_all_available: 'output_execpath' |
| 679 | action: 'c++-link-static-library' |
hlopko | a4697fd | 2017-06-01 10:14:40 +0200 | [diff] [blame] | 680 | flag_group { |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 681 | flag: '/OUT:%{output_execpath}' |
hlopko | a4697fd | 2017-06-01 10:14:40 +0200 | [diff] [blame] | 682 | } |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | feature { |
Marcel Hlopko | 0ca9d7e | 2016-12-09 15:32:56 +0000 | [diff] [blame] | 687 | name: 'input_param_flags' |
| 688 | flag_set { |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 689 | expand_if_all_available: 'interface_library_output_path' |
Marcel Hlopko | 5374d4f | 2016-12-22 08:04:06 +0000 | [diff] [blame] | 690 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 691 | action: "c++-link-nodeps-dynamic-library" |
Marcel Hlopko | 5374d4f | 2016-12-22 08:04:06 +0000 | [diff] [blame] | 692 | flag_group { |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 693 | flag: "/IMPLIB:%{interface_library_output_path}" |
Marcel Hlopko | 5374d4f | 2016-12-22 08:04:06 +0000 | [diff] [blame] | 694 | } |
| 695 | } |
| 696 | flag_set { |
Marcel Hlopko | 0ca9d7e | 2016-12-09 15:32:56 +0000 | [diff] [blame] | 697 | expand_if_all_available: 'libopts' |
| 698 | action: 'c++-link-executable' |
| 699 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 700 | action: "c++-link-nodeps-dynamic-library" |
Marcel Hlopko | 0ca9d7e | 2016-12-09 15:32:56 +0000 | [diff] [blame] | 701 | flag_group { |
hlopko | ec41b8c | 2017-07-04 04:31:11 -0400 | [diff] [blame] | 702 | iterate_over: 'libopts' |
hlopko | 21903f9 | 2017-04-27 17:37:31 +0200 | [diff] [blame] | 703 | flag: '%{libopts}' |
Marcel Hlopko | 0ca9d7e | 2016-12-09 15:32:56 +0000 | [diff] [blame] | 704 | } |
| 705 | } |
| 706 | flag_set { |
| 707 | expand_if_all_available: 'libraries_to_link' |
| 708 | action: 'c++-link-executable' |
| 709 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 710 | action: "c++-link-nodeps-dynamic-library" |
Marcel Hlopko | 0ca9d7e | 2016-12-09 15:32:56 +0000 | [diff] [blame] | 711 | action: 'c++-link-static-library' |
Marcel Hlopko | 0ca9d7e | 2016-12-09 15:32:56 +0000 | [diff] [blame] | 712 | flag_group { |
| 713 | iterate_over: 'libraries_to_link' |
| 714 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 715 | expand_if_equal: { |
| 716 | variable: 'libraries_to_link.type' |
| 717 | value: 'object_file_group' |
| 718 | } |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 719 | iterate_over: 'libraries_to_link.object_files' |
| 720 | flag_group { |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 721 | flag: '%{libraries_to_link.object_files}' |
| 722 | } |
Marcel Hlopko | 0ca9d7e | 2016-12-09 15:32:56 +0000 | [diff] [blame] | 723 | } |
| 724 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 725 | expand_if_equal: { |
| 726 | variable: 'libraries_to_link.type' |
| 727 | value: 'object_file' |
| 728 | } |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 729 | flag_group { |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 730 | flag: '%{libraries_to_link.name}' |
| 731 | } |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 732 | } |
| 733 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 734 | expand_if_equal: { |
| 735 | variable: 'libraries_to_link.type' |
| 736 | value: 'interface_library' |
| 737 | } |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 738 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 739 | expand_if_false: 'libraries_to_link.is_whole_archive' |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 740 | flag: '%{libraries_to_link.name}' |
| 741 | } |
| 742 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 743 | expand_if_true: 'libraries_to_link.is_whole_archive' |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 744 | flag: '/WHOLEARCHIVE:%{libraries_to_link.name}' |
| 745 | } |
| 746 | } |
| 747 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 748 | expand_if_equal: { |
| 749 | variable: 'libraries_to_link.type' |
| 750 | value: 'static_library' |
| 751 | } |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 752 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 753 | expand_if_false: 'libraries_to_link.is_whole_archive' |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 754 | flag: '%{libraries_to_link.name}' |
| 755 | } |
| 756 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 757 | expand_if_true: 'libraries_to_link.is_whole_archive' |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 758 | flag: '/WHOLEARCHIVE:%{libraries_to_link.name}' |
| 759 | } |
| 760 | } |
| 761 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 762 | expand_if_equal: { |
| 763 | variable: 'libraries_to_link.type' |
| 764 | value: 'dynamic_library' |
| 765 | } |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 766 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 767 | expand_if_false: 'libraries_to_link.is_whole_archive' |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 768 | flag: '%{libraries_to_link.name}' |
| 769 | } |
| 770 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 771 | expand_if_true: 'libraries_to_link.is_whole_archive' |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 772 | flag: '/WHOLEARCHIVE:%{libraries_to_link.name}' |
| 773 | } |
| 774 | } |
| 775 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 776 | expand_if_equal: { |
| 777 | variable: 'libraries_to_link.type' |
| 778 | value: 'versioned_dynamic_library' |
| 779 | } |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 780 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 781 | expand_if_false: 'libraries_to_link.is_whole_archive' |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 782 | flag: '%{libraries_to_link.name}' |
| 783 | } |
| 784 | flag_group { |
Marcel Hlopko | 1410c21 | 2017-02-27 11:24:36 +0000 | [diff] [blame] | 785 | expand_if_true: 'libraries_to_link.is_whole_archive' |
Marcel Hlopko | f63ea7a | 2017-01-23 12:34:38 +0000 | [diff] [blame] | 786 | flag: '/WHOLEARCHIVE:%{libraries_to_link.name}' |
| 787 | } |
Marcel Hlopko | 0ca9d7e | 2016-12-09 15:32:56 +0000 | [diff] [blame] | 788 | } |
| 789 | } |
| 790 | } |
Yun Peng | 81aede1 | 2016-10-25 13:49:28 +0000 | [diff] [blame] | 791 | } |
| 792 | |
Laszlo Csomor | 1a63644 | 2017-07-20 12:38:02 +0200 | [diff] [blame] | 793 | # 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' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 803 | action: "c++-link-nodeps-dynamic-library" |
Laszlo Csomor | 1a63644 | 2017-07-20 12:38:02 +0200 | [diff] [blame] | 804 | 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 Hlopko | 5b63024 | 2016-12-22 08:48:05 +0000 | [diff] [blame] | 815 | feature { |
Marcel Hlopko | 75c95ac | 2016-12-22 16:10:54 +0000 | [diff] [blame] | 816 | name: 'legacy_link_flags' |
Marcel Hlopko | 5b63024 | 2016-12-22 08:48:05 +0000 | [diff] [blame] | 817 | flag_set { |
Marcel Hlopko | 75c95ac | 2016-12-22 16:10:54 +0000 | [diff] [blame] | 818 | expand_if_all_available: 'legacy_link_flags' |
Marcel Hlopko | 5b63024 | 2016-12-22 08:48:05 +0000 | [diff] [blame] | 819 | action: 'c++-link-executable' |
| 820 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 821 | action: "c++-link-nodeps-dynamic-library" |
Marcel Hlopko | 5b63024 | 2016-12-22 08:48:05 +0000 | [diff] [blame] | 822 | flag_group { |
hlopko | ec41b8c | 2017-07-04 04:31:11 -0400 | [diff] [blame] | 823 | iterate_over: 'legacy_link_flags' |
Marcel Hlopko | 75c95ac | 2016-12-22 16:10:54 +0000 | [diff] [blame] | 824 | flag: '%{legacy_link_flags}' |
Marcel Hlopko | 5b63024 | 2016-12-22 08:48:05 +0000 | [diff] [blame] | 825 | } |
| 826 | } |
| 827 | } |
| 828 | |
Marcel Hlopko | 46d3632 | 2017-01-24 10:39:40 +0000 | [diff] [blame] | 829 | 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' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 835 | action: "c++-link-nodeps-dynamic-library" |
Marcel Hlopko | 46d3632 | 2017-01-24 10:39:40 +0000 | [diff] [blame] | 836 | action: 'c++-link-static-library' |
Marcel Hlopko | 46d3632 | 2017-01-24 10:39:40 +0000 | [diff] [blame] | 837 | flag_group { |
| 838 | flag: '@%{linker_param_file}' |
| 839 | } |
| 840 | } |
| 841 | } |
| 842 | |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 843 | feature { |
Yun Peng | 1edcd0f | 2017-09-26 10:30:44 +0200 | [diff] [blame] | 844 | name: 'static_link_msvcrt' |
Yun Peng | 3b08f77 | 2017-05-04 06:17:42 -0400 | [diff] [blame] | 845 | } |
| 846 | |
| 847 | feature { |
Yun Peng | 1edcd0f | 2017-09-26 10:30:44 +0200 | [diff] [blame] | 848 | name: 'static_link_msvcrt_no_debug' |
Yun Peng | 3b08f77 | 2017-05-04 06:17:42 -0400 | [diff] [blame] | 849 | flag_set { |
| 850 | action: 'c-compile' |
| 851 | action: 'c++-compile' |
| 852 | flag_group { |
Yun Peng | 1edcd0f | 2017-09-26 10:30:44 +0200 | [diff] [blame] | 853 | flag: "/MT" |
Yun Peng | 3b08f77 | 2017-05-04 06:17:42 -0400 | [diff] [blame] | 854 | } |
| 855 | } |
| 856 | flag_set { |
| 857 | action: 'c++-link-executable' |
| 858 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 859 | action: "c++-link-nodeps-dynamic-library" |
Yun Peng | 3b08f77 | 2017-05-04 06:17:42 -0400 | [diff] [blame] | 860 | flag_group { |
Yun Peng | 1edcd0f | 2017-09-26 10:30:44 +0200 | [diff] [blame] | 861 | flag: "/DEFAULTLIB:libcmt.lib" |
Yun Peng | 3b08f77 | 2017-05-04 06:17:42 -0400 | [diff] [blame] | 862 | } |
| 863 | } |
Yun Peng | 1edcd0f | 2017-09-26 10:30:44 +0200 | [diff] [blame] | 864 | 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' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 880 | action: "c++-link-nodeps-dynamic-library" |
Yun Peng | 1edcd0f | 2017-09-26 10:30:44 +0200 | [diff] [blame] | 881 | 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' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 901 | action: "c++-link-nodeps-dynamic-library" |
Yun Peng | 1edcd0f | 2017-09-26 10:30:44 +0200 | [diff] [blame] | 902 | 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' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 921 | action: "c++-link-nodeps-dynamic-library" |
Yun Peng | 1edcd0f | 2017-09-26 10:30:44 +0200 | [diff] [blame] | 922 | flag_group { |
| 923 | flag: "/DEFAULTLIB:msvcrtd.lib" |
| 924 | } |
| 925 | } |
| 926 | requires: { feature: 'dbg'} |
Yun Peng | 3b08f77 | 2017-05-04 06:17:42 -0400 | [diff] [blame] | 927 | } |
| 928 | |
| 929 | feature { |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 930 | name: 'dbg' |
| 931 | flag_set { |
| 932 | action: 'c-compile' |
| 933 | action: 'c++-compile' |
| 934 | flag_group { |
| 935 | flag: "/Od" |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 936 | flag: "/Z7" |
pcloudy | 7585dcd | 2017-11-22 06:05:30 -0800 | [diff] [blame] | 937 | flag: "/DDEBUG" |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 938 | } |
| 939 | } |
| 940 | flag_set { |
| 941 | action: 'c++-link-executable' |
| 942 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 943 | action: "c++-link-nodeps-dynamic-library" |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 944 | flag_group { |
Yun Peng | 09a6a9f | 2017-12-11 07:24:45 -0800 | [diff] [blame] | 945 | flag: "%{dbg_mode_debug}" |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 946 | 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 Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 959 | flag: "/Z7" |
pcloudy | 7585dcd | 2017-11-22 06:05:30 -0800 | [diff] [blame] | 960 | flag: "/DDEBUG" |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 961 | } |
| 962 | } |
| 963 | flag_set { |
| 964 | action: 'c++-link-executable' |
| 965 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 966 | action: "c++-link-nodeps-dynamic-library" |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 967 | flag_group { |
Yun Peng | 09a6a9f | 2017-12-11 07:24:45 -0800 | [diff] [blame] | 968 | flag: "%{fastbuild_mode_debug}" |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 969 | 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" |
pcloudy | ebdb4ac | 2017-11-22 05:14:23 -0800 | [diff] [blame] | 982 | flag: "/DNDEBUG" |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 983 | } |
| 984 | } |
| 985 | } |
| 986 | |
hlopko | 646cfd8 | 2017-08-01 22:26:37 +0200 | [diff] [blame] | 987 | feature { |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 988 | name: 'user_compile_flags' |
hlopko | 646cfd8 | 2017-08-01 22:26:37 +0200 | [diff] [blame] | 989 | flag_set { |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 990 | expand_if_all_available: 'user_compile_flags' |
hlopko | 646cfd8 | 2017-08-01 22:26:37 +0200 | [diff] [blame] | 991 | 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 { |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 999 | iterate_over: 'user_compile_flags' |
| 1000 | flag: '%{user_compile_flags}' |
hlopko | 646cfd8 | 2017-08-01 22:26:37 +0200 | [diff] [blame] | 1001 | } |
| 1002 | } |
| 1003 | } |
| 1004 | |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 1005 | feature { |
hlopko | b05bff6 | 2017-09-12 10:51:44 +0200 | [diff] [blame] | 1006 | 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' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 1019 | action: "c++-link-nodeps-dynamic-library" |
hlopko | b05bff6 | 2017-09-12 10:51:44 +0200 | [diff] [blame] | 1020 | flag_group { |
| 1021 | iterate_over: 'sysroot' |
| 1022 | flag: '--sysroot=%{sysroot}' |
| 1023 | } |
| 1024 | } |
| 1025 | } |
| 1026 | |
| 1027 | feature { |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 1028 | name: 'unfiltered_compile_flags' |
| 1029 | flag_set { |
| 1030 | expand_if_all_available: 'unfiltered_compile_flags' |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 1031 | 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 Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 1045 | feature { |
Yun Peng | 9cc954a | 2017-11-14 01:45:02 -0800 | [diff] [blame] | 1046 | name : 'def_file', |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 1047 | flag_set { |
| 1048 | expand_if_all_available: 'def_file_path' |
| 1049 | action: 'c++-link-executable' |
| 1050 | action: 'c++-link-dynamic-library' |
hlopko | dad2276 | 2018-03-01 13:17:23 -0800 | [diff] [blame] | 1051 | action: "c++-link-nodeps-dynamic-library" |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 1052 | 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 Peng | 9cc954a | 2017-11-14 01:45:02 -0800 | [diff] [blame] | 1063 | name: 'windows_export_all_symbols' |
| 1064 | } |
| 1065 | |
| 1066 | feature { |
Yun Peng | 394211b | 2017-09-15 15:59:14 +0200 | [diff] [blame] | 1067 | name: 'no_windows_export_all_symbols' |
| 1068 | } |
| 1069 | |
| 1070 | linking_mode_flags { mode: DYNAMIC } |
hlopko | f322ba7 | 2017-09-08 15:17:18 +0200 | [diff] [blame] | 1071 | |
Yun Peng | 284a611 | 2017-06-06 05:32:34 -0400 | [diff] [blame] | 1072 | %{compilation_mode_content} |
Yun Peng | 997992d | 2017-04-18 13:33:28 +0200 | [diff] [blame] | 1073 | |
Lukacs Berki | 76a2bbc | 2016-08-22 14:53:38 +0000 | [diff] [blame] | 1074 | } |