[llvm] [Bazel] Support opt-driver library, like clang-driver (PR #79205)
William Moses via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 17:22:25 PST 2024
https://github.com/wsmoses updated https://github.com/llvm/llvm-project/pull/79205
>From ec2e2e208c1d0f7eb1af540a8941ae73bf9207a5 Mon Sep 17 00:00:00 2001
From: "William S. Moses" <gh at wsmoses.com>
Date: Tue, 23 Jan 2024 15:17:10 -0500
Subject: [PATCH] [Bazel] Support opt-driver library, like clang-driver
---
llvm/tools/opt/CMakeLists.txt | 15 +++++++++++----
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 11 ++++++++---
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt
index 2cdb99e936287ca..7ccc948603f2f0f 100644
--- a/llvm/tools/opt/CMakeLists.txt
+++ b/llvm/tools/opt/CMakeLists.txt
@@ -1,4 +1,10 @@
-set(LLVM_LINK_COMPONENTS
+add_llvm_component_library(LLVMOptDriver
+ NewPMDriver.cpp
+ opt.cpp
+ DEPENDS
+ intrinsics_gen
+
+ LLVM_LINK_COMPONENETS
AllTargetsAsmParsers
AllTargetsCodeGens
AllTargetsDescs
@@ -27,12 +33,13 @@ set(LLVM_LINK_COMPONENTS
TransformUtils
Vectorize
Passes
+)
+
+set(LLVM_LINK_COMPONENTS
+ OptDriver
)
add_llvm_tool(opt
- NewPMDriver.cpp
- opt.cpp
-
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index b22ec01376be6d4..21466a79af61b53 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -4808,8 +4808,8 @@ cc_binary(
],
)
-cc_binary(
- name = "opt",
+cc_library(
+ name = "opt-driver",
srcs = glob([
"tools/opt/*.cpp",
"tools/opt/*.h",
@@ -4820,7 +4820,6 @@ cc_binary(
"@platforms//os:macos": [],
"//conditions:default": ["-Wl,--export-dynamic"],
}),
- stamp = 0,
deps = [
":AllTargetsAsmParsers",
":AllTargetsCodeGens",
@@ -4847,6 +4846,12 @@ cc_binary(
],
)
+cc_binary(
+ name = "opt",
+ stamp = 0,
+ deps = [":opt-driver"]
+)
+
gentbl(
name = "SancovOptsTableGen",
strip_include_prefix = "tools/sancov",
More information about the llvm-commits
mailing list