Repository navigation
Conversation
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>
There was a problem hiding this comment.
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.
| 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."); | ||
| } |
There was a problem hiding this comment.
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, \
| 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); |
There was a problem hiding this comment.
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>
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.