Skip to content

Commit 9103e99

Browse files
authored
Merge pull request #8467 from mikesinouye/headless
gui: add a 'headless' qt6_library variant
2 parents 1fed54e + 657ef21 commit 9103e99

File tree

1 file changed

+65
-41
lines changed

1 file changed

+65
-41
lines changed

src/gui/BUILD

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,50 +34,74 @@ cc_library(
3434
],
3535
)
3636

37-
qt6_library(
38-
name = "gui_qt",
39-
srcs = glob(
40-
include = [
41-
"src/*.cpp",
37+
# A Qt 'headless' build is added for environments that require GUI features
38+
# but do not have an attached display. This requires setting 'qt_gui_platform'
39+
# to `headless`, and subsituting the dependency in the top-level BUILD.
40+
QT_GUI_PLATFORMS = {
41+
"headless": "_headless",
42+
"native": "",
43+
}
44+
45+
[
46+
qt6_library(
47+
name = "gui_qt" + suffix,
48+
srcs = glob(
49+
include = [
50+
"src/*.cpp",
51+
],
52+
exclude = [
53+
"src/stub.cpp",
54+
"src/stub_heatMap.cpp",
55+
],
56+
) + [
57+
":gui_swig",
58+
":tcl",
4259
],
43-
exclude = [
44-
"src/stub.cpp",
45-
"src/stub_heatMap.cpp",
60+
hdrs = [
61+
"include/gui/MakeGui.h",
62+
"include/gui/gui.h",
63+
"include/gui/heatMap.h",
4664
],
47-
) + [
48-
":gui_swig",
49-
":tcl",
50-
],
65+
defines = [
66+
"STATIC_QPA_PLUGIN_XCB=1",
67+
],
68+
includes = [
69+
"include",
70+
"src",
71+
"ui",
72+
],
73+
moc_hdrs = glob(["src/*.h"]),
74+
qt_gui_platform = platform,
75+
uic_srcs = glob(["ui/*.ui"]) if platform == "native" else [],
76+
deps = [
77+
":qt_resources",
78+
"//:ord",
79+
"//src/dbSta",
80+
"//src/dbSta:dbNetwork",
81+
"//src/odb",
82+
"//src/sta:opensta_lib",
83+
"//src/utl",
84+
"//third-party/gif-h:gif_h",
85+
"@boost.algorithm",
86+
"@boost.geometry",
87+
"@boost.multi_array",
88+
"@boost.stacktrace",
89+
"@spdlog",
90+
"@tk_tcl//:tcl",
91+
] + ([":uic_lib"] if platform == "headless" else []),
92+
)
93+
for platform, suffix in QT_GUI_PLATFORMS.items()
94+
]
95+
96+
# This is used to work around the limitation of the `qt6_library` rule which
97+
# only supports use of one `qt6_library` rule using `uic_srcs` per package.
98+
cc_library(
99+
name = "uic_lib",
51100
hdrs = [
52-
"include/gui/MakeGui.h",
53-
"include/gui/gui.h",
54-
"include/gui/heatMap.h",
55-
],
56-
defines = [
57-
"STATIC_QPA_PLUGIN_XCB=1",
58-
],
59-
includes = [
60-
"include",
61-
"src",
62-
"ui",
63-
],
64-
moc_hdrs = glob(["src/*.h"]),
65-
uic_srcs = glob(["ui/*.ui"]),
66-
deps = [
67-
":qt_resources",
68-
"//:ord",
69-
"//src/dbSta",
70-
"//src/dbSta:dbNetwork",
71-
"//src/odb",
72-
"//src/sta:opensta_lib",
73-
"//src/utl",
74-
"//third-party/gif-h:gif_h",
75-
"@boost.algorithm",
76-
"@boost.geometry",
77-
"@boost.multi_array",
78-
"@boost.stacktrace",
79-
"@spdlog",
80-
"@tk_tcl//:tcl",
101+
":ui/ui_findDlg.h",
102+
":ui/ui_gotoDlg.h",
103+
":ui/ui_highlightGroupDlg.h",
104+
":ui/ui_selectedWidget.h",
81105
],
82106
)
83107

0 commit comments

Comments
 (0)