Commit 2aeb4ab9 authored by Feng Xiao's avatar Feng Xiao Committed by GitHub

Merge pull request #3160 from meteorcloudy/winbuild

Refactor cc options in BUILD file for Windows
parents ddbe3600 0b059a3d
...@@ -8,14 +8,34 @@ exports_files(["LICENSE"]) ...@@ -8,14 +8,34 @@ exports_files(["LICENSE"])
# Protobuf Runtime Library # Protobuf Runtime Library
################################################################################ ################################################################################
COPTS = [ 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", "-DHAVE_PTHREAD",
"-Wall", "-Wall",
"-Wwrite-strings", "-Wwrite-strings",
"-Woverloaded-virtual", "-Woverloaded-virtual",
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-unused-function", "-Wno-unused-function",
] ],
})
config_setting(
name = "windows",
values = { "cpu": "x64_windows" },
)
config_setting(
name = "windows_msvc",
values = { "cpu": "x64_windows_msvc" },
)
config_setting( config_setting(
name = "android", name = "android",
...@@ -60,7 +80,7 @@ config_setting( ...@@ -60,7 +80,7 @@ config_setting(
}, },
) )
IOS_ARM_COPTS = COPTS + [ IOS_ARM_COPTS = [
"-DOS_IOS", "-DOS_IOS",
"-miphoneos-version-min=7.0", "-miphoneos-version-min=7.0",
"-arch armv7", "-arch armv7",
...@@ -103,8 +123,8 @@ cc_library( ...@@ -103,8 +123,8 @@ cc_library(
":ios_armv7": IOS_ARM_COPTS, ":ios_armv7": IOS_ARM_COPTS,
":ios_armv7s": IOS_ARM_COPTS, ":ios_armv7s": IOS_ARM_COPTS,
":ios_arm64": IOS_ARM_COPTS, ":ios_arm64": IOS_ARM_COPTS,
"//conditions:default": COPTS, "//conditions:default": [],
}), }) + COPTS,
includes = ["src/"], includes = ["src/"],
linkopts = LINK_OPTS, linkopts = LINK_OPTS,
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
...@@ -174,8 +194,8 @@ cc_library( ...@@ -174,8 +194,8 @@ cc_library(
":ios_armv7": IOS_ARM_COPTS, ":ios_armv7": IOS_ARM_COPTS,
":ios_armv7s": IOS_ARM_COPTS, ":ios_armv7s": IOS_ARM_COPTS,
":ios_arm64": IOS_ARM_COPTS, ":ios_arm64": IOS_ARM_COPTS,
"//conditions:default": COPTS, "//conditions:default": [],
}), }) + COPTS,
includes = ["src/"], includes = ["src/"],
linkopts = LINK_OPTS, linkopts = LINK_OPTS,
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment