-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBUILD.bazel
More file actions
166 lines (134 loc) · 4.41 KB
/
BUILD.bazel
File metadata and controls
166 lines (134 loc) · 4.41 KB
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("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
# TODO
# configuration: source of packages either download github, local checkout (can modify source), or rpms (present in standard paths)
# smart setting of CCACHE_BASEDIR is needed
# lib64
#build ints
# python2 -m pip install --user setuptools
# sudo swupd bundle-add devpkg-nspr
# switch to ninja
# https://docs.bazel.build/versions/master/configurable-attributes.html
# https://github.com/bazelbuild/bazel/issues/8171
# https://github.com/bazelbuild/bazel/issues/3902
# (the select only evaluates inside rules)
load("@bazel_skylib//lib:dicts.bzl", "dicts")
cmake_compiler_launcher = {
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
}
proton_cache_entries = {
"CMAKE_CXX_COMPILER": "g++",
#"BUILD_BINDINGS": "OFF",
"BUILD_BINDINGS": "cpp",
"BUILD_TESTING": "OFF",
# these are optional by default, CMake would skip them if not found
"SASL_IMPL": "cyrus",
"SSL_IMPL": "openssl",
"PROACTOR": "epoll",
# normalize expectations (cmake rule expects ubuntu)
#"LIB_INSTALL_DIR": "lib",
#"LIB_SUFFIX": "",
}
cmake(
name = "qpid-proton",
generate_crosstool_file = False,
cache_entries = select({
":ccache_enabled": dicts.add(proton_cache_entries, cmake_compiler_launcher),
"//conditions:default": proton_cache_entries,
}),
lib_source = "@qpid-proton//:all",
out_lib_dir = "lib64",
build_args = ["-j8"],
out_shared_libs = ["libqpid-proton-core.so", "libqpid-proton.so"],
#out_shared_libs = ["libqpid-proton-core.so", "libqpid-proton.so", "libqpid-proton-cpp.so"],
)
qpid_cache_entries = {
"CMAKE_CXX_COMPILER": "g++",
"BUILD_AMQP": "ON",
"BUILD_SASL": "ON",
"BUILD_SSL": "ON",
# disable as much as we can
"BUILD_BINDING_PERL": "OFF",
"BUILD_BINDING_PYTHON": "OFF",
"BUILD_BINDING_DOTNET": "OFF",
"BUILD_BINDING_RUBY": "OFF",
"BUILD_TESTING": "OFF",
"BUILD_XML": "OFF",
"BUILD_DOCS": "OFF",
"BUILD_PROBES": "OFF",
"BUILD_LEGACYSTORE": "OFF",
"BUILD_LINEARSTORE": "OFF",
"BUILD_HA": "OFF",
"BUILD_RDMA": "OFF",
"BUILD_MSSQL": "OFF",
"BUILD_MSCLFS": "OFF",
"INSTALL_QMFGEN": "OFF",
"EXT_BUILD_DEPS": "$EXT_BUILD_DEPS",
"Proton_DIR": "$EXT_BUILD_DEPS/qpid-proton/lib64/cmake/Proton",
}
cmake(
name = "qpid-cpp",
generate_crosstool_file = False,
cache_entries = select({
":ccache_enabled": dicts.add(qpid_cache_entries, cmake_compiler_launcher),
"//conditions:default": qpid_cache_entries,
}),
lib_source = "@qpid-cpp//:all",
build_args = ["-j8"],
# https://github.com/bazelbuild/rules_foreign_cc/issues/418#issuecomment-790423504
# this does not seem to be a problem for me, but it's weird
#includes = ["."],
out_lib_dir = "lib64",
out_shared_libs = ["libqpidclient.so", "libqpidcommon.so", "libqpidtypes.so", "libqpidmessaging.so"],
deps = [":qpid-proton"],
)
filegroup(name = "sources", srcs = glob(["CMakeLists.txt", "src/**", "dist/**", "*.cmake"]), visibility = ["//visibility:public"])
cmake(
name = "cli-cpp",
generate_crosstool_file = False,
cache_entries = {
"CMAKE_CXX_COMPILER": "g++",
# https://github.com/bazelbuild/rules_foreign_cc/pull/970#issuecomment-1282134709
"EXT_BUILD_DEPS": "$EXT_BUILD_DEPS",
"EXT_BUILD_ROOT": "$EXT_BUILD_ROOT",
"Qpid_DIR": "$EXT_BUILD_DEPS/qpid-cpp/lib64/cmake/Qpid",
"Proton_DIR": "$EXT_BUILD_DEPS/qpid-proton/lib64/cmake/Proton",
"ProtonCpp_DIR": "$EXT_BUILD_DEPS/qpid-proton/lib64/cmake/ProtonCpp",
"CMAKE_VERBOSE_MAKEFILE": "ON",
"CMAKE_BUILD_WITH_INSTALL_RPATH": "TRUE",
"CMAKE_INSTALL_RPATH_USE_LINK_PATH": "TRUE",
},
lib_source = "sources",
build_args = ["-j8"],
out_binaries = ["aac3_receiver"],
deps = select({
":deps_upstream": [":qpid-cpp", ":qpid-proton"],
":deps_rpms": [],
}),
)
# This file uses the above definitions to define two custom build settings.
load("//:build_settings.bzl", "bool_flag", "string_flag")
string_flag(
name = "deps",
build_setting_default = "upstream",
)
config_setting(
name = "deps_upstream",
flag_values = {
"//:deps": "upstream"
}
)
config_setting(
name = "deps_rpms",
flag_values = {
"//:deps": "rpms"
}
)
bool_flag(
name = "enable_ccache",
build_setting_default = False,
)
config_setting(
name = "ccache_enabled",
flag_values = {"//:enable_ccache": "True"},
)