David L. Jones | 52655b1 | 2022-05-06 12:11:46 -0700 | [diff] [blame] | 1 | # C++ compile/link options for Protobuf. |
| 2 | |
| 3 | COPTS = select({ |
| 4 | "//build_defs:config_msvc": [ |
| 5 | "/wd4065", # switch statement contains 'default' but no 'case' labels |
| 6 | "/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data |
| 7 | "/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' |
| 8 | "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data |
| 9 | "/wd4305", # 'identifier' : truncation from 'type1' to 'type2' |
| 10 | "/wd4307", # 'operator' : integral constant overflow |
| 11 | "/wd4309", # 'conversion' : truncation of constant value |
| 12 | "/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) |
| 13 | "/wd4355", # 'this' : used in base member initializer list |
| 14 | "/wd4506", # no definition for inline function 'function' |
| 15 | "/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning) |
| 16 | "/wd4996", # The compiler encountered a deprecated declaration. |
| 17 | ], |
| 18 | "//conditions:default": [ |
| 19 | "-DHAVE_ZLIB", |
| 20 | "-Woverloaded-virtual", |
| 21 | "-Wno-sign-compare", |
| 22 | ], |
| 23 | }) |
| 24 | |
| 25 | # Android and MSVC builds do not need to link in a separate pthread library. |
| 26 | LINK_OPTS = select({ |
| 27 | "//build_defs:config_android": [], |
| 28 | "//build_defs:config_android-stlport": [], |
| 29 | "//build_defs:config_android-libcpp": [], |
| 30 | "//build_defs:config_android-gnu-libstdcpp": [], |
| 31 | "//build_defs:config_android-default": [], |
| 32 | "//build_defs:config_msvc": [ |
| 33 | # Suppress linker warnings about files with no symbols defined. |
| 34 | "-ignore:4221", |
| 35 | ], |
| 36 | "//conditions:default": [ |
| 37 | "-lpthread", |
| 38 | "-lm", |
| 39 | ], |
| 40 | }) |
Joshua Haberman | 2dc7679 | 2022-05-23 20:59:31 +0000 | [diff] [blame] | 41 | |
| 42 | # When cross-compiling for Windows we need to statically link pthread and the C++ library. |
| 43 | PROTOC_LINK_OPTS = select({ |
| 44 | "//build_defs:config_win32": ["-static"], |
| 45 | "//build_defs:config_win64": ["-static"], |
| 46 | "//conditions:default": [], |
| 47 | }) |