Skip to content

Commit ec6670c

Browse files
oharboeclaude
andcommitted
bazel: move -fopenmp to global .bazelrc, fixes The-OpenROAD-Project#7451
Move -fopenmp from per-target copts to a global --cxxopt in .bazelrc so all OpenROAD code is compiled with OpenMP support without needing it in each BUILD file. External BCR deps (e.g. or-tools, eigen) get -fno-openmp via --per_file_copt to avoid omp.h not found errors, since @OpenMP headers aren't in their sandbox and toolchains_llvm doesn't yet expose them (see bazel-contrib/toolchains_llvm#339). Note: src/sta (OpenSTA submodule) still has a per-target -fopenmp that should be removed in a follow-up PR to that repo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4658093 commit ec6670c

File tree

7 files changed

+7
-13
lines changed

7 files changed

+7
-13
lines changed

.bazelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ build:opt --linkopt=-flto
3232
# See also https://kristerw.github.io/2021/11/09/fp-contract/
3333
build --cxxopt "-ffp-contract=off" --host_cxxopt "-ffp-contract=off"
3434

35+
# Use OpenMP for all OpenROAD code. External BCR deps (e.g. or-tools, eigen)
36+
# can't use it yet because the @openmp headers aren't in their sandbox and
37+
# toolchains_llvm doesn't expose omp.h (see bazel-contrib/toolchains_llvm#339).
38+
build --cxxopt "-fopenmp" --host_cxxopt "-fopenmp"
39+
build --per_file_copt=external/.*@-fno-openmp
40+
build --host_per_file_copt=external/.*@-fno-openmp
41+
3542
# allow exceptions.
3643
build --cxxopt=-fexceptions --host_cxxopt=-fexceptions
3744

BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ OPENROAD_COPTS = [
145145
"-Wno-sign-compare",
146146
"-Wno-unused-parameter",
147147
"-Wmismatched-tags",
148-
"-fopenmp",
149148
]
150149

151150
OPENROAD_DEFINES = [

src/ant/BUILD

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ cc_library(
2525
hdrs = [
2626
"include/ant/AntennaChecker.hh",
2727
],
28-
copts = [
29-
"-fopenmp",
30-
],
3128
includes = [
3229
"include",
3330
],

src/drt/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ cc_library(
199199
],
200200
copts = [
201201
"-Isrc/drt/src",
202-
"-fopenmp",
203202
],
204203
includes = [
205204
"include",

src/est/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ cc_library(
7373
copts = [
7474
"-Isrc/est/src",
7575
"-Wno-missing-braces", # from TCL swigging
76-
"-fopenmp",
7776
],
7877
includes = [
7978
"include",

src/gpl/BUILD

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ cc_library(
5252
"src/graphicsNone.h",
5353
"src/mbff.h",
5454
],
55-
copts = [
56-
"-fopenmp",
57-
],
5855
includes = [
5956
"include",
6057
],

src/grt/BUILD

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ cc_library(
133133
"include/grt/RoutePt.h",
134134
"include/grt/Rudy.h",
135135
],
136-
copts = [
137-
"-fopenmp",
138-
],
139136
includes = [
140137
"include",
141138
],
@@ -186,7 +183,6 @@ cc_library(
186183
copts = [
187184
"-Isrc/grt/src",
188185
"-Wno-missing-braces", # from TCL swigging
189-
"-fopenmp",
190186
],
191187
includes = [
192188
"include",

0 commit comments

Comments
 (0)