Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
0456e269
Commit
0456e269
authored
Jun 06, 2018
by
Loo Rong Jie
Committed by
Feng Xiao
Jun 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Align Bazel on Windows with CMake's MSVC flags (#4720)
* Align Bazel on Windows with CMake's MSVC flags
parent
6933e2f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
12 deletions
+34
-12
BUILD
BUILD
+34
-12
No files found.
BUILD
View file @
0456e269
...
...
@@ -22,7 +22,20 @@ config_setting(
MSVC_COPTS = [
"/DHAVE_PTHREAD",
"/wd4018", # -Wno-sign-compare
"/wd4065", # switch statement contains 'default' but no 'case' labels
"/wd4146", # unary minus operator applied to unsigned type, result still unsigned
"/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data
"/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
"/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data
"/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
"/wd4307", # 'operator' : integral constant overflow
"/wd4309", # 'conversion' : truncation of constant value
"/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
"/wd4355", # 'this' : used in base member initializer list
"/wd4506", # no definition for inline function 'function'
"/wd4514", # -Wno-unused-function
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
"/wd4996", # The compiler encountered a deprecated declaration.
]
COPTS = select({
...
...
@@ -55,17 +68,8 @@ config_setting(
LINK_OPTS = select({
":android": [],
":msvc": [
# Linking to setargv.obj makes the default command line argument
# parser expand wildcards, so the main method's argv will contain the
# expanded list instead of the wildcards.
# Using -WHOLEARCHIVE, because:
# - Microsoft ships this object file next to default libraries
# - but this file is not a library, just a precompiled object
# - just listing the name here without "-WHOLEARCHIVE:" would make Bazel
# believe that "setargv.obj" is a source or rule output in this
# package, which it is not.
# See https://msdn.microsoft.com/en-us/library/8bch7bkk.aspx
"-WHOLEARCHIVE:setargv.obj",
# Suppress linker warnings about files with no symbols defined.
"-ignore:4221",
],
"//conditions:default": ["-lpthread", "-lm"],
})
...
...
@@ -359,7 +363,25 @@ cc_library(
],
copts = COPTS,
includes = ["src/"],
linkopts = LINK_OPTS,
linkopts = LINK_OPTS + select({
":msvc": [
# Linking to setargv.obj makes the default command line argument
# parser expand wildcards, so the main method's argv will contain the
# expanded list instead of the wildcards.
#
# Adding dummy "-DEFAULTLIB:kernel32.lib", because:
# - Microsoft ships this object file next to default libraries
# - but this file is not a library, just a precompiled object
# - "-WHOLEARCHIVE" and "-DEFAULTLIB" only accept library,
# not precompiled object.
# - Bazel would assume linkopt that does not start with "-" or "$"
# as a label to a target, so we add a harmless "-DEFAULTLIB:kernel32.lib"
# before "setargv.obj".
# See https://msdn.microsoft.com/en-us/library/8bch7bkk.aspx
"-DEFAULTLIB:kernel32.lib setargv.obj",
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
deps = [":protobuf"],
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment