forked from mongodb/mongo-cxx-driver
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBUCK
166 lines (155 loc) · 3.95 KB
/
BUCK
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
load('//:subdir_glob.bzl', 'subdir_glob')
load('//:buckaroo_macros.bzl', 'buckaroo_cell')
mongo_c_driver = \
buckaroo_cell('github.com/buckaroo-pm/mongo-c-driver')
genrule(
name = 'configure',
out = 'out',
srcs = glob([
'*.txt',
'etc/*',
'cmake/**/*.cmake',
'cmake/**/*.txt',
'src/**/*.txt',
'src/**/*.in',
]),
cmd = ' && '.join([
'mkdir $OUT',
'cd $OUT',
'cmake $SRCDIR',
]),
cacheable = False,
)
genrule(
name = 'bsoncxx-config',
out = 'config.hpp',
srcs = [
'src/bsoncxx/config/config.hpp.in',
],
cmd = ' && '.join([
'cp $SRCS $OUT',
'sed -i "s/#cmakedefine BSONCXX_POLY_USE_STD_EXPERIMENTAL/#undef BSONCXX_POLY_USE_STD_EXPERIMENTAL/g" $OUT',
'sed -i "s/#cmakedefine BSONCXX_POLY_USE_MNMLSTC/#undef BSONCXX_POLY_USE_MNMLSTC/g" $OUT',
'sed -i "s/#cmakedefine BSONCXX_POLY_USE_SYSTEM_MNMLSTC/#undef BSONCXX_POLY_USE_SYSTEM_MNMLSTC/g" $OUT',
'sed -i "s/#cmakedefine BSONCXX_POLY_USE_BOOST/#undef BSONCXX_POLY_USE_BOOST/g" $OUT',
'sed -i "s/#cmakedefine BSONCXX_POLY_USE_STD/#define BSONCXX_POLY_USE_STD 1/g" $OUT',
'sed -i "s/@BSONCXX_INLINE_NAMESPACE@/v_noabi/g" $OUT',
]),
)
genrule(
name = 'bsoncxx-version',
out = 'version.hpp',
srcs = [
'src/bsoncxx/config/version.hpp.in',
],
cmd = ' && '.join([
'cp $SRCS $OUT',
'sed -i "s/@BSONCXX_VERSION_MAJOR@/0/g" $OUT',
'sed -i "s/@BSONCXX_VERSION_MINOR@/0/g" $OUT',
'sed -i "s/@BSONCXX_VERSION_PATCH@/0/g" $OUT',
'sed -i "s/@BSONCXX_VERSION_EXTRA@/0/g" $OUT',
]),
)
genrule(
name = 'bsoncxx-export',
out = 'export.hpp',
cmd = 'touch $OUT',
)
genrule(
name = 'bsoncxx-private-config',
out = 'config.hh',
srcs = [
'src/bsoncxx/config/private/config.hh.in',
],
cmd = 'cp $SRCS $OUT',
)
cxx_library(
name = 'bsoncxx',
header_namespace = '',
exported_headers = dict(
subdir_glob([
('src', 'bsoncxx/**/*.hpp'),
('src', 'bsoncxx/**/*.hh'),
]).items() + [
('bsoncxx/config/version.hpp', ':bsoncxx-version'),
('bsoncxx/config/config.hpp', ':bsoncxx-config'),
('bsoncxx/config/private/config.hh', ':bsoncxx-private-config'),
('bsoncxx/config/export.hpp', 'src/bsoncxx/config/export.linux.hpp'),
]
),
srcs = glob([
'src/bsoncxx/**/*.cpp',
], exclude = glob([
'src/bsoncxx/test/**/*.cpp',
])),
deps = [
mongo_c_driver + '//:bson',
],
visibility = [
'PUBLIC',
],
)
genrule(
name = 'mongocxx-config',
out = 'config.hpp',
srcs = [
'src/mongocxx/config/config.hpp.in',
],
cmd = ' && '.join([
'cp $SRCS $OUT',
'sed -i "s/@MONGOCXX_INLINE_NAMESPACE@/v_noabi/g" $OUT',
]),
)
genrule(
name = 'mongocxx-version',
out = 'version.hpp',
srcs = [
'src/mongocxx/config/version.hpp.in',
],
cmd = ' && '.join([
'cp $SRCS $OUT',
'sed -i "s/@MONGOCXX_VERSION_MAJOR@/0/g" $OUT',
'sed -i "s/@MONGOCXX_VERSION_MINOR@/0/g" $OUT',
'sed -i "s/@MONGOCXX_VERSION_PATCH@/0/g" $OUT',
'sed -i "s/@MONGOCXX_VERSION_EXTRA@/0/g" $OUT',
]),
)
genrule(
name = 'mongocxx-private-config',
out = 'config.hh',
srcs = [
'src/mongocxx/config/private/config.hh.in',
],
cmd = ' && '.join([
'cp $SRCS $OUT',
'sed -i "s/#cmakedefine MONGOCXX_ENABLE_SSL/#undef MONGOCXX_ENABLE_SSL/g" $OUT',
]),
)
cxx_library(
name = 'mongocxx',
header_namespace = '',
exported_headers = dict(
subdir_glob([
('src', 'mongocxx/**/*.hpp'),
('src', 'mongocxx/**/*.hh'),
]).items() + [
('mongocxx/config/config.hpp', ':mongocxx-config'),
('mongocxx/config/private/config.hh', ':mongocxx-private-config'),
('mongocxx/config/version.hpp', ':mongocxx-version'),
('mongocxx/config/export.hpp', 'src/mongocxx/config/export.linux.hpp'),
]
),
srcs = glob([
'src/mongocxx/**/*.cpp',
], exclude = glob([
'src/mongocxx/test/**/*.cpp',
'src/mongocxx/test_util/**/*.cpp',
])),
deps = [
':bsoncxx',
mongo_c_driver + '//:mongoc',
],
visibility = [
'PUBLIC',
],
)