Refactor cc options in BUILD file for Windows

Don't put gcc warnings options in copts, so that protobuf is able to
build by MSVC toolchain without python wrappers.
This commit is contained in:
Yun Peng 2017-05-31 14:01:23 +02:00
parent d6470abef1
commit 0b059a3d8a

44
BUILD
View file

@ -8,15 +8,35 @@ exports_files(["LICENSE"])
# Protobuf Runtime Library
################################################################################
COPTS = [
"-DHAVE_PTHREAD",
"-Wall",
"-Wwrite-strings",
"-Woverloaded-virtual",
"-Wno-sign-compare",
"-Wno-unused-function",
WIN_COPTS = [
"/DHAVE_PTHREAD",
"/wd4018", # -Wno-sign-compare
"/wd4514", # -Wno-unused-function
]
COPTS = select({
":windows" : WIN_COPTS,
":windows_msvc" : WIN_COPTS,
"//conditions:default": [
"-DHAVE_PTHREAD",
"-Wall",
"-Wwrite-strings",
"-Woverloaded-virtual",
"-Wno-sign-compare",
"-Wno-unused-function",
],
})
config_setting(
name = "windows",
values = { "cpu": "x64_windows" },
)
config_setting(
name = "windows_msvc",
values = { "cpu": "x64_windows_msvc" },
)
config_setting(
name = "android",
values = {
@ -60,7 +80,7 @@ config_setting(
},
)
IOS_ARM_COPTS = COPTS + [
IOS_ARM_COPTS = [
"-DOS_IOS",
"-miphoneos-version-min=7.0",
"-arch armv7",
@ -103,8 +123,8 @@ cc_library(
":ios_armv7": IOS_ARM_COPTS,
":ios_armv7s": IOS_ARM_COPTS,
":ios_arm64": IOS_ARM_COPTS,
"//conditions:default": COPTS,
}),
"//conditions:default": [],
}) + COPTS,
includes = ["src/"],
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
@ -174,8 +194,8 @@ cc_library(
":ios_armv7": IOS_ARM_COPTS,
":ios_armv7s": IOS_ARM_COPTS,
":ios_arm64": IOS_ARM_COPTS,
"//conditions:default": COPTS,
}),
"//conditions:default": [],
}) + COPTS,
includes = ["src/"],
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],