Skip to content

Commit 76ad848

Browse files
committed
Merge remote-tracking branch 'origin/master' into gpl_fix_max_filler_removal
2 parents a47856a + 646a606 commit 76ad848

File tree

742 files changed

+217795
-7690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

742 files changed

+217795
-7690
lines changed

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,7 @@ build:openroad-dev --google_default_credentials=true
9797
build:openroad-dev --disk_cache=/workspace/.cache/bazel-disk-cache
9898
build:openroad-dev --repository_cache=/workspace/.cache/bazel-repository-cache
9999

100+
# Without this, bazelisk build ... builds the bazel-orfs tests
101+
build --build_tag_filters=-orfs
102+
100103
try-import %workspace%/user.bazelrc

.github/workflows/github-actions-lint-tcl.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
- name: Install Dependencies
2020
run: |
2121
python3 -m venv venv
22-
venv/bin/pip install tclint==0.4.2
22+
venv/bin/pip install tclint==0.6.1
2323
2424
- name: Lint
2525
run: |
2626
source venv/bin/activate
2727
tclfmt --version
2828
tclfmt --in-place .
2929
git diff --exit-code
30-
tclint --no-check-style .
30+
tclint .
3131

BUILD.bazel

Lines changed: 107 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Copyright (c) 2025-2025, The OpenROAD Authors
33

44
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
5+
load("//bazel:python_wrap_cc.bzl", "PYTHON_STABLE_API_DEFINE", "python_wrap_cc")
56
load("//bazel:tcl_encode_or.bzl", "tcl_encode")
67
load("//bazel:tcl_wrap_cc.bzl", "tcl_wrap_cc")
78

@@ -43,8 +44,6 @@ config_setting(
4344
},
4445
)
4546

46-
# TODO: once project is properly decomposed, we don't
47-
# need these blanked dependencies in multiple places anymore.
4847
OPENROAD_LIBRARY_DEPS = [
4948
":openroad_version",
5049
":ord",
@@ -55,6 +54,10 @@ OPENROAD_LIBRARY_DEPS = [
5554
"//src/cts:ui",
5655
"//src/cut",
5756
"//src/dbSta",
57+
"//src/dbSta:dbNetwork",
58+
"//src/dbSta:dbReadVerilog",
59+
"//src/dbSta:dbSdcNetwork",
60+
"//src/dbSta:SpefWriter",
5861
"//src/dbSta:ui",
5962
"//src/dft",
6063
"//src/dft:ui",
@@ -133,16 +136,20 @@ cc_binary(
133136
name = "openroad",
134137
srcs = [
135138
"src/Main.cc",
136-
"//bazel:runfiles",
137139
],
138140
copts = OPENROAD_COPTS,
139141
features = ["-use_header_modules"],
140-
malloc = "@tcmalloc//tcmalloc",
142+
malloc = select({
143+
"@platforms//os:linux": "@tcmalloc//tcmalloc",
144+
"@platforms//os:macos": "@bazel_tools//tools/cpp:malloc",
145+
}),
141146
visibility = ["//visibility:public"],
142147
deps = [
143148
":openroad_lib",
144149
":openroad_version",
145-
"//:ord",
150+
":ord",
151+
"//bazel:runfiles",
152+
"//src/cut",
146153
"//src/gui",
147154
"//src/sta:opensta_lib",
148155
"//src/utl",
@@ -159,25 +166,6 @@ GUI_BUILD_FLAGS = select(
159166
},
160167
)
161168

162-
cc_library(
163-
name = "openroad_lib_private",
164-
srcs = [
165-
"src/Design.cc",
166-
"src/Tech.cc",
167-
"src/Timing.cc",
168-
],
169-
copts = OPENROAD_COPTS,
170-
defines = OPENROAD_DEFINES + GUI_BUILD_FLAGS,
171-
features = ["-use_header_modules"],
172-
includes = [
173-
"include",
174-
],
175-
deps = OPENROAD_LIBRARY_DEPS + [
176-
"//src/sta:opensta_lib",
177-
"@tk_tcl//:tcl",
178-
],
179-
)
180-
181169
cc_library(
182170
name = "openroad_lib",
183171
srcs = [
@@ -261,6 +249,93 @@ tcl_wrap_cc(
261249
],
262250
)
263251

252+
# This target compiles the SWIG C++ wrapper into a shared library (.so)
253+
# that Python can load dynamically.
254+
cc_binary(
255+
name = "_openroadpy.so",
256+
srcs = [":openroad_swig-py"],
257+
defines = [PYTHON_STABLE_API_DEFINE],
258+
linkshared = True,
259+
deps = [
260+
":openroad_lib", # Depends on the core odb C++ library
261+
":ord",
262+
"//src/ant",
263+
"//src/cts",
264+
"//src/dpl",
265+
"//src/drt",
266+
"//src/exa",
267+
"//src/fin",
268+
"//src/gpl",
269+
"//src/grt",
270+
"//src/gui",
271+
"//src/ifp",
272+
"//src/odb",
273+
"//src/par",
274+
"//src/pdn",
275+
"//src/ppl",
276+
"//src/psm",
277+
"//src/rcx",
278+
"//src/stt",
279+
"//src/tap",
280+
"//src/utl",
281+
"@boost.stacktrace",
282+
"@openroad_rules_python//python/cc:current_py_cc_headers",
283+
],
284+
)
285+
286+
# This packages the SWIG-generated Python wrapper (odb.py) and the
287+
# compiled C++ extension (_odb.so) together.
288+
py_library(
289+
name = "ord_py",
290+
srcs = [":openroad_swig-py"], # Use the .py output from the swig-py rule
291+
# The data attribute makes the .so file available at runtime.
292+
data = [":_openroadpy.so"],
293+
# This allows imports relative to the workspace root.
294+
imports = ["."],
295+
visibility = ["//visibility:public"],
296+
deps = [
297+
"//src/odb:odb_py",
298+
"//src/utl:utl_py",
299+
],
300+
)
301+
302+
python_wrap_cc(
303+
name = "openroad_swig-py",
304+
srcs = [
305+
"include/ord/Design.h",
306+
"include/ord/Tech.h",
307+
"include/ord/Timing.h",
308+
"src/OpenRoad-py.i",
309+
":error_swig-py",
310+
],
311+
module = "openroadpy",
312+
root_swig_src = "src/OpenRoad-py.i",
313+
swig_includes = [
314+
"include",
315+
"src",
316+
],
317+
deps = [
318+
"//src/ant:swig-py",
319+
"//src/cts:swig-py",
320+
"//src/dpl:swig-py",
321+
"//src/drt:swig-py",
322+
"//src/exa:swig-py",
323+
"//src/fin:swig-py",
324+
"//src/gpl:swig-py",
325+
"//src/grt:swig-py",
326+
"//src/ifp:swig-py",
327+
"//src/odb:swig-py",
328+
"//src/par:swig-py",
329+
"//src/pdn:swig-py",
330+
"//src/ppl:swig-py",
331+
"//src/psm:swig-py",
332+
"//src/rcx:swig-py",
333+
"//src/stt:swig-py",
334+
"//src/tap:swig-py",
335+
"//src/utl:swig-py",
336+
],
337+
)
338+
264339
filegroup(
265340
name = "error_swig",
266341
srcs = [
@@ -269,6 +344,14 @@ filegroup(
269344
visibility = ["@//:__subpackages__"],
270345
)
271346

347+
filegroup(
348+
name = "error_swig-py",
349+
srcs = [
350+
"src/Exception-py.i",
351+
],
352+
visibility = ["@//:__subpackages__"],
353+
)
354+
272355
filegroup(
273356
name = "design_swig",
274357
srcs = [

MODULE.bazel

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ bazel_dep(name = "googletest", version = "1.16.0", dev_dependency = True)
110110
bazel_dep(name = "glpk", version = "5.0.bcr.3", repo_name = "org_gnu_glpk")
111111

112112
## Fix the compiler version and avoid any local compiler
113-
bazel_dep(name = "toolchains_llvm", version = "1.4.0")
113+
bazel_dep(name = "toolchains_llvm", version = "1.5.0")
114114

115115
# Configure and register the toolchain.
116116
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
117117
llvm.toolchain(
118-
llvm_version = "20.1.2",
118+
llvm_version = "20.1.8",
119119
)
120120
use_repo(llvm, "llvm_toolchain")
121121
# use_repo(llvm, "llvm_toolchain_llvm") # if you depend on specific tools in scripts
@@ -138,6 +138,7 @@ python.toolchain(
138138
ignore_root_user_error = True,
139139
python_version = "3.13",
140140
)
141+
use_repo(python, "python_3_13")
141142

142143
pip = use_extension("@openroad_rules_python//python/extensions:pip.bzl", "pip")
143144
pip.parse(
@@ -152,7 +153,7 @@ bazel_dep(name = "bazel-orfs")
152153
# To bump version, run: bazelisk run @bazel-orfs//:bump
153154
git_override(
154155
module_name = "bazel-orfs",
155-
commit = "25aa6f643146394f201eac5ef4df69887c83859f",
156+
commit = "2cf0198a49a220cfcabae35bba64b0034bbdbffc",
156157
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
157158
)
158159

@@ -161,10 +162,10 @@ orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
161162
# To bump version, run: bazelisk run @bazel-orfs//:bump
162163
orfs.default(
163164
# Official image https://hub.docker.com/r/openroad/orfs/tags
164-
image = "docker.io/openroad/orfs:v3.0-3749-g8443d760",
165+
image = "docker.io/openroad/orfs:v3.0-3845-gbefd38218",
165166
# Use OpenROAD of this repo instead of from the docker image
166167
openroad = "//:openroad",
167-
sha256 = "f84c76855e854e89e54eb87fac2b65038567205ced5f8051e34e2e842047d78a",
168+
sha256 = "4982a5b87588e4699f11deaed3286cba8b65d144e439c6f5845656abebfc0971",
168169
)
169170
use_repo(orfs, "com_github_nixos_patchelf_download")
170171
use_repo(orfs, "docker_orfs")

MODULE.bazel.lock

Lines changed: 15 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ cc_library(
1616
deps = [
1717
"@rules_cc//cc/runfiles",
1818
],
19+
alwayslink = True,
1920
)

bazel/InitRunFiles.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#include <optional>
77
#include <string>
88

9+
#if defined(__APPLE__)
10+
#include <mach-o/dyld.h>
11+
#include <sys/param.h>
12+
#endif
13+
914
#include "rules_cc/cc/runfiles/runfiles.h"
1015

1116
// Avoid adding any dependencies like boost.filesystem
@@ -19,7 +24,7 @@ static std::optional<std::string> getProgramLocation()
1924
char result[MAXPATHLEN + 1] = {'\0'};
2025
uint32_t path_len = MAXPATHLEN;
2126
if (_NSGetExecutablePath(result, &path_len) != 0) {
22-
path_len = readlink("/proc/self/exe", result, MAXPATHLEN);
27+
path_len = readlink(result, result, MAXPATHLEN);
2328
}
2429
#else
2530
char result[PATH_MAX + 1] = {'\0'};
@@ -50,9 +55,9 @@ class BazelInitializer
5055
}
5156

5257
// Set the TCL_LIBRARY environment variable
53-
std::string path = runfiles->Rlocation("tk_tcl/library/");
54-
if (!path.empty()) {
55-
setenv("TCL_LIBRARY", path.c_str(), 0);
58+
const std::string tcl_path = runfiles->Rlocation("tk_tcl/library/");
59+
if (!tcl_path.empty()) {
60+
setenv("TCL_LIBRARY", tcl_path.c_str(), 0);
5661
} else {
5762
std::cerr << "Error: Could not locate 'tk_tcl/library/' in runfiles."
5863
<< std::endl;

0 commit comments

Comments
 (0)