Add Qt for Windows support to Bazel build.

As a preparation to support Bazel for Windows build (#948), this makes
"qt_win" repository available for Bazel build on Windows.

There must be no observable behavior change in mac/Linux Bazel builds.

PiperOrigin-RevId: 645598529
This commit is contained in:
Yohei Yukawa
2024-06-22 05:26:48 +00:00
committed by Hiroyuki Komatsu
parent b64ba10fd2
commit 019911b19d
3 changed files with 57 additions and 0 deletions

View File

@ -189,6 +189,12 @@ qt_mac_repository(
default_path = MACOS_QT_PATH, # can be replaced with MOZC_QT_PATH envvar.
)
# Qt for Windows
new_local_repository(
name = "qt_win",
build_file = "@//bazel:BUILD.qt_win.bazel",
path = "third_party/qt",
)
# Google Toolbox for Mac
# https://github.com/google/google-toolbox-for-mac

View File

@ -0,0 +1,43 @@
package(
default_visibility = ["//visibility:public"],
)
config_setting(
name = "debug_build",
values = {
"compilation_mode": "dbg",
},
visibility = ["//visibility:private"],
)
cc_library(
name = "qt_win",
srcs = select({
":debug_build": [
"lib/Qt6Cored.lib",
"lib/Qt6Guid.lib",
"lib/Qt6Widgetsd.lib",
],
"//conditions:default": [
"lib/Qt6Core.lib",
"lib/Qt6Gui.lib",
"lib/Qt6Widgets.lib",
],
}),
hdrs = glob([
"include"
]),
includes = [
"include",
"include/QtCore",
"include/QtGui",
"include/QtWidgets",
],
target_compatible_with = ["@platforms//os:windows"],
)
exports_files([
"bin/moc.exe",
"bin/uic.exe",
"bin/rcc.exe",
])

View File

@ -50,6 +50,7 @@ def mozc_cc_qt_library(name, deps = [], **kwargs):
default = ["//third_party/qt:qt_native"],
oss_linux = ["@qt_linux//:qt_linux"],
oss_macos = ["@qt_mac//:qt_mac"],
oss_windows = ["@qt_win//:qt_win"],
),
**kwargs
)
@ -66,6 +67,7 @@ def mozc_cc_qt_binary(name, deps = [], **kwargs):
default = ["//third_party/qt:qt_native"],
oss_linux = ["@qt_linux//:qt_linux"],
oss_macos = ["@qt_mac//:qt_mac"],
oss_windows = ["@qt_win//:qt_win"],
),
**kwargs
)
@ -84,11 +86,13 @@ def mozc_qt_moc(name, srcs, outs):
default = "$(location //third_party/qt:moc) -p $$(dirname $<) -o $@ $(SRCS)",
oss_linux = "$(location @qt_linux//:libexec/moc) -p $$(dirname $<) -o $@ $(SRCS)",
oss_macos = "$(location @qt_mac//:libexec/moc) -p $$(dirname $<) -o $@ $(SRCS)",
oss_windows = "$(location @qt_win//:bin/moc.exe) -p $$(dirname $<) -o $@ $(SRCS)",
),
tools = mozc_select(
default = ["//third_party/qt:moc"],
oss_linux = ["@qt_linux//:libexec/moc"],
oss_macos = ["@qt_mac//:libexec/moc"],
oss_windows = ["@qt_win//:bin/moc.exe"],
),
)
@ -101,11 +105,13 @@ def mozc_qt_uic(name, srcs, outs):
default = "$(location //third_party/qt:uic) -o $@ $(SRCS)",
oss_linux = "$(location @qt_linux//:libexec/uic) -o $@ $(SRCS)",
oss_macos = "$(location @qt_mac//:libexec/uic) -o $@ $(SRCS)",
oss_windows = "$(location @qt_win//:bin/uic.exe) -o $@ $(SRCS)",
),
tools = mozc_select(
default = ["//third_party/qt:uic"],
oss_linux = ["@qt_linux//:libexec/uic"],
oss_macos = ["@qt_mac//:libexec/uic"],
oss_windows = ["@qt_win//:bin/uic.exe"],
),
)
@ -118,11 +124,13 @@ def mozc_qt_rcc(name, qrc_name, qrc_file, srcs, outs):
default = "$(location //third_party/qt:rcc) -o $@ -name " + qrc_name + " " + qrc_file,
oss_linux = "$(location @qt_linux//:libexec/rcc) -o $@ -name " + qrc_name + " $(location " + qrc_file + ")",
oss_macos = "$(location @qt_mac//:libexec/rcc) -o $@ -name " + qrc_name + " $(location " + qrc_file + ")",
oss_windows = "$(location @qt_win//:bin/rcc.exe) -o $@ -name " + qrc_name + " $(location " + qrc_file + ")",
),
tools = mozc_select(
default = ["//third_party/qt:rcc"],
oss_linux = ["@qt_linux//:libexec/rcc"],
oss_macos = ["@qt_mac//:libexec/rcc"],
oss_windows = ["@qt_win//:bin/rcc.exe"],
),
)