Merge pull request #335 from hzeller/feature-20260405-init-tcl

Use same tcl initialization as in OpenROAD
This commit is contained in:
Matt Liberty 2026-04-07 16:13:08 +00:00 committed by GitHub
commit 12bbfed551
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

2
BUILD
View File

@ -272,7 +272,6 @@ cc_binary(
"app/Main.cc", "app/Main.cc",
":StaApp", ":StaApp",
":StaTclInitVar", ":StaTclInitVar",
"//bazel:runfiles",
], ],
copts = [ copts = [
"-Wno-error", "-Wno-error",
@ -297,6 +296,7 @@ cc_binary(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":opensta_lib", ":opensta_lib",
"//bazel:tcl_library_init",
"@rules_cc//cc/runfiles", "@rules_cc//cc/runfiles",
"@tcl_lang//:tcl", "@tcl_lang//:tcl",
], ],

View File

@ -30,6 +30,11 @@
#include <filesystem> #include <filesystem>
#include <string_view> #include <string_view>
#include <tcl.h> #include <tcl.h>
#ifdef BAZEL_CURRENT_REPOSITORY
#include "bazel/tcl_library_init.h"
#endif
#if TCL_READLINE #if TCL_READLINE
#include <tclreadline.h> #include <tclreadline.h>
#endif #endif
@ -109,6 +114,12 @@ staTclAppInit(int argc,
std::string_view init_filename, std::string_view init_filename,
Tcl_Interp *interp) Tcl_Interp *interp)
{ {
#ifdef BAZEL_CURRENT_REPOSITORY
if (in_bazel::SetupTclEnvironment(interp) == TCL_ERROR) {
return TCL_ERROR;
}
#endif
// source init.tcl // source init.tcl
if (Tcl_Init(interp) == TCL_ERROR) if (Tcl_Init(interp) == TCL_ERROR)
return TCL_ERROR; return TCL_ERROR;