Fixed the Windows build of protoc by statically linking deps.
This commit is contained in:
parent
6d2827b377
commit
2dc7679cc1
@ -6,7 +6,7 @@ load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
|
||||
load("@rules_python//python:defs.bzl", "py_library")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library")
|
||||
load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS")
|
||||
load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS", "PROTOC_LINK_OPTS")
|
||||
load(
|
||||
":protobuf.bzl",
|
||||
"adapt_proto_library",
|
||||
@ -442,7 +442,7 @@ cc_library(
|
||||
cc_binary(
|
||||
name = "protoc",
|
||||
srcs = ["src/google/protobuf/compiler/main.cc"],
|
||||
linkopts = LINK_OPTS,
|
||||
linkopts = LINK_OPTS + PROTOC_LINK_OPTS,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":protoc_lib"],
|
||||
)
|
||||
|
@ -59,6 +59,20 @@ config_setting(
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "config_win32",
|
||||
values = {
|
||||
"cpu": "win32",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "config_win64",
|
||||
values = {
|
||||
"cpu": "win64",
|
||||
},
|
||||
)
|
||||
|
||||
# Internal testing:
|
||||
|
||||
starlark_cc_proto_library(
|
||||
|
@ -38,3 +38,10 @@ LINK_OPTS = select({
|
||||
"-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": [],
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user