diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/cpp/CROSSTOOL.tpl | 4 | ||||
-rw-r--r-- | tools/cpp/unix_cc_configure.bzl | 2 | ||||
-rw-r--r-- | tools/cpp/windows_cc_configure.bzl | 12 |
3 files changed, 16 insertions, 2 deletions
diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl index 62686738aa..e75e5e25dc 100644 --- a/tools/cpp/CROSSTOOL.tpl +++ b/tools/cpp/CROSSTOOL.tpl @@ -949,7 +949,7 @@ toolchain { action: 'c++-link-executable' action: 'c++-link-dynamic-library' flag_group { - flag: "/DEBUG:FULL" + flag: "%{dbg_mode_debug}" flag: "/INCREMENTAL:NO" } } @@ -971,7 +971,7 @@ toolchain { action: 'c++-link-executable' action: 'c++-link-dynamic-library' flag_group { - flag: "/DEBUG:FASTLINK" + flag: "%{fastbuild_mode_debug}" flag: "/INCREMENTAL:NO" } } diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl index aa46f55978..9814831db7 100644 --- a/tools/cpp/unix_cc_configure.bzl +++ b/tools/cpp/unix_cc_configure.bzl @@ -395,5 +395,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value): "%{msvc_ml_path}": "", "%{msvc_link_path}": "", "%{msvc_lib_path}": "", + "%{dbg_mode_debug}": "", + "%{fastbuild_mode_debug}": "", "%{compilation_mode_content}": "", }) diff --git a/tools/cpp/windows_cc_configure.bzl b/tools/cpp/windows_cc_configure.bzl index d798f0cb25..666592622e 100644 --- a/tools/cpp/windows_cc_configure.bzl +++ b/tools/cpp/windows_cc_configure.bzl @@ -240,6 +240,13 @@ def _is_support_whole_archive(repository_ctx, vc_path): return result.find("/WHOLEARCHIVE") != -1 +def _is_support_debug_fastlink(repository_ctx, vc_path): + """Run MSVC linker alone to see if it supports /DEBUG:FASTLINK.""" + linker = find_msvc_tool(repository_ctx, vc_path, "link.exe") + result = execute(repository_ctx, [linker], expect_failure = True) + return result.find("/DEBUG[:{FASTLINK|FULL|NONE}]") != -1 + + def _is_use_msvc_wrapper(repository_ctx): """Returns True if USE_MSVC_WRAPPER is set to 1.""" env = repository_ctx.os.environ @@ -361,6 +368,9 @@ def configure_windows_toolchain(repository_ctx): for path in escaped_include_paths.split(";"): if path: escaped_cxx_include_directories.append("cxx_builtin_include_directory: \"%s\"" % path) + + support_debug_fastlink = _is_support_debug_fastlink(repository_ctx, vc_path) + tpl(repository_ctx, "CROSSTOOL", { "%{cpu}": "x64_windows", "%{default_toolchain_name}": "msvc_x64", @@ -373,6 +383,8 @@ def configure_windows_toolchain(repository_ctx): "%{msvc_ml_path}": msvc_ml_path, "%{msvc_link_path}": msvc_link_path, "%{msvc_lib_path}": msvc_lib_path, + "%{dbg_mode_debug}": "/DEBUG:FULL" if support_debug_fastlink else "/DEBUG", + "%{fastbuild_mode_debug}": "/DEBUG:FASTLINK" if support_debug_fastlink else "/DEBUG", "%{compilation_mode_content}": compilation_mode_content, "%{content}": _get_escaped_windows_msys_crosstool_content(repository_ctx), "%{opt_content}": "", |