Skip to content

Commit 7a6c689

Browse files
[MLIR] Move from using target_link_libraries to LINK_LIBS for llvm libraries.
When compiling libLLVM.so, add_llvm_library() manipulates the link libraries being used. This means that when using add_llvm_library(), we need to pass the list of libraries to be linked (using the LINK_LIBS keyword) instead of using the standard target_link_libraries call. This is preparation for properly dealing with creating libMLIR.so as well. Differential Revision: https://reviews.llvm.org/D74864
1 parent 07aa9ae commit 7a6c689

File tree

59 files changed

+427
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+427
-220
lines changed

mlir/examples/toy/Ch6/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ target_link_libraries(toyc-ch6
4141
MLIRPass
4242
MLIRTargetLLVMIR
4343
MLIRTransforms
44+
LLVMOrcJIT
45+
LLVMSupport
46+
LLVMX86CodeGen
47+
LLVMX86Desc
48+
LLVMX86Info
4449
)

mlir/examples/toy/Ch7/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ target_link_libraries(toyc-ch7
3838
MLIRIR
3939
MLIRParser
4040
MLIRPass
41+
MLIRSupport
4142
MLIRTargetLLVMIR
4243
MLIRTransforms
44+
LLVMOrcJIT
45+
LLVMSupport
46+
LLVMX86CodeGen
47+
LLVMX86Desc
48+
LLVMX86Info
4349
)

mlir/lib/Analysis/CMakeLists.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ add_llvm_library(MLIRAnalysis
2222

2323
ADDITIONAL_HEADER_DIRS
2424
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
25+
26+
LINK_LIBS
27+
MLIRAffineOps
28+
MLIRIR
29+
MLIRLoopOps
30+
MLIRSupport
31+
LLVMSupport
2532
)
2633
add_dependencies(MLIRAnalysis
2734
MLIRAffineOps
@@ -30,8 +37,6 @@ add_dependencies(MLIRAnalysis
3037
MLIRLoopOps
3138
)
3239

33-
target_link_libraries(MLIRAnalysis MLIRAffineOps MLIRLoopOps)
34-
3540
add_llvm_library(MLIRLoopAnalysis
3641
AffineAnalysis.cpp
3742
AffineStructures.cpp
@@ -41,12 +46,18 @@ add_llvm_library(MLIRLoopAnalysis
4146

4247
ADDITIONAL_HEADER_DIRS
4348
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
49+
50+
LINK_LIBS
51+
MLIRAffineOps
52+
MLIRIR
53+
MLIRLoopOps
54+
MLIRStandardOps
55+
MLIRSupport
56+
LLVMSupport
4457
)
4558
add_dependencies(MLIRLoopAnalysis
4659
MLIRAffineOps
4760
MLIRCallOpInterfacesIncGen
4861
MLIRTypeInferOpInterfaceIncGen
4962
MLIRLoopOps
5063
)
51-
52-
target_link_libraries(MLIRLoopAnalysis MLIRAffineOps MLIRLoopOps)

mlir/lib/Conversion/AffineToStandard/CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@ add_mlir_conversion_library(MLIRAffineToStandard
33

44
ADDITIONAL_HEADER_DIRS
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/AffineToStandard
6-
)
7-
add_dependencies(
8-
MLIRAffineToStandard
96

7+
LINK_LIBS
108
MLIRAffineOps
9+
MLIRLoopOps
10+
MLIRPass
1111
MLIRStandardOps
12+
MLIRTransforms
1213
MLIRIR
1314
LLVMCore
1415
LLVMSupport
15-
)
16-
target_link_libraries(
16+
)
17+
add_dependencies(
1718
MLIRAffineToStandard
1819

1920
MLIRAffineOps
20-
MLIRLoopOps
21-
MLIRPass
2221
MLIRStandardOps
23-
MLIRTransforms
2422
MLIRIR
2523
LLVMCore
2624
LLVMSupport

mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ if (MLIR_CUDA_CONVERSIONS_ENABLED)
1010
list(APPEND SOURCES "ConvertKernelFuncToCubin.cpp")
1111
endif()
1212

13-
add_mlir_conversion_library(MLIRGPUtoCUDATransforms ${SOURCES})
14-
target_link_libraries(MLIRGPUtoCUDATransforms
13+
add_mlir_conversion_library(MLIRGPUtoCUDATransforms
14+
${SOURCES}
15+
LINK_LIBS
16+
LLVMNVPTXCodeGen
17+
LLVMNVPTXDesc
18+
LLVMNVPTXInfo
1519
MLIRGPU
1620
MLIRLLVMIR
1721
MLIRNVVMIR
1822
MLIRPass
1923
MLIRTargetNVVMIR
20-
)
24+
)

mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ add_public_tablegen_target(MLIRGPUToNVVMIncGen)
44

55
add_mlir_conversion_library(MLIRGPUtoNVVMTransforms
66
LowerGpuOpsToNVVMOps.cpp
7-
)
8-
9-
add_dependencies(MLIRGPUtoNVVMTransforms
10-
MLIRGPUToNVVMIncGen)
117

12-
target_link_libraries(MLIRGPUtoNVVMTransforms
8+
LINK_LIBS
9+
LLVMCore
1310
LLVMSupport
1411
MLIRGPU
12+
MLIRIR
1513
MLIRLLVMIR
1614
MLIRNVVMIR
1715
MLIRPass
16+
MLIRStandardOps
1817
MLIRStandardToLLVM
18+
MLIRSupport
19+
MLIRTransforms
1920
MLIRTransformUtils
2021
)
22+
23+
add_dependencies(MLIRGPUtoNVVMTransforms
24+
MLIRGPUToNVVMIncGen)
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
add_mlir_conversion_library(MLIRGPUtoROCDLTransforms
22
LowerGpuOpsToROCDLOps.cpp
3-
)
4-
target_link_libraries(MLIRGPUtoROCDLTransforms
3+
4+
LINK_LIBS
5+
LLVMCore
56
LLVMSupport
67
MLIRGPU
8+
MLIRIR
79
MLIRLLVMIR
810
MLIRROCDLIR
911
MLIRPass
1012
MLIRStandardToLLVM
13+
MLIRStandardOps
14+
MLIRTransforms
15+
MLIRTransformUtils
1116
)

mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ add_public_tablegen_target(MLIRGPUToSPIRVIncGen)
55
add_mlir_conversion_library(MLIRGPUtoSPIRVTransforms
66
ConvertGPUToSPIRV.cpp
77
ConvertGPUToSPIRVPass.cpp
8-
)
9-
10-
add_dependencies(MLIRGPUtoSPIRVTransforms
11-
MLIRGPUToSPIRVIncGen)
128

13-
target_link_libraries(MLIRGPUtoSPIRVTransforms
9+
LINK_LIBS
1410
MLIRGPU
1511
MLIRIR
12+
MLIRLoopOps
1613
MLIRPass
1714
MLIRSPIRV
1815
MLIRStandardOps
1916
MLIRStandardToSPIRVTransforms
2017
MLIRSupport
2118
MLIRTransforms
19+
LLVMSupport
2220
)
21+
22+
add_dependencies(MLIRGPUtoSPIRVTransforms
23+
MLIRGPUToSPIRVIncGen)

mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ add_mlir_conversion_library(MLIRLinalgToLLVM
33

44
ADDITIONAL_HEADER_DIRS
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LinalgToLLVM
6-
)
7-
set(LIBS
6+
7+
LINK_LIBS
88
MLIRAffineToStandard
99
MLIREDSC
1010
MLIRIR
1111
MLIRLinalgOps
1212
MLIRLLVMIR
1313
MLIRLoopToStandard
14+
MLIRPass
15+
MLIRStandardOps
1416
MLIRStandardToLLVM
1517
MLIRVectorToLLVM
1618
MLIRTransforms
1719
LLVMCore
1820
LLVMSupport
1921
)
20-
21-
add_dependencies(MLIRLinalgToLLVM ${LIBS})
22-
target_link_libraries(MLIRLinalgToLLVM ${LIBS})

mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ add_mlir_conversion_library(MLIRLinalgToSPIRVTransforms
55
ADDITIONAL_HEADER_DIRS
66
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
77
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
8-
)
98

10-
target_link_libraries(MLIRLinalgToSPIRVTransforms
9+
LINK_LIBS
1110
MLIRIR
1211
MLIRLinalgOps
1312
MLIRLinalgUtils
1413
MLIRPass
1514
MLIRSPIRV
1615
MLIRSupport
16+
MLIRTransforms
17+
MLIRTransformUtils
18+
LLVMSupport
1719
)

mlir/lib/Conversion/LoopToStandard/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ add_mlir_conversion_library(MLIRLoopToStandard
33

44
ADDITIONAL_HEADER_DIRS
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopToStandard
6-
)
7-
add_dependencies(
8-
MLIRLoopToStandard
96

7+
LINK_LIBS
8+
MLIRIR
109
MLIRLoopOps
10+
MLIRPass
11+
MLIRStandardOps
1112
MLIRTransforms
1213
LLVMCore
1314
LLVMSupport
14-
)
15-
target_link_libraries(
15+
)
16+
add_dependencies(
1617
MLIRLoopToStandard
1718

1819
MLIRLoopOps

mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ set(LIBS
44
MLIRGPU
55
MLIRIR
66
MLIRLinalgOps
7+
MLIRLoopOps
78
MLIRPass
89
MLIRStandardOps
910
MLIRSupport
1011
MLIRTransforms
12+
MLIRTransformUtils
1113
LLVMSupport
1214
)
1315

@@ -17,6 +19,8 @@ add_mlir_conversion_library(MLIRLoopsToGPU
1719

1820
ADDITIONAL_HEADER_DIRS
1921
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopsToGPU
20-
)
22+
23+
LINK_LIBS
24+
${LIBS}
25+
)
2126
add_dependencies(MLIRLoopsToGPU ${LIBS})
22-
target_link_libraries(MLIRLoopsToGPU ${LIBS})

mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ add_mlir_conversion_library(MLIRStandardToLLVM
33

44
ADDITIONAL_HEADER_DIRS
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/StandardToLLVM
6-
)
7-
add_dependencies(
8-
MLIRStandardToLLVM
96

7+
LINK_LIBS
8+
MLIRIR
109
MLIRLLVMIR
10+
MLIRPass
11+
MLIRStandardOps
1112
MLIRTransforms
1213
LLVMCore
1314
LLVMSupport
14-
)
15-
target_link_libraries(
15+
)
16+
add_dependencies(
1617
MLIRStandardToLLVM
1718

1819
MLIRLLVMIR

mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ add_mlir_conversion_library(MLIRStandardToSPIRVTransforms
1010
ADDITIONAL_HEADER_DIRS
1111
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
1212
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
13-
)
14-
15-
add_dependencies(MLIRStandardToSPIRVTransforms
16-
MLIRStandardToSPIRVIncGen)
1713

18-
target_link_libraries(MLIRStandardToSPIRVTransforms
14+
LINK_LIBS
1915
MLIRIR
2016
MLIRPass
2117
MLIRSPIRV
2218
MLIRSupport
19+
MLIRTransforms
2320
MLIRTransformUtils
2421
MLIRSPIRV
2522
MLIRStandardOps
23+
LLVMSupport
2624
)
25+
26+
add_dependencies(MLIRStandardToSPIRVTransforms
27+
MLIRStandardToSPIRVIncGen)

mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ add_mlir_conversion_library(MLIRVectorToLLVM
33

44
ADDITIONAL_HEADER_DIRS
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLLVM
6-
)
7-
set(LIBS
6+
7+
LINK_LIBS
8+
MLIRIR
89
MLIRLLVMIR
10+
MLIRPass
11+
MLIRStandardOps
912
MLIRStandardToLLVM
1013
MLIRVectorOps
1114
MLIRTransforms
15+
MLIRTransformUtils
1216
LLVMCore
1317
LLVMSupport
14-
)
15-
16-
add_dependencies(MLIRVectorToLLVM ${LIBS})
17-
target_link_libraries(MLIRVectorToLLVM ${LIBS})
18+
)

mlir/lib/Conversion/VectorToLoops/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ add_mlir_conversion_library(MLIRVectorToLoops
33

44
ADDITIONAL_HEADER_DIRS
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLoops
6-
)
7-
set(LIBS
6+
7+
LINK_LIBS
8+
MLIRAffineOps
89
MLIREDSC
10+
MLIRIR
911
MLIRLLVMIR
12+
MLIRLoopOps
13+
MLIRStandardOps
1014
MLIRTransforms
15+
MLIRTransformUtils
16+
MLIRVectorOps
1117
LLVMCore
1218
LLVMSupport
1319
)
14-
15-
add_dependencies(MLIRVectorToLoops ${LIBS})
16-
target_link_libraries(MLIRVectorToLoops ${LIBS})

mlir/lib/Dialect/AffineOps/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ add_mlir_dialect_library(MLIRAffineOps
55

66
ADDITIONAL_HEADER_DIRS
77
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/AffineOps
8-
)
9-
add_dependencies(MLIRAffineOps
108

11-
MLIRAffineOpsIncGen
9+
LINK_LIBS
1210
MLIREDSC
1311
MLIRIR
14-
MLIRLoopLikeInterfaceIncGen
1512
MLIRStandardOps
13+
LLVMSupport
1614
)
17-
target_link_libraries(MLIRAffineOps
15+
add_dependencies(MLIRAffineOps
1816

17+
MLIRAffineOpsIncGen
1918
MLIREDSC
2019
MLIRIR
20+
MLIRLoopLikeInterfaceIncGen
2121
MLIRStandardOps
2222
)

0 commit comments

Comments
 (0)