Fixed the Windows build of protoc by statically linking deps.
diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel
index 29a1f12..a5d831c 100644
--- a/build_defs/BUILD.bazel
+++ b/build_defs/BUILD.bazel
@@ -59,6 +59,20 @@
},
)
+config_setting(
+ name = "config_win32",
+ values = {
+ "cpu": "win32",
+ },
+)
+
+config_setting(
+ name = "config_win64",
+ values = {
+ "cpu": "win64",
+ },
+)
+
# Internal testing:
starlark_cc_proto_library(
diff --git a/build_defs/cpp_opts.bzl b/build_defs/cpp_opts.bzl
index f868c4a..1d5594d 100644
--- a/build_defs/cpp_opts.bzl
+++ b/build_defs/cpp_opts.bzl
@@ -38,3 +38,10 @@
"-lm",
],
})
+
+# When cross-compiling for Windows we need to statically link pthread and the C++ library.
+PROTOC_LINK_OPTS = select({
+ "//build_defs:config_win32": ["-static"],
+ "//build_defs:config_win64": ["-static"],
+ "//conditions:default": [],
+})