Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel: similar build flags to cmake for corresponding build types (#4… #720

Merged
merged 10 commits into from
Apr 17, 2017
20 changes: 20 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
package(default_visibility = ["//visibility:public"])

exports_files(["gen_sh_test_runner.sh"])

config_setting(
name = "opt_build",
values = {"compilation_mode": "opt"},
)

config_setting(
name = "fastbuild_build",
values = {"compilation_mode": "fastbuild"},
)

config_setting(
name = "dbg_build",
values = {"compilation_mode": "dbg"},
)

config_setting(
name = "debug_symbols",
values = {"define": "debug_symbols=yes"},
)
24 changes: 14 additions & 10 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ load("@protobuf_bzl//:protobuf.bzl", "cc_proto_library")
ENVOY_COPTS = [
# TODO(htuch): Remove this when Bazel bringup is done.
"-DBAZEL_BRINGUP",
"-fno-omit-frame-pointer",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this default in bazel?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

# TODO(htuch): Clang wants -ferror-limit, should support both. Commented out for now.
# "-fmax-errors=3",
"-Wall",
# TODO(htuch): Figure out why protobuf-3.2.0 causes the CI build to fail
# with this but not the developer-local build.
#"-Wextra",
"-Wextra",
"-Werror",
"-Wnon-virtual-dtor",
"-Woverloaded-virtual",
# TODO(htuch): Figure out how to use this in the presence of headers in
# openssl/tclap which use old style casts.
# "-Wold-style-cast",
"-Wold-style-cast",
"-std=c++0x",
"-includeprecompiled/precompiled.h",
]
] + select({
# Bazel adds an implicit -DNDEBUG for opt.
"//bazel:opt_build": [],
"//bazel:fastbuild_build": [],
"//bazel:dbg_build": ["-ggdb3"],
}) + select({
# Allow debug symbols to be added to opt/fastbuild as well.
"//bazel:debug_symbols": ["-ggdb3"],
"//conditions:default": [],
})

# References to Envoy external dependencies should be wrapped with this function.
def envoy_external_dep_path(dep):
Expand Down Expand Up @@ -70,6 +72,8 @@ def envoy_cc_binary(name,
linkopts = [
"-pthread",
"-lrt",
"-static-libstdc++",
"-static-libgcc",
],
linkstatic = 1,
visibility = visibility,
Expand Down
22 changes: 11 additions & 11 deletions ci/prebuilt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ cc_library(
name = "ares",
srcs = ["thirdparty_build/lib/libcares.a"],
hdrs = glob(["thirdparty_build/include/ares*.h"]),
strip_include_prefix = "thirdparty_build/include",
includes = ["thirdparty_build/include"],
)

cc_library(
name = "crypto",
srcs = ["thirdparty_build/lib/libcrypto.a"],
hdrs = glob(["thirdparty_build/include/openssl/**/*.h"]),
strip_include_prefix = "thirdparty_build/include",
includes = ["thirdparty_build/include"],
)

cc_library(
name = "event",
srcs = ["thirdparty_build/lib/libevent.a"],
hdrs = glob(["thirdparty_build/include/event2/**/*.h"]),
strip_include_prefix = "thirdparty_build/include",
includes = ["thirdparty_build/include"],
)

cc_library(
Expand All @@ -37,14 +37,14 @@ cc_library(
"thirdparty_build/include/gmock/**/*.h",
"thirdparty_build/include/gtest/**/*.h",
]),
strip_include_prefix = "thirdparty_build/include",
includes = ["thirdparty_build/include"],
)

cc_library(
name = "http_parser",
srcs = ["thirdparty_build/lib/libhttp_parser.a"],
hdrs = glob(["thirdparty_build/include/http_parser.h"]),
strip_include_prefix = "thirdparty_build/include",
includes = ["thirdparty_build/include"],
)

cc_library(
Expand All @@ -57,22 +57,22 @@ cc_library(
"thirdparty_build/include/collector.pb.h",
"thirdparty_build/include/lightstep_carrier.pb.h",
],
strip_include_prefix = "thirdparty_build/include",
includes = ["thirdparty_build/include"],
deps = [":protobuf"],
)

cc_library(
name = "nghttp2",
srcs = ["thirdparty_build/lib/libnghttp2.a"],
hdrs = glob(["thirdparty_build/include/nghttp2/**/*.h"]),
strip_include_prefix = "thirdparty_build/include",
includes = ["thirdparty_build/include"],
)

cc_library(
name = "protobuf",
srcs = glob(["thirdparty_build/lib/libproto*.a"]),
hdrs = glob(["thirdparty_build/include/google/protobuf/**/*.h"]),
strip_include_prefix = "thirdparty_build/include",
includes = ["thirdparty_build/include"],
)

filegroup(
Expand All @@ -83,7 +83,7 @@ filegroup(
cc_library(
name = "rapidjson",
hdrs = glob(["thirdparty/rapidjson-1.1.0/include/**/*.h"]),
strip_include_prefix = "thirdparty/rapidjson-1.1.0/include",
includes = ["thirdparty/rapidjson-1.1.0/include"],
)

cc_library(
Expand All @@ -92,7 +92,7 @@ cc_library(
"thirdparty/spdlog-0.11.0/include/**/*.cc",
"thirdparty/spdlog-0.11.0/include/**/*.h",
]),
strip_include_prefix = "thirdparty/spdlog-0.11.0/include",
includes = ["thirdparty/spdlog-0.11.0/include"],
)

cc_library(
Expand All @@ -104,5 +104,5 @@ cc_library(
cc_library(
name = "tclap",
hdrs = glob(["thirdparty/tclap-1.2.1/include/**/*.h"]),
strip_include_prefix = "thirdparty/tclap-1.2.1/include",
includes = ["thirdparty/tclap-1.2.1/include"],
)