Skip to content

Commit 5f3def2

Browse files
committed
bazel: use locally built openroad instead of OpenROAD from docker image
better for OpenROAD development, which is the main use-case for ORFS. bazel-orfs used on other projects, probably want to use a bazel- Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 6b0a7f3 commit 5f3def2

File tree

4 files changed

+49
-9
lines changed

4 files changed

+49
-9
lines changed

flow/MODULE.bazel

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,25 @@ pip.parse(
4141
)
4242
use_repo(pip, "orfs-pip")
4343

44+
45+
46+
# HACK! While we're waiting for OpenROAD to switch to bzlmod
47+
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
48+
new_local_repository(
49+
name = "openroad",
50+
path = "../tools/OpenROAD/bazel-out/k8-opt/bin/openroad.runfiles/_main",
51+
build_file_content = """
52+
exports_files(["openroad"],
53+
visibility = ["//visibility:public"],
54+
)
55+
filegroup(
56+
name = "all",
57+
data = glob(["**/*"]),
58+
visibility = ["//visibility:public"],
59+
)
60+
""",
61+
)
62+
4463
orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
4564
# To bump version, run: bazelisk run @bazel-orfs//:bump
4665
orfs.default(
@@ -59,8 +78,16 @@ orfs.default(
5978
# TODO once openroad is switched to MODULE.bazel, use
6079
# local_path_override(module_name = "openroad", path = "../tools/OpenROAD")
6180
# to point to the local openroad Bazel module instead of
62-
# getting the openroad binary from the docker image.
63-
openroad = "@docker_orfs//:openroad",
81+
# getting the openroad binary from the docker image, supports GUI.
82+
#
83+
# openroad = "@docker_orfs//:openroad",
84+
85+
# Use locally built OpenROAD while we're waiting for OpenROAD
86+
# to bzlmod, no GUI for now.
87+
#
88+
# cd ../tools/OpenROAD
89+
# bazelisk build -c opt :openroad
90+
openroad = "//test:openroad",
6491
pdk = "//:asap7",
6592
sha256 = "3e42fe9dc5c71a79ccfce479a841a5f4d4ee327347483b2e0a64b3de9af4d390",
6693
)

flow/MODULE.bazel.lock

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

flow/test/BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sh_binary(
2+
name = "openroad",
3+
srcs = ["openroad.sh"],
4+
data = [
5+
"@openroad//:openroad",
6+
"@openroad//:all",
7+
],
8+
env = {
9+
"OPENROAD_EXE": "$(location @openroad//:openroad)",
10+
},
11+
visibility = ["//visibility:public"],
12+
)

flow/test/openroad.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -ex
3+
SAVED_PWD=$(realpath $(pwd))
4+
# HACK Waiting for OpenROAD to be switched to bzlmod so we can clean out this
5+
cd ./external/_main~_repo_rules~openroad/
6+
./openroad -cd $SAVED_PWD "$@"

0 commit comments

Comments
 (0)