Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ OPENROAD_LIBRARY_DEPS = [
] + select(
{
":platform_cli": ["//src/gui"],
":platform_gui": ["//src/gui:gui_qt"],
":platform_gui": ["//src/gui/qt:gui_qt"],
},
)

Expand Down Expand Up @@ -183,6 +183,7 @@ cc_binary(
"//bazel:runfiles",
"//src/cut",
"//src/gui",
"//src/gui:gui_headers",
"//src/sta:opensta_lib",
"//src/utl",
"@boost.stacktrace",
Expand Down Expand Up @@ -221,6 +222,7 @@ cc_library(
],
visibility = ["//:__subpackages__"],
deps = [
"//src/gui:gui_headers",
"//src/sta:opensta_lib",
"@abseil-cpp//absl/base:core_headers",
"@abseil-cpp//absl/synchronization",
Expand Down
1 change: 1 addition & 0 deletions src/cts/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ cc_library(
"//src/dbSta",
"//src/est",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/rsz",
"//src/utl",
Expand Down
1 change: 1 addition & 0 deletions src/dpl/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ cc_library(
":dpl",
"//:ord",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/utl",
"@boost.geometry",
Expand Down
1 change: 1 addition & 0 deletions src/drt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ cc_library(
"//:ord",
"//src/dst",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/utl",
"@abseil-cpp//absl/synchronization",
Expand Down
1 change: 1 addition & 0 deletions src/est/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ cc_library(
"//src/dbSta:dbNetwork",
"//src/grt",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/sta:opensta_lib",
"//src/stt",
Expand Down
1 change: 1 addition & 0 deletions src/exa/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ cc_library(
":exa",
"//:ord",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/utl",
"@boost.stacktrace",
Expand Down
1 change: 1 addition & 0 deletions src/fin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cc_library(
deps = [
"//:ord",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/utl",
"@boost.lexical_cast",
Expand Down
1 change: 1 addition & 0 deletions src/gpl/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ cc_library(
"//src/dbSta:dbNetwork",
"//src/grt",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/rsz",
"//src/sta:opensta_lib",
Expand Down
3 changes: 3 additions & 0 deletions src/grt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ cc_library(
"//src/dbSta",
"//src/dbSta:dbNetwork",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/sta:opensta_lib",
"//src/stt",
Expand Down Expand Up @@ -151,6 +152,7 @@ cc_library(
"//src/dbSta:dbNetwork",
"//src/dpl",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/sta:opensta_lib",
"//src/stt",
Expand Down Expand Up @@ -203,6 +205,7 @@ cc_library(
"//src/dbSta",
"//src/dpl",
"//src/gui",
"//src/gui:gui_headers",
"//src/odb",
"//src/sta:opensta_lib",
"//src/stt",
Expand Down
195 changes: 100 additions & 95 deletions src/gui/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2025, The OpenROAD Authors

# This file only currently supports the gui disabled. More work
# is needed to handle Qt and build a working gui.
# Qt-specific targets (gui_qt, qt_resources) live in //src/gui/qt so that
# @qt-bazel is only loaded when building with --//:platform=gui.

load("@qt-bazel//:build_defs.bzl", "qt6_library", "qt6_resource_library")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//bazel:tcl_encode_or.bzl", "tcl_encode")
load("//bazel:tcl_wrap_cc.bzl", "tcl_wrap_cc")
Expand All @@ -15,130 +14,136 @@ package(
features = ["layering_check"],
)

# Public GUI headers, declared in exactly one place. Every target that needs
# gui.h, MakeGui.h, heatMap.h, or descriptor_registry.h depends on this.
cc_library(
name = "gui",
name = "gui_headers",
hdrs = [
"include/gui/MakeGui.h",
"include/gui/descriptor_registry.h",
"include/gui/gui.h",
"include/gui/heatMap.h",
],
includes = [
"include",
],
visibility = [
"//:__subpackages__",
"//src/gui/qt:__pkg__",
],
deps = [
"//src/dbSta",
"//src/odb",
"//src/utl",
"@abseil-cpp//absl/synchronization",
"@boost.multi_array",
"@tcl_lang//:tcl",
],
)

# Shared descriptor code, compiled without Qt. Used by the CLI stub build
# and (via deps) by the Qt gui_qt target in //src/gui/qt.
cc_library(
name = "gui_descriptors",
srcs = [
"src/bufferTreeDescriptor.h",
"src/dbDescriptors.cpp",
"src/dbDescriptors.h",
"src/descriptor_registry.cpp",
"src/heatMapCore.cpp",
"src/heatMapPinDensity.cpp",
"src/heatMapPinDensity.h",
"src/heatMapPlacementDensity.cpp",
"src/heatMapPlacementDensity.h",
"src/init_descriptors.cpp",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Moving init_descriptors.cpp to the shared gui_descriptors library while moving bufferTreeDescriptor.cpp to the Qt-only gui_qt library may introduce link errors in CLI-only builds. If init_descriptors.cpp contains code that instantiates or references symbols defined in bufferTreeDescriptor.cpp, the CLI build (which does not include gui_qt) will fail to link. Please ensure that any Qt-specific descriptor logic in init_descriptors.cpp is guarded by #ifdef ENABLE_QT or moved to a GUI-specific initialization file.

"src/ruler.cpp",
"src/staDescriptors.cpp",
"src/staDescriptors.h",
"src/stub.cpp",
":tcl",
],
hdrs = [
"include/gui/MakeGui.h",
"include/gui/descriptor_registry.h",
"include/gui/gui.h",
"include/gui/heatMap.h",
"src/bufferTreeDescriptor.h",
"src/dbDescriptors.h",
"src/ruler.h",
"src/staDescriptors.h",
],
includes = [
".",
"include",
"src",
],
visibility = [
"//:__subpackages__",
"//src/gui/qt:__pkg__",
],
deps = [
":gui_headers",
"//src/dbSta",
"//src/dbSta:dbNetwork",
"//src/odb",
"//src/sta:opensta_lib",
"//src/utl",
"@abseil-cpp//absl/synchronization",
"@boost.algorithm",
"@boost.geometry",
"@boost.multi_array",
"@spdlog",
"@tcl_lang//:tcl",
],
)

# A Qt 'headless' build is added for environments that require GUI features
# but do not have an attached display. This requires setting 'qt_gui_platform'
# to `headless`, and subsituting the dependency in the top-level BUILD.
QT_GUI_PLATFORMS = {
"headless": "_headless",
"native": "",
}

[
qt6_library(
name = "gui_qt" + suffix,
srcs = glob(
include = [
"src/*.cpp",
],
exclude = [
"src/stub.cpp",
"src/stub_heatMap.cpp",
],
) + [
":gui_swig",
":tcl",
],
hdrs = [
"include/gui/MakeGui.h",
"include/gui/descriptor_registry.h",
"include/gui/gui.h",
"include/gui/heatMap.h",
],
defines = select({
"@platforms//os:linux": ["STATIC_QPA_PLUGIN_XCB=1"],
"//conditions:default": [],
}),
includes = [
"include",
"src",
"ui",
],
moc_hdrs = glob(["src/*.h"]),
qt_gui_platform = platform,
uic_srcs = glob(["ui/*.ui"]) if platform == "native" else [],
deps = [
":qt_resources",
"//:ord",
"//src/dbSta",
"//src/dbSta:dbNetwork",
"//src/odb",
"//src/sta:opensta_lib",
"//src/utl",
"//third-party/gif-h:gif_h",
"@abseil-cpp//absl/synchronization",
"@boost.algorithm",
"@boost.geometry",
"@boost.multi_array",
"@boost.stacktrace",
"@spdlog",
"@tcl_lang//:tcl",
] + ([":uic_lib"] if platform == "headless" else []),
)
for platform, suffix in QT_GUI_PLATFORMS.items()
]

# This is used to work around the limitation of the `qt6_library` rule which
# only supports use of one `qt6_library` rule using `uic_srcs` per package.
# Shared heat-map core, compiled without Qt. Used by the CLI stub build
# and (via deps) by the Qt gui_qt target in //src/gui/qt.
cc_library(
name = "uic_lib",
name = "gui_heatmap_core",
srcs = [
"src/heatMapCore.cpp",
"src/heatMapPinDensity.cpp",
"src/heatMapPlacementDensity.cpp",
],
hdrs = [
":ui/ui_findDlg.h",
":ui/ui_gotoDlg.h",
":ui/ui_highlightGroupDlg.h",
":ui/ui_selectedWidget.h",
"src/heatMapPinDensity.h",
"src/heatMapPlacementDensity.h",
],
includes = [
".",
"include",
"src",
],
visibility = [
"//:__subpackages__",
"//src/gui/qt:__pkg__",
],
deps = [
":gui_headers",
"//src/dbSta",
"//src/dbSta:dbNetwork",
"//src/odb",
"//src/sta:opensta_lib",
"//src/utl",
"@abseil-cpp//absl/synchronization",
"@boost.algorithm",
"@boost.multi_array",
"@spdlog",
],
)

qt6_resource_library(
name = "qt_resources",
data_srcs = glob([
"resources/**/*.png",
]),
external_init_name = "resource",
qrc_srcs = [
"resources/resource.qrc",
cc_library(
name = "gui",
srcs = [
"src/stub.cpp",
":tcl",
],
includes = [
".",
"include",
"src",
],
deps = [
":gui_descriptors",
":gui_headers",
":gui_heatmap_core",
"//src/dbSta",
"//src/dbSta:dbNetwork",
"//src/odb",
"//src/sta:opensta_lib",
"//src/utl",
"@abseil-cpp//absl/synchronization",
"@boost.algorithm",
"@boost.multi_array",
"@spdlog",
"@tcl_lang//:tcl",
],
)

Expand Down
Loading
Loading