aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/cpp
diff options
context:
space:
mode:
authorGravatar Yun Peng <pcloudy@google.com>2017-03-08 13:54:06 +0000
committerGravatar Vladimir Moskva <vladmos@google.com>2017-03-08 13:56:43 +0000
commitc77eac95ffdee4f127e20266c41cb92cec2a8956 (patch)
tree80635cf6c897b7613d28bdbff6a68ae6ea95cc5e /tools/cpp
parenta1ea9963d33f87ed61739c72c495f73246119eea (diff)
Make MSVC CROSSTOOL default on Windows
The default C++ CROSSTOOL on Windows now becomes MSVC, --cpu=x64_windows_msvc is still supported To use MSYS toolcahin, add --cpu=x64_windows_msys and --host_cpu=x64_windows_msys for host compilation See https://github.com/bazelbuild/bazel/issues/2627 -- Change-Id: Ie788a39cb5ffbc9fc956ccfd51a3cc816c74543a Reviewed-on: https://cr.bazel.build/9292 PiperOrigin-RevId: 149530250 MOS_MIGRATED_REVID=149530250
Diffstat (limited to 'tools/cpp')
-rw-r--r--tools/cpp/BUILD.static9
-rw-r--r--tools/cpp/CROSSTOOL.tpl15
-rw-r--r--tools/cpp/cc_configure.bzl10
3 files changed, 22 insertions, 12 deletions
diff --git a/tools/cpp/BUILD.static b/tools/cpp/BUILD.static
index 43bdad83bc..9ae4950d80 100644
--- a/tools/cpp/BUILD.static
+++ b/tools/cpp/BUILD.static
@@ -19,8 +19,9 @@ cc_toolchain_suite(
toolchains = {
"armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a",
"freebsd|compiler": ":cc-compiler-freebsd",
- "x64_windows|windows_msys64": ":cc-compiler-x64_windows",
- "x64_windows_msvc|cl": ":cc-compiler-x64_windows_msvc",
+ "x64_windows|cl": ":cc-compiler-x64_windows",
+ "x64_windows_msvc|cl": ":cc-compiler-x64_windows",
+ "x64_windows_msys|windows_msys64": ":cc-compiler-x64_windows_msys",
"ios_x86_64|compiler": ":cc-compiler-ios_x86_64",
},
)
@@ -54,7 +55,7 @@ cc_toolchain(
)
cc_toolchain(
- name = "cc-compiler-x64_windows",
+ name = "cc-compiler-x64_windows_msys",
all_files = ":empty",
compiler_files = ":empty",
cpu = "local",
@@ -68,7 +69,7 @@ cc_toolchain(
)
cc_toolchain(
- name = "cc-compiler-x64_windows_msvc",
+ name = "cc-compiler-x64_windows",
all_files = ":every-file-x64_windows",
compiler_files = ":compile-x64_windows",
cpu = "x64_windows",
diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl
index 1a18ebe549..906c1f5ccd 100644
--- a/tools/cpp/CROSSTOOL.tpl
+++ b/tools/cpp/CROSSTOOL.tpl
@@ -4,7 +4,7 @@ default_target_cpu: "same_as_host"
default_toolchain {
cpu: "%{cpu}"
- toolchain_identifier: "local"
+ toolchain_identifier: "%{default_toolchain_name}"
}
default_toolchain {
@@ -14,7 +14,12 @@ default_toolchain {
default_toolchain {
cpu: "x64_windows_msvc"
- toolchain_identifier: "vc_14_0_x64"
+ toolchain_identifier: "msvc_x64"
+}
+
+default_toolchain {
+ cpu: "x64_windows_msys"
+ toolchain_identifier: "msys_x64"
}
default_toolchain {
@@ -93,7 +98,7 @@ toolchain {
}
toolchain {
- toolchain_identifier: "local"
+ toolchain_identifier: "%{toolchain_name}"
%{content}
compilation_mode_flags {
@@ -110,13 +115,13 @@ toolchain {
}
toolchain {
- toolchain_identifier: "vc_14_0_x64"
+ toolchain_identifier: "msvc_x64"
host_system_name: "local"
target_system_name: "local"
abi_version: "local"
abi_libc_version: "local"
- target_cpu: "x64_windows_msvc"
+ target_cpu: "x64_windows"
compiler: "cl"
target_libc: "msvcrt140"
default_python_version: "python2.7"
diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl
index 99ae959582..744e0ed249 100644
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -301,7 +301,7 @@ def _crosstool_content(repository_ctx, cc, cpu_value, darwin):
}
# TODO(pcloudy): Remove this after MSVC CROSSTOOL becomes default on Windows
-def _get_windows_crosstool_content(repository_ctx):
+def _get_windows_msys_crosstool_content(repository_ctx):
"""Return the content of msys crosstool which is still the default CROSSTOOL on Windows."""
bazel_sh = _get_env_var(repository_ctx, "BAZEL_SH").replace("\\", "/").lower()
tokens = bazel_sh.rsplit("/", 1)
@@ -327,7 +327,7 @@ def _get_windows_crosstool_content(repository_ctx):
' host_system_name: "local"\n' +
" needsPic: false\n" +
' target_libc: "local"\n' +
- ' target_cpu: "x64_windows"\n' +
+ ' target_cpu: "x64_windows_msys"\n' +
' target_system_name: "local"\n' +
' tool_path { name: "ar" path: "%susr/bin/ar" }\n' % msys_root +
' tool_path { name: "compat-ld" path: "%susr/bin/ld" }\n' % msys_root +
@@ -718,7 +718,9 @@ def _impl(repository_ctx):
cxx_include_directories.append(("cxx_builtin_include_directory: \"%s\"" % path))
_tpl(repository_ctx, "CROSSTOOL", {
"%{cpu}": cpu_value,
- "%{content}": _get_windows_crosstool_content(repository_ctx),
+ "%{default_toolchain_name}": "msvc_x64",
+ "%{toolchain_name}": "msys_x64",
+ "%{content}": _get_windows_msys_crosstool_content(repository_ctx),
"%{opt_content}": "",
"%{dbg_content}": "",
"%{cxx_builtin_include_directory}": "\n".join(cxx_include_directories),
@@ -743,6 +745,8 @@ def _impl(repository_ctx):
"cc_wrapper.sh")
_tpl(repository_ctx, "CROSSTOOL", {
"%{cpu}": cpu_value,
+ "%{default_toolchain_name}": "local",
+ "%{toolchain_name}": "local",
"%{content}": _build_crosstool(crosstool_content) + "\n" +
_build_tool_path(tool_paths),
"%{opt_content}": _build_crosstool(opt_content, " "),