[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:21:30 PST 2024
https://github.com/wsmoses updated https://github.com/llvm/llvm-project/pull/79205
>From 2bbfb7d71f95b9b2e40e57db0fc9eab007084155 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 2cdb99e936287c..35913bc4595994 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
+
+ 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 b22ec01376be6d..21466a79af61b5 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