-
Notifications
You must be signed in to change notification settings - Fork 24
/
qt.BUILD
130 lines (121 loc) · 4.05 KB
/
qt.BUILD
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
load("@rules_cc//cc:defs.bzl", "cc_import", "cc_library")
QT_LIBRARIES = [
("core", "QtCore", "Qt5Core", []),
("network", "QtNetwork", "Qt5Network", []),
("widgets", "QtWidgets", "Qt5Widgets", [":qt_core", ":qt_gui"]),
("quick", "QtQuick", "Qt5Quick", [":qt_gui", ":qt_qml"]),
("qml", "QtQml", "Qt5Qml", [":qt_core", ":qt_network"]),
("qml_models", "QtQmlModels", "Qt5QmlModels", []),
("gui", "QtGui", "Qt5Gui", [":qt_core"]),
("opengl", "QtOpenGL", "Qt5OpenGL", []),
]
[
cc_library(
name = "qt_%s_linux" % name,
# When being on Windows this glob will be empty
hdrs = glob(["%s/**" % include_folder], allow_empty = True),
includes = ["."],
linkopts = ["-l%s" % library_name],
# Available from Bazel 4.0.0
# target_compatible_with = ["@platforms//os:linux"],
)
for name, include_folder, library_name, _ in QT_LIBRARIES
]
[
cc_import(
name = "qt_%s_windows_import" % name,
# When being on Linux or macOS this glob will be empty
hdrs = glob(["include/%s/**" % include_folder], allow_empty = True),
interface_library = "lib/%s.lib" % library_name,
shared_library = "bin/%s.dll" % library_name,
# Not available in cc_import (See: https://github.com/bazelbuild/bazel/issues/12745)
# target_compatible_with = ["@platforms//os:windows"],
)
for name, include_folder, library_name, _ in QT_LIBRARIES
]
[
cc_library(
name = "qt_%s_windows" % name,
# When being on Linux or macOS this glob will be empty
hdrs = glob(["include/%s/**" % include_folder], allow_empty = True),
includes = ["include"],
# Available from Bazel 4.0.0
# target_compatible_with = ["@platforms//os:windows"],
deps = [":qt_%s_windows_import" % name],
)
for name, include_folder, _, _ in QT_LIBRARIES
]
[
cc_library(
name = "qt_%s_osx" % name,
# When being on Windows or Linux this glob will be empty
hdrs = glob(["%s/**" % include_folder], allow_empty = True),
includes = ["."],
linkopts = ["-F/usr/local/opt/qt5/lib"] + [
"-framework %s" % library_name.replace("5", "") # macOS qt libs do not contain a 5 - e.g. instead of Qt5Core the lib is called QtCore
],
# Available from Bazel 4.0.0
# target_compatible_with = ["@platforms//os:osx"],
)
for name, include_folder, library_name, _ in QT_LIBRARIES
]
[
cc_library(
name = "qt_%s" % name,
visibility = ["//visibility:public"],
deps = dependencies + select({
"@platforms//os:linux": [":qt_%s_linux" % name],
"@platforms//os:windows": [":qt_%s_windows" % name],
"@platforms//os:osx": [":qt_%s_osx" % name],
}),
)
for name, _, _, dependencies in QT_LIBRARIES
]
# TODO: Make available also for Windows
cc_library(
name = "qt_3d",
# When being on Windows this glob will be empty
hdrs = glob([
"Qt3DAnimation/**",
"Qt3DCore/**",
"Qt3DExtras/**",
"Qt3DInput/**",
"Qt3DLogic/**",
"Qt3DQuick/**",
"Qt3DQuickAnimation/**",
"Qt3DQuickExtras/**",
"Qt3DQuickInput/**",
"Qt3DQuickRender/**",
"Qt3DQuickScene2D/**",
"Qt3DRender/**",
], allow_empty = True),
includes = ["."],
linkopts = [
"-lQt53DAnimation",
"-lQt53DCore",
"-lQt53DExtras",
"-lQt53DInput",
"-lQt53DLogic",
"-lQt53DQuick",
"-lQt53DQuickAnimation",
"-lQt53DQuickExtras",
"-lQt53DQuickInput",
"-lQt53DQuickRender",
"-lQt53DQuickScene2D",
"-lQt53DRender",
],
# Available from Bazel 4.0.0
# target_compatible_with = ["@platforms//os:linux"],
)
# TODO: remove in favor of toolchain-defined binary
filegroup(
name = "uic",
srcs = ["bin/uic.exe"],
visibility = ["//visibility:public"],
)
# TODO: remove in favor of toolchain-defined binary
filegroup(
name = "moc",
srcs = ["bin/moc.exe"],
visibility = ["//visibility:public"],
)