forked from boostorg/asio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
BUILD.bazel
85 lines (81 loc) · 2.28 KB
/
BUILD.bazel
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
string_flag(
name = "ssl",
visibility = ["//visibility:public"],
values = ["no_ssl", "openssl", "boringssl"],
build_setting_default = "no_ssl",
)
config_setting(name = "no_ssl", flag_values = {":ssl": "no_ssl"})
config_setting(name = "openssl", flag_values = {":ssl": "openssl"})
config_setting(name = "boringssl", flag_values = {":ssl": "boringssl"})
write_file(
name = "src",
out = "boost.asio.src.cpp",
content = select({
":no_ssl": [
"#include <boost/asio/impl/src.hpp>",
],
"//conditions:default": [
"#include <boost/asio/impl/src.hpp>",
"#include <boost/asio/ssl/impl/src.hpp>",
],
}),
)
cc_library(
name = "boost.asio",
visibility = ["//visibility:public"],
defines = ["BOOST_ASIO_SEPARATE_COMPILATION"],
linkopts = select({
"@platforms//os:windows": [
"-DEFAULTLIB:ws2_32",
"-DEFAULTLIB:mswsock",
],
"//conditions:default": [
"-lpthread",
],
}),
hdrs = glob([
"include/**/*.hpp",
"include/**/*.h",
"include/**/*.ipp",
], exclude = [
"include/boost/asio/impl/src.hpp",
"include/boost/asio/ssl/impl/src.hpp",
]),
srcs = [":src"] + select({
":no_ssl": [
"include/boost/asio/impl/src.hpp",
],
"//conditions:default": [
"include/boost/asio/impl/src.hpp",
"include/boost/asio/ssl/impl/src.hpp",
],
}),
includes = ["include"],
deps = [
"@boost.align",
"@boost.array",
"@boost.assert",
"@boost.bind",
"@boost.chrono",
"@boost.config",
"@boost.context",
"@boost.core",
"@boost.coroutine",
"@boost.date_time",
"@boost.exception",
"@boost.function",
"@boost.regex",
"@boost.smart_ptr",
"@boost.system",
"@boost.throw_exception",
"@boost.type_traits",
"@boost.utility",
] + select({
":openssl": ["@openssl//:ssl"],
":boringssl": ["@boringssl//:ssl"],
":no_ssl": [],
}),
)