• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""C++ compile/link options for Protobuf libraries."""
2
3COPTS = select({
4    "//build_defs:config_msvc": [
5        "/wd4065",  # switch statement contains 'default' but no 'case' labels
6        "/wd4146",  # unary minus operator applied to unsigned type
7        "/wd4244",  # 'conversion' conversion from 'type1' to 'type2', possible loss of data
8        "/wd4251",  # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
9        "/wd4267",  # 'var' : conversion from 'size_t' to 'type', possible loss of data
10        "/wd4305",  # 'identifier' : truncation from 'type1' to 'type2'
11        "/wd4307",  # 'operator' : integral constant overflow
12        "/wd4309",  # 'conversion' : truncation of constant value
13        "/wd4334",  # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
14        "/wd4355",  # 'this' : used in base member initializer list
15        "/wd4506",  # no definition for inline function 'function'
16        "/wd4800",  # 'type' : forcing value to bool 'true' or 'false' (performance warning)
17        "/wd4996",  # The compiler encountered a deprecated declaration.
18    ],
19    "//conditions:default": [
20        "-DHAVE_ZLIB",
21        "-Woverloaded-virtual",
22        "-Wno-sign-compare",
23        "-Wno-nonnull",
24    ],
25})
26
27# Android and MSVC builds do not need to link in a separate pthread library.
28LINK_OPTS = select({
29    "//build_defs:config_android": [],
30    "//build_defs:config_android-legacy-default-crosstool": [],
31    "//build_defs:config_android-stlport": [],
32    "//build_defs:config_android-libcpp": [],
33    "//build_defs:config_android-gnu-libstdcpp": [],
34    "//build_defs:config_android-default": [],
35    "//build_defs:config_msvc": [
36        # Suppress linker warnings about files with no symbols defined.
37        "-ignore:4221",
38        "Shell32.lib",
39    ],
40    "@platforms//os:macos": [
41        "-lpthread",
42        "-lm",
43        "-framework CoreFoundation",
44    ],
45    "//conditions:default": [
46        "-lpthread",
47        "-lm",
48    ],
49})
50