Skip to content

Commit 5f3c287

Browse files
authored
CMake: Do not specify LLVMSupport in LINK_LIBS. (#2575)
This is a new take on #2573. There, I was trying to fix CMake errors in the external build, with the error message saying that `LINK_COMPONENTS` should be used instead of `LINK_LIBS` for LLVM libraries. That change fixed my external build, but broke the standalone build on CI. Reading the `AddMLIR.cmake` code generating the error, I came across this line: https://github.com/llvm/llvm-project/blob/ee4dd147baff8f971f3ec5aad5a216ca9837a732/mlir/cmake/modules/AddMLIR.cmake#L287-L288 ```cmake # MLIR libraries uniformly depend on LLVMSupport. Just specify it once here. list(APPEND ARG_LINK_COMPONENTS Support) ``` This looks like hardcoding always depending on `LLVMSupport` (though I wasn't quite sure about the nuance between `Support` and `LLVMSupport`). If that's correct, then we never needed specifying `LLVMSupport` in the first place. So I tried just omitting it, and that seems to work. WDYT? --------- Signed-off-by: Benoit Jacob <[email protected]>
1 parent 24a3664 commit 5f3c287

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

stablehlo/integrations/c/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ add_mlir_public_c_api_library(ChloCAPI
2828

2929
LINK_LIBS PUBLIC
3030
ChloOps
31-
LLVMSupport
3231
)
3332

3433
add_mlir_public_c_api_library(StablehloCAPI
@@ -40,10 +39,9 @@ add_mlir_public_c_api_library(StablehloCAPI
4039
StablehloTypes.cpp
4140

4241
LINK_LIBS PUBLIC
43-
LLVMSupport
4442
MLIRCAPIIR
4543
MLIRIR
46-
MLIRSupport
44+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
4745
StablehloOps
4846
StablehloPasses
4947
StablehloPortableApi

stablehlo/reference/CMakeLists.txt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ add_mlir_library(StablehloReferenceApi
2020
MLIRIR
2121
MLIRParser
2222
MLIRPass
23-
MLIRSupport
23+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
2424
InterpreterOps
2525
StablehloPasses
2626
StablehloReferenceConfiguration
@@ -40,15 +40,15 @@ add_mlir_library(StablehloReferenceAxes
4040

4141
LINK_LIBS PUBLIC
4242
MLIRIR
43-
MLIRSupport
43+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
4444
)
4545

4646
add_mlir_library(StablehloReferenceConfiguration
4747
PARTIAL_SOURCES_INTENDED
4848
Configuration.cpp
4949

5050
LINK_LIBS PUBLIC
51-
MLIRSupport
51+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
5252
StablehloReferenceErrors
5353
StablehloReferenceProcess
5454
StablehloReferenceScope
@@ -60,7 +60,7 @@ add_mlir_library(StablehloReferenceElement
6060

6161
LINK_LIBS PUBLIC
6262
MLIRIR
63-
MLIRSupport
63+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
6464
StablehloReferenceTypes
6565
)
6666

@@ -70,7 +70,7 @@ add_mlir_library(StablehloReferenceErrors
7070

7171
LINK_LIBS PUBLIC
7272
MLIRIR
73-
MLIRSupport
73+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
7474
)
7575

7676
add_mlir_library(StablehloReferenceIndex
@@ -79,7 +79,7 @@ add_mlir_library(StablehloReferenceIndex
7979

8080
LINK_LIBS PUBLIC
8181
MLIRIR
82-
MLIRSupport
82+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
8383
)
8484

8585
set(LLVM_TARGET_DEFINITIONS InterpreterOps.td)
@@ -102,7 +102,7 @@ add_mlir_dialect_library(InterpreterOps
102102
StablehloReferenceOps
103103
StablehloReferenceProcessGrid
104104
MLIRIR
105-
MLIRSupport
105+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
106106
)
107107

108108
set(LLVM_TARGET_DEFINITIONS InterpreterPasses.td)
@@ -120,7 +120,7 @@ add_mlir_library(InterpreterPasses
120120
InterpreterOps
121121
MLIRIR
122122
MLIRPass
123-
MLIRSupport
123+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
124124
MLIRTransforms
125125
MLIRTransformUtils
126126
)
@@ -169,9 +169,8 @@ add_mlir_library(StablehloReferenceProcessGrid
169169
ProcessGrid.cpp
170170

171171
LINK_LIBS PUBLIC
172-
LLVMSupport
173172
MLIRIR
174-
MLIRSupport
173+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
175174
StablehloReferenceTensor
176175
)
177176

@@ -183,7 +182,7 @@ add_mlir_library(StablehloReferenceScope
183182
StablehloReferenceValue
184183
StablehloReferenceTensor
185184
StablehloReferenceToken
186-
MLIRSupport
185+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
187186
)
188187

189188
add_mlir_library(StablehloReferenceTensor
@@ -205,7 +204,7 @@ add_mlir_library(StablehloReferenceToken
205204

206205
LINK_LIBS PUBLIC
207206
MLIRIR
208-
MLIRSupport
207+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
209208
StablehloOps
210209
)
211210

@@ -215,7 +214,7 @@ add_mlir_library(StablehloReferenceTypes
215214

216215
LINK_LIBS PUBLIC
217216
MLIRIR
218-
MLIRSupport
217+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
219218
)
220219

221220
add_mlir_library(StablehloReferenceValue
@@ -224,7 +223,7 @@ add_mlir_library(StablehloReferenceValue
224223

225224
LINK_LIBS PUBLIC
226225
MLIRIR
227-
MLIRSupport
226+
MLIRSupport # LLVMSupport is automatically added in AddLLVM.cmake.
228227
StablehloReferenceTensor
229228
StablehloReferenceToken
230229
)

0 commit comments

Comments
 (0)