ADD: added new version of protobuf
This commit is contained in:
@@ -17,16 +17,6 @@ create_compiler_config_setting(
|
||||
value = "msvc-cl",
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "aarch64",
|
||||
values = {"cpu": "linux-aarch_64"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "x86_64",
|
||||
values = {"cpu": "linux-x86_64"},
|
||||
)
|
||||
|
||||
# Android NDK builds can specify different crosstool_top flags to choose which
|
||||
# STL they use for C++. We need these multiple variants to catch all of those
|
||||
# versions of crosstool_top and reliably detect Android.
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
"""Generated unittests to verify that a binary is built for the expected architecture."""
|
||||
|
||||
load("//build_defs:internal_shell.bzl", "inline_sh_test")
|
||||
|
||||
def _arch_test_impl(
|
||||
name,
|
||||
platform,
|
||||
file_platform,
|
||||
bazel_binaries = [],
|
||||
system_binaries = [],
|
||||
**kwargs):
|
||||
"""Bazel rule to verify that a Bazel or system binary is built for the aarch64 architecture.
|
||||
|
||||
Args:
|
||||
name: the name of the test.
|
||||
platform: a diagnostic name for this architecture.
|
||||
file_platform: the expected output of `file`.
|
||||
bazel_binaries: a set of binary targets to inspect.
|
||||
system_binaries: a set of paths to system executables to inspect.
|
||||
**kwargs: other keyword arguments that are passed to the test.
|
||||
"""
|
||||
|
||||
inline_sh_test(
|
||||
name = name,
|
||||
tools = bazel_binaries,
|
||||
cmd = """
|
||||
for binary in "$(rootpaths %s) %s"; do
|
||||
(file -L $$binary | grep -q "%s") \
|
||||
|| (echo "Test binary is not an %s binary: "; file -L $$binary; exit 1)
|
||||
done
|
||||
""" % (
|
||||
" ".join(bazel_binaries),
|
||||
" ".join(system_binaries),
|
||||
file_platform,
|
||||
platform,
|
||||
),
|
||||
target_compatible_with = select({
|
||||
"//build_defs:" + platform: [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
}),
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def aarch64_test(**kwargs):
|
||||
_arch_test_impl(
|
||||
platform = "aarch64",
|
||||
file_platform = "ELF 64-bit LSB executable, ARM aarch64",
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def x86_64_test(**kwargs):
|
||||
_arch_test_impl(
|
||||
platform = "x86_64",
|
||||
file_platform = "ELF 64-bit LSB executable, ARM x86_64",
|
||||
**kwargs
|
||||
)
|
||||
@@ -1,27 +1,27 @@
|
||||
"""C++ compile/link options for Protobuf libraries."""
|
||||
# C++ compile/link options for Protobuf.
|
||||
|
||||
COPTS = select({
|
||||
"//build_defs:config_msvc": [
|
||||
"/wd4065", # switch statement contains 'default' but no 'case' labels
|
||||
"/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'
|
||||
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
"/wd4996", # The compiler encountered a deprecated declaration.
|
||||
"/wd4065", # switch statement contains 'default' but no 'case' labels
|
||||
"/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'
|
||||
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
"/wd4996", # The compiler encountered a deprecated declaration.
|
||||
],
|
||||
"//conditions:default": [
|
||||
"-DHAVE_ZLIB",
|
||||
"-Woverloaded-virtual",
|
||||
"-Wno-sign-compare",
|
||||
"-Werror",
|
||||
],
|
||||
})
|
||||
|
||||
# Android and MSVC builds do not need to link in a separate pthread library.
|
||||
LINK_OPTS = select({
|
||||
"//build_defs:config_android": [],
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
"""
|
||||
Internal tools to migrate shell commands to Bazel as an intermediate step
|
||||
to wider Bazelification.
|
||||
"""
|
||||
|
||||
def inline_sh_binary(
|
||||
name,
|
||||
srcs = [],
|
||||
tools = [],
|
||||
deps = [],
|
||||
cmd = "",
|
||||
testonly = None,
|
||||
**kwargs):
|
||||
"""Bazel rule to wrap up an inline bash script in a binary.
|
||||
|
||||
This is most useful as a stop-gap solution for migrating off Autotools.
|
||||
These binaries are likely to be non-hermetic, with implicit system
|
||||
dependencies.
|
||||
|
||||
NOTE: the rule is only an internal workaround. The interface may change and
|
||||
the rule may be removed when everything is properly "Bazelified".
|
||||
|
||||
Args:
|
||||
name: the name of the inline_sh_binary.
|
||||
srcs: the files used directly by the script.
|
||||
tools: the executable tools used directly by the script. Any target used
|
||||
with rootpath/execpath/location must be declared here or in `srcs`.
|
||||
deps: a list of dependency labels that are required to run this binary.
|
||||
cmd: the inline sh command to run.
|
||||
**kwargs: other keyword arguments that are passed to sh_binary.
|
||||
testonly: common rule attribute (see:
|
||||
https://bazel.build/reference/be/common-definitions#common-attributes)
|
||||
"""
|
||||
|
||||
native.genrule(
|
||||
name = name + "_genrule",
|
||||
srcs = srcs,
|
||||
exec_tools = tools,
|
||||
outs = [name + ".sh"],
|
||||
cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd,
|
||||
testonly = testonly,
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
native.sh_binary(
|
||||
name = name,
|
||||
srcs = [name + "_genrule"],
|
||||
data = srcs + tools + deps,
|
||||
testonly = testonly,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def inline_sh_test(
|
||||
name,
|
||||
srcs = [],
|
||||
tools = [],
|
||||
deps = [],
|
||||
cmd = "",
|
||||
**kwargs):
|
||||
"""Bazel rule to wrap up an inline bash script in a test.
|
||||
|
||||
This is most useful as a stop-gap solution for migrating off Autotools.
|
||||
These tests are likely to be non-hermetic, with implicit system dependencies.
|
||||
|
||||
NOTE: the rule is only an internal workaround. The interface may change and
|
||||
the rule may be removed when everything is properly "Bazelified".
|
||||
|
||||
Args:
|
||||
name: the name of the inline_sh_binary.
|
||||
srcs: the files used directly by the script.
|
||||
tools: the executable tools used directly by the script. Any target used
|
||||
with rootpath/execpath/location must be declared here or in `srcs`.
|
||||
deps: a list of dependency labels that are required to run this binary.
|
||||
cmd: the inline sh command to run.
|
||||
**kwargs: other keyword arguments that are passed to sh_binary.
|
||||
https://bazel.build/reference/be/common-definitions#common-attributes)
|
||||
"""
|
||||
|
||||
native.genrule(
|
||||
name = name + "_genrule",
|
||||
srcs = srcs,
|
||||
exec_tools = tools,
|
||||
outs = [name + ".sh"],
|
||||
cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd,
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
native.sh_test(
|
||||
name = name,
|
||||
srcs = [name + "_genrule"],
|
||||
data = srcs + tools + deps,
|
||||
**kwargs
|
||||
)
|
||||
Reference in New Issue
Block a user