@@ -2,12 +2,63 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
2
2
3
3
package (default_visibility = ["//visibility:public" ])
4
4
5
+ _WINDOWS_HDRS = [
6
+ "**/win/*.hpp"
7
+ ]
8
+
9
+ _POSIX_HDRS = [
10
+ "**/posix/*.hpp"
11
+ ]
12
+
13
+ _MAC_HDRS = [
14
+ "**/mac/*.hpp"
15
+ ]
16
+
17
+
18
+ cc_library (
19
+ name = "chrono_posix" ,
20
+ target_compatible_with = select ({
21
+ "@platforms//os:windows" : ["@platforms//:incompatible" ],
22
+ "@platforms//os:macos" : ["@platforms//:incompatible" ],
23
+ "//conditions:default" : [],
24
+ }),
25
+ hdrs = glob (_POSIX_HDRS ),
26
+ includes = ["include" ],
27
+ defines = ["BOOST_THREAD_DONT_USE_ATOMIC" ],
28
+ )
29
+
30
+ cc_library (
31
+ name = "chrono_windows" ,
32
+ target_compatible_with = select ({
33
+ "@platforms//os:windows" : [],
34
+ "@platforms//os:macos" : ["@platforms//:incompatible" ],
35
+ "//conditions:default" : ["@platforms//:incompatible" ],
36
+ }),
37
+ hdrs = glob (_WINDOWS_HDRS ),
38
+ includes = ["include" ],
39
+ linkopts = ["-DEFAULTLIB:shell32" ],
40
+ )
41
+
42
+ cc_library (
43
+ name = "chrono_mac" ,
44
+ target_compatible_with = select ({
45
+ "@platforms//os:windows" : ["@platforms//:incompatible" ],
46
+ "@platforms//os:macos" : [],
47
+ "//conditions:default" : ["@platforms//:incompatible" ],
48
+ }),
49
+ hdrs = glob (_MAC_HDRS ),
50
+ includes = ["include" ],
51
+ linkopts = ["-DEFAULTLIB:shell32" ],
52
+ )
53
+
5
54
cc_library (
6
55
name = "boost.chrono" ,
7
56
hdrs = glob ([
8
57
"include/**/*.hpp" ,
9
58
"include/**/*.h" ,
10
- ]),
59
+ ], exclude = _POSIX_HDRS + _WINDOWS_HDRS + _MAC_HDRS ),
60
+ srcs = glob (["src/**/*.cpp" ]),
61
+ defines = ["BOOST_ALL_NO_LIB" ],
11
62
includes = ["include" ],
12
63
deps = [
13
64
"@boost.assert" ,
@@ -24,6 +75,16 @@ cc_library(
24
75
"@boost.type_traits" ,
25
76
"@boost.typeof" ,
26
77
"@boost.utility" ,
27
- "@boost.winapi" ,
28
- ],
78
+ ] + select ({
79
+ "@platforms//os:windows" : [
80
+ ":chrono_windows" ,
81
+ "@boost.winapi" ,
82
+ ],
83
+ "@platforms//os:macos" : [
84
+ ":chrono_mac" ,
85
+ ],
86
+ "//conditions:default" : [
87
+ ":chrono_posix" ,
88
+ ],
89
+ })
29
90
)
0 commit comments