forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
envoy_pch.bzl
55 lines (51 loc) · 1.43 KB
/
envoy_pch.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# DO NOT LOAD THIS FILE. Load envoy_build_system.bzl instead.
# Envoy library targets
load(
":envoy_internal.bzl",
"envoy_copts",
"envoy_external_dep_path",
"envoy_linkstatic",
)
load(":pch.bzl", "pch")
def envoy_pch_deps(repository, target):
return select({
repository + "//bazel:clang_pch_build": [repository + target],
"//conditions:default": [],
})
def envoy_pch_copts(repository, target):
return select({
repository + "//bazel:clang_pch_build": [
"-include-pch",
"$(location {}{})".format(repository, target),
],
"//conditions:default": [],
})
def envoy_pch_library(
name,
includes,
deps,
external_deps,
visibility,
testonly = False,
repository = ""):
native.cc_library(
name = name + "_libs",
visibility = ["//visibility:private"],
copts = envoy_copts(repository),
deps = deps + [envoy_external_dep_path(dep) for dep in external_deps],
alwayslink = 1,
testonly = testonly,
linkstatic = envoy_linkstatic(),
)
pch(
name = name,
deps = [name + "_libs"],
includes = includes,
visibility = visibility,
testonly = testonly,
tags = ["no-remote"],
enabled = select({
repository + "//bazel:clang_pch_build": True,
"//conditions:default": False,
}),
)