Skip to content

Commit

Permalink
fix: Add SVG support for Qt tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Nov 22, 2024
1 parent ead4cf1 commit 215dcf1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
10 changes: 8 additions & 2 deletions third_party/BUILD.qt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@
]]

alias(
name = "qt_platform",
actual = "@qt6.qtbase//:platforms",
name = "qt_base_plugins",
actual = "@qt6.qtbase//:plugins",
visibility = ["//visibility:public"],
)

alias(
name = "qt_svg_plugins",
actual = "@qt6.qtsvg//:plugins",
visibility = ["//visibility:public"],
)

Expand Down
3 changes: 2 additions & 1 deletion third_party/qt/BUILD.qtbase.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ exports_files([
])

filegroup(
name = "platforms",
name = "plugins",
srcs = glob([
"lib/qt-6/plugins/platforms/*offscreen*",
"lib/qt-6/plugins/tls/*opensslbackend*",
"lib/qt-6/plugins/imageformats/*",
]),
visibility = ["//visibility:public"],
)
Expand Down
8 changes: 8 additions & 0 deletions third_party/qt/BUILD.qtsvg.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

filegroup(
name = "plugins",
srcs = glob([
"lib/qt-6/plugins/imageformats/*",
]),
visibility = ["//visibility:public"],
)

[cc_library(
name = mod.lower(),
hdrs = glob(["include/Qt%s/**" % mod]),
Expand Down
8 changes: 6 additions & 2 deletions third_party/qt/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,16 @@ def qt_test(name, src, deps, copts = [], mocopts = [], size = None, **kwargs):
src[:src.rindex("/")],
)],
env = {
"QT_PLUGIN_PATH": "external/qt6.qtbase/lib/qt-6/plugins",
"QT_PLUGIN_PATH": ":".join([
"external/qt6.qtbase/lib/qt-6/plugins",
"external/qt6.qtsvg/lib/qt-6/plugins",
]),
"QT_QPA_PLATFORM": "offscreen",
},
data = [
"@openssl.out//:lib",
"@qt//:qt_platform",
"@qt//:qt_base_plugins",
"@qt//:qt_svg_plugins",
],
deps = deps + [
":%s_moc" % name,
Expand Down

0 comments on commit 215dcf1

Please sign in to comment.