forked from boostorg/thread
-
Notifications
You must be signed in to change notification settings - Fork 1
/
BUILD.bazel
152 lines (137 loc) · 3.74 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
load("@rules_cc//cc:defs.bzl", "cc_library")
package(default_visibility = ["//visibility:public"])
_COMMON_DEPS = [
"@boost.bind",
"@boost.config",
"@boost.core",
"@boost.date_time",
"@boost.move",
"@boost.system",
"@boost.type_traits",
"@boost.chrono",
]
_COMMON_HDRS = [
"include/boost/thread/detail/*.hpp",
"include/boost/thread/*.hpp",
"include/boost/thread/futures/*.hpp",
"include/boost/thread/csbl/*.hpp",
"include/boost/thread/executors/*.hpp",
]
_WINDOWS_HDRS = [
"include/boost/thread/win32/*.hpp",
]
_POSIX_HDRS = [
"include/boost/thread/pthread/*.hpp",
]
_MAC_HDRS = [
"include/boost/thread/pthread/*.hpp",
]
_WINDOWS_SRCS = [
"src/win32/*.cpp",
]
_MAC_SRCS = [
"src/pthread/once.cpp",
"src/pthread/thread.cpp",
]
_POSIX_SRCS = [
"src/pthread/thread.cpp",
"src/pthread/once.cpp",
]
_COMMON_SRCS = [
"src/future.cpp",
]
_COMMON_EXCLUDE_SRCS = ["src/pthread/once_atomic.cpp"]
cc_library(
name = "thread_posix",
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"@platforms//os:macos": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
hdrs = glob(_POSIX_HDRS + _COMMON_HDRS),
srcs = glob(_POSIX_SRCS + _COMMON_SRCS, exclude = _COMMON_EXCLUDE_SRCS),
includes = ["include"],
deps = _COMMON_DEPS,
defines = [
"BOOST_THREAD_DONT_USE_ATOMIC",
],
)
cc_library(
name = "thread_windows",
target_compatible_with = select({
"@platforms//os:windows": [],
"@platforms//os:macos": ["@platforms//:incompatible"],
"//conditions:default": ["@platforms//:incompatible"],
}),
hdrs = glob(_WINDOWS_HDRS + _COMMON_HDRS),
srcs = glob(_WINDOWS_SRCS + _COMMON_SRCS, exclude = _COMMON_EXCLUDE_SRCS),
includes = ["include"],
linkopts = ["-DEFAULTLIB:shell32"],
local_defines = [
"BOOST_THREAD_BUILD_LIB",
],
defines = [
"BOOST_THREAD_WIN32",
"BOOST_THREAD_DONT_USE_ATOMIC",
],
deps = _COMMON_DEPS + [
"@boost.atomic",
],
)
cc_library(
name = "thread_mac",
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"@platforms//os:macos": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
hdrs = glob(_MAC_HDRS + _COMMON_HDRS),
srcs = glob(_MAC_SRCS + _COMMON_SRCS, exclude = _COMMON_EXCLUDE_SRCS),
includes = ["include"],
defines = [
"BOOST_THREAD_DONT_USE_ATOMIC",
],
deps = _COMMON_DEPS,
)
cc_library(
name = "boost.thread",
hdrs = glob([
"include/**/*.hpp",
"include/**/*.h",
], exclude = _POSIX_HDRS + _WINDOWS_HDRS + _MAC_HDRS + _COMMON_HDRS),
includes = ["include"],
srcs = glob(["src/**/*.cpp"], exclude = _POSIX_SRCS + _WINDOWS_SRCS + _MAC_SRCS + _COMMON_SRCS + _COMMON_EXCLUDE_SRCS),
deps = [
"@boost.algorithm",
"@boost.assert",
"@boost.atomic",
"@boost.concept_check",
"@boost.container",
"@boost.container_hash",
"@boost.exception",
"@boost.function",
"@boost.intrusive",
"@boost.io",
"@boost.iterator",
"@boost.lexical_cast",
"@boost.optional",
"@boost.predef",
"@boost.preprocessor",
"@boost.smart_ptr",
"@boost.static_assert",
"@boost.throw_exception",
"@boost.tuple",
"@boost.utility",
] + select({
"@platforms//os:windows": [
":thread_windows",
"@boost.winapi",
],
"@platforms//os:macos": [
":thread_mac",
],
"//conditions:default": [
":thread_posix",
],
}) + _COMMON_DEPS,
)