Skip to content

gui: give every build the gui:: commands - #11942

Merged
maliberty merged 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:issue11488-1-gui-every-build
Nov 5, 2026
Merged

maliberty merged 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:issue11488-1-gui-every-build

Conversation

@jorge-ferreira-pii

Copy link
Copy Markdown
Contributor

Part 1 of 9 for #11488: running ORFS's save_images.tcl with the web viewer, also in builds without Qt.

Until now, the gui:: Tcl commands only existed when OpenROAD was built with Qt, so a script that calls them failed in the default build. This PR makes the same commands available in every build. Without a Qt window, they behave as before: they log GUI-0001 and do nothing. The next PRs give them something to act on.

In a build without Qt, save_image now uses the web renderer instead of failing.

gui.i and gui.tcl now build without Qt too, so a script can call the
gui:: commands in any build; with no window they still log GUI-0001.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@jorge-ferreira-pii jorge-ferreira-pii self-assigned this Oct 22, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request unifies the GUI commands and behaviors between OpenROAD builds with and without Qt support. It ensures that gui:: Tcl commands are registered in both configurations, stubbing out Qt-specific GUI methods when Qt is disabled, and automatically falling back to the web tile renderer for save_image in headless builds. Feedback on these changes includes addressing a potential compilation error in the SWIG wrapper by using the fully qualified utl::GUI namespace, and ensuring robust error handling by checking the return value of Gui_Init during Tcl initialization.

Comment thread src/gui/src/gui.i
Comment on lines +308 to +311
if (!web::Gui::hasUI() && gui->getLauncher() == nullptr) {
auto logger = ord::OpenRoad::openRoad()->getLogger();
logger->error(GUI, 113, "Command gui::save_image is not available as OpenROAD was not compiled with QT support.");
}

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

The identifier GUI is used as the tool ID for the logger, but it is defined in the utl namespace as utl::GUI. Unless using namespace utl; is explicitly in scope (which is not guaranteed in the SWIG-generated wrapper), this will cause a compilation error. It is safer and more consistent with other files (like makeGui.cpp) to use the fully qualified utl::GUI.

  if (!web::Gui::hasUI() && gui->getLauncher() == nullptr) {\n    auto logger = ord::OpenRoad::openRoad()->getLogger();\n    logger->error(utl::GUI, 113, \

Comment thread src/gui/src/makeGui.cpp
web::Gui::get()->initCommon(db, sta, logger);
// The same gui:: commands as a Qt build, so a script runs on either; with
// no window they answer as a Qt build does before its window opens.
Gui_Init(interp);

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.

medium

The return value of Gui_Init(interp) is ignored. In Tcl, package initialization functions return TCL_OK or TCL_ERROR and set the interpreter result on failure. Ignoring this return value can lead to silent failures or unstable states if the GUI Tcl commands fail to initialize. It is recommended to check the return value and log an error if initialization fails.

  if (Gui_Init(interp) == TCL_ERROR) {\n    logger->error(utl::GUI, 114, \

…ery-build

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@github-actions github-actions Bot added size/M and removed size/L labels Nov 4, 2026
@maliberty
maliberty merged commit 9a32294 into The-OpenROAD-Project:master Nov 5, 2026
20 checks passed
@maliberty
maliberty deleted the issue11488-1-gui-every-build branch November 5, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants