From 385f4fdb792ee237b2e847b63d355c24477ac1c7 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Sun, 5 Apr 2026 08:53:54 +0200 Subject: [PATCH] Use same tcl initialization as in OpenROAD In https://github.com/The-OpenROAD-Project/OpenROAD/pull/10041 we have a new way to initializa the tcl subsystem which will allow to be entirely independent of separate files once we can switch to Tcl9. Signed-off-by: Henner Zeller --- BUILD | 2 +- app/Main.cc | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index dc3b7498..fdc2beb9 100644 --- a/BUILD +++ b/BUILD @@ -272,7 +272,6 @@ cc_binary( "app/Main.cc", ":StaApp", ":StaTclInitVar", - "//bazel:runfiles", ], copts = [ "-Wno-error", @@ -297,6 +296,7 @@ cc_binary( visibility = ["//visibility:public"], deps = [ ":opensta_lib", + "//bazel:tcl_library_init", "@rules_cc//cc/runfiles", "@tcl_lang//:tcl", ], diff --git a/app/Main.cc b/app/Main.cc index 8134b35e..44e30c07 100644 --- a/app/Main.cc +++ b/app/Main.cc @@ -30,6 +30,11 @@ #include #include #include + +#ifdef BAZEL_CURRENT_REPOSITORY + #include "bazel/tcl_library_init.h" +#endif + #if TCL_READLINE #include #endif @@ -109,6 +114,12 @@ staTclAppInit(int argc, std::string_view init_filename, Tcl_Interp *interp) { +#ifdef BAZEL_CURRENT_REPOSITORY + if (in_bazel::SetupTclEnvironment(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#endif + // source init.tcl if (Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR;