Add support for clang-cl compiler (#1021)
diff --git a/BUILD b/BUILD
index 07a6793..34e4a54 100644
--- a/BUILD
+++ b/BUILD
@@ -45,6 +45,17 @@
STRICT_C_OPTIONS = select({
":msvc": [],
+ ":clang-cl": [
+ "/W4",
+ "-Wconversion",
+ "-Wlong-long",
+ "-Wmissing-declarations",
+ "-Wmissing-prototypes",
+ "-Wno-strict-aliasing",
+ "-Wshadow",
+ "-Wsign-compare",
+ "-Wno-sign-conversion",
+ ],
"//conditions:default": [
"--pedantic-errors",
"-Wall",
@@ -124,6 +135,7 @@
hdrs = [":enc_headers"],
copts = STRICT_C_OPTIONS,
linkopts = select({
+ ":clang-cl": [],
":msvc": [],
"//conditions:default": ["-lm"],
}),
diff --git a/compiler_config_setting.bzl b/compiler_config_setting.bzl
index 572032b..b7bb7b9 100644
--- a/compiler_config_setting.bzl
+++ b/compiler_config_setting.bzl
@@ -14,6 +14,13 @@
# be removed.
if hasattr(cc_common, "do_not_use_tools_cpp_compiler_present"):
native.config_setting(
+ name = "clang-cl",
+ flag_values = {
+ "@bazel_tools//tools/cpp:compiler": "clang-cl",
+ },
+ visibility = ["//visibility:public"],
+ )
+ native.config_setting(
name = "msvc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
@@ -22,6 +29,11 @@
)
else:
native.config_setting(
+ name = "clang-cl",
+ values = {"compiler": "clang-cl"},
+ visibility = ["//visibility:public"],
+ )
+ native.config_setting(
name = "msvc",
values = {"compiler": "msvc-cl"},
visibility = ["//visibility:public"],