-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqt_bin_build.bzl
147 lines (129 loc) · 5.03 KB
/
qt_bin_build.bzl
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
load("{QT_BIN_REPO}//:components.bzl", "QT_COMPONENTS")
def with_bin_repo_prefix(x):
return "{QT_BIN_REPO}//:" + x
def in_bin_repo(l):
return [with_bin_repo_prefix(x) for x in l]
def linux_interface_lib_filename_for_module(x):
return "lib/{}".format(linux_interface_lib_target_for_module(x))
def linux_shared_lib_filename_for_module(x):
return "lib/{}.5".format(linux_interface_lib_target_for_module(x))
def linux_interface_lib_target_for_module(x):
return "lib{}.so".format(x)
def qt_bin_build():
qt_modules = ["Qt5{}".format(x) for x in QT_COMPONENTS]
win_qt_modules = [
"libEGL",
"libGLESv2",
] + qt_modules
linux_qt_modules = ["Qt5XcbQpa"] + qt_modules
win_static_library_filepaths = (
["lib/{}.lib".format(x) for x in win_qt_modules]
)
win_lib_filepaths = ["bin/{}.dll".format(x) for x in win_qt_modules]
linux_lib_filepaths = (
[linux_shared_lib_filename_for_module(x) for x in linux_qt_modules]
)
for x in linux_qt_modules:
native.cc_import(
name = linux_interface_lib_target_for_module(x),
# We need to refer to the `.so` file, not the `.so.VERSION` file,
# because otherwise Bazel will complain.
interface_library = with_bin_repo_prefix(linux_interface_lib_filename_for_module(x)),
# By setting system_provided = 1, it tells Bazel not to manage this
# library at runtime. This lets us manually position the file in
# the Qt-expected lib/ directory.
system_provided = 1,
)
include_directories = ["include"] + ["include/Qt{}".format(x) for x in QT_COMPONENTS]
resources = [
"resources/icudtl.dat",
"resources/qtwebengine_devtools_resources.pak",
"resources/qtwebengine_resources.pak",
"resources/qtwebengine_resources_100p.pak",
"resources/qtwebengine_resources_200p.pak",
]
win_plugings_platforms_files = [
"plugins/platforms/qwindows.dll",
]
linux_plugins_platforms_files = [
#"plugins/platforms/libqeglfs.so",
"plugins/platforms/libqxcb.so",
#"plugins/platforms/libqlinuxfb.so",
#"plugins/platforms/libqminimalegl.so",
#"plugins/platforms/libqminimal.so",
#"plugins/platforms/libqoffscreen.so",
#"plugins/platforms/libqvnc.so",
#"plugins/platforms/libqwebgl.so",
]
translations = [
"translations/qtwebengine_locales/en-US.pak",
]
# Files which are expected to live as sibling files to the final executable.
native.filegroup(
name = "qt_data_files",
srcs = in_bin_repo(resources + translations),
visibility = ["//visibility:public"],
)
native.filegroup(
name = "qt_plugins_platforms_files",
srcs = select({
"@bazel_tools//src/conditions:windows": in_bin_repo(win_plugings_platforms_files),
"//conditions:default": in_bin_repo(linux_plugins_platforms_files),
}),
visibility = ["//visibility:public"],
)
native.filegroup(
name = "qt_libexec_files",
srcs = select({
"@bazel_tools//src/conditions:windows": in_bin_repo(["bin/QtWebEngineProcess.exe"]),
"//conditions:default": in_bin_repo(["libexec/QtWebEngineProcess"]),
}),
visibility = ["//visibility:public"],
)
native.filegroup(
name = "qt_lib_files",
srcs = select({
"@bazel_tools//src/conditions:windows": in_bin_repo(win_lib_filepaths),
"//conditions:default": in_bin_repo(linux_lib_filepaths),
}),
visibility = ["//visibility:public"],
)
native.cc_library(
name = "qt_lib",
srcs = select({
"@bazel_tools//src/conditions:windows": in_bin_repo(win_static_library_filepaths),
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
deps = [
"@vulkan_sdk//:vulkan",
with_bin_repo_prefix("header_files"),
] + select({
"@bazel_tools//src/conditions:windows": [],
"//conditions:default": [":{}".format(linux_interface_lib_target_for_module(x)) for x in linux_qt_modules],
}),
)
native.alias(
name = "moc",
actual = select({
"@bazel_tools//src/conditions:windows": with_bin_repo_prefix("bin/moc.exe"),
"//conditions:default": with_bin_repo_prefix("bin/moc"),
}),
visibility = ["//visibility:public"],
)
native.alias(
name = "uic",
actual = select({
"@bazel_tools//src/conditions:windows": with_bin_repo_prefix("bin/uic.exe"),
"//conditions:default": with_bin_repo_prefix("bin/uic"),
}),
visibility = ["//visibility:public"],
)
native.alias(
name = "rcc",
actual = select({
"@bazel_tools//src/conditions:windows": with_bin_repo_prefix("bin/rcc.exe"),
"//conditions:default": with_bin_repo_prefix("bin/rcc"),
}),
visibility = ["//visibility:public"],
)