Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Commit 6beae9b

Browse files
Update CMakeLists.txt for shared library build
There are several circular dependencies between libraries. These are explicitly marked as STATIC. Note that add_llvm_library is redundant with add_dependencies, so we don't have to have libraries in both places.
1 parent 797757b commit 6beae9b

File tree

23 files changed

+77
-45
lines changed

23 files changed

+77
-45
lines changed

examples/Linalg/Linalg1/lib/CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ set(LIBS
1717
MLIRAnalysis
1818
MLIRControlFlowToCFG
1919
MLIREDSC
20+
MLIRLinalg
2021
MLIRLLVMIR
2122
MLIRParser
2223
MLIRPass
@@ -26,13 +27,13 @@ set(LIBS
2627
MLIRTransforms
2728
)
2829

29-
add_llvm_library(Linalg1LLVMConversion
30+
add_llvm_library(Linalg1LLVMConversion STATIC
3031
ConvertToLLVMDialect.cpp
3132
)
3233
target_link_libraries(Linalg1LLVMConversion PUBLIC MLIRLLVMIR
33-
MLIRControlFlowToCFG MLIRStandardOps)
34+
Linalg1 MLIRControlFlowToCFG MLIRStandardOps MLIRStandardToLLVM MLIRLinalg)
3435

35-
add_llvm_library(Linalg1
36+
add_llvm_library(Linalg1 STATIC
3637
Analysis.cpp
3738
SliceOp.cpp
3839
ViewOp.cpp

lib/Analysis/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ add_llvm_library(MLIRAnalysis STATIC
1616
ADDITIONAL_HEADER_DIRS
1717
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
1818
)
19-
add_dependencies(MLIRAnalysis MLIRAffineOps MLIRLoopOps)
20-
target_link_libraries(MLIRAnalysis MLIRAffineOps MLIRLoopOps)
19+
target_link_libraries(MLIRAnalysis MLIRAffineOps MLIRLoopOps MLIRPass)

lib/Conversion/GPUToNVVM/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ target_link_libraries(MLIRGPUtoNVVMTransforms
66
MLIRGPU
77
MLIRLLVMIR
88
MLIRNVVMIR
9+
MLIRStandardToLLVM
10+
MLIRTransforms
911
MLIRPass
1012
)

lib/Conversion/StandardToSPIRV/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ target_link_libraries(MLIRSPIRVConversion
1919
MLIRPass
2020
MLIRSPIRV
2121
MLIRSupport
22+
MLIRTransforms
2223
MLIRTransformUtils
2324
MLIRSPIRV
2425
MLIRStandardOps

lib/Conversion/VectorToLLVM/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_llvm_library(MLIRVectorToLLVM
66
)
77
set(LIBS
88
MLIRLLVMIR
9+
MLIRStandardToLLVM
910
MLIRTransforms
1011
LLVMCore
1112
LLVMSupport

lib/Dialect/AffineOps/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_llvm_library(MLIRAffineOps
1+
add_llvm_library(MLIRAffineOps STATIC
22
AffineOps.cpp
33
DialectRegistration.cpp
44

@@ -7,4 +7,3 @@ add_llvm_library(MLIRAffineOps
77
)
88
add_dependencies(MLIRAffineOps MLIRAffineOpsIncGen MLIRIR MLIRStandardOps)
99
target_link_libraries(MLIRAffineOps MLIRIR MLIRStandardOps)
10-

lib/Dialect/FxpMathOps/CMakeLists.txt

+10-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ add_llvm_library(MLIRFxpMathOps
66
ADDITIONAL_HEADER_DIRS
77
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/FxpMathOps
88
)
9-
add_dependencies(MLIRFxpMathOps
10-
MLIRFxpMathOpsIncGen
11-
MLIRQuantOps
12-
MLIRIR
13-
MLIRPass
14-
MLIRSupport
15-
MLIRStandardOps)
9+
add_dependencies(
10+
MLIRFxpMathOps
11+
MLIRFxpMathOpsIncGen)
12+
target_link_libraries(
13+
MLIRFxpMathOps
14+
MLIRQuantOps
15+
MLIRIR
16+
MLIRPass
17+
MLIRSupport
18+
MLIRStandardOps)

lib/Dialect/GPU/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ add_llvm_library(MLIRGPU
77
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/GPU
88
)
99
add_dependencies(MLIRGPU MLIRGPUOpsIncGen MLIRIR LLVMSupport)
10-
target_link_libraries(MLIRGPU MLIRIR MLIRStandardOps LLVMSupport)
10+
target_link_libraries(MLIRGPU MLIRIR MLIRPass MLIRStandardOps LLVMSupport)

lib/Dialect/LLVMIR/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ add_llvm_library(MLIRLLVMIR
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
66
)
77
add_dependencies(MLIRLLVMIR MLIRLLVMOpsIncGen MLIRLLVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
8-
target_link_libraries(MLIRLLVMIR LLVMAsmParser LLVMCore LLVMSupport)
8+
target_link_libraries(MLIRLLVMIR MLIRIR LLVMAsmParser LLVMCore LLVMSupport)
99

1010
add_llvm_library(MLIRNVVMIR
1111
IR/NVVMDialect.cpp
@@ -14,4 +14,4 @@ add_llvm_library(MLIRNVVMIR
1414
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
1515
)
1616
add_dependencies(MLIRNVVMIR MLIRNVVMOpsIncGen MLIRNVVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
17-
target_link_libraries(MLIRNVVMIR LLVMAsmParser LLVMCore LLVMSupport)
17+
target_link_libraries(MLIRNVVMIR MLIRLLVMIR MLIRIR LLVMAsmParser LLVMCore LLVMSupport)

lib/Dialect/Linalg/CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_llvm_library(MLIRLinalg
1+
add_llvm_library(MLIRLinalg STATIC
22
LinalgRegistration.cpp
33
Analysis/DependenceAnalysis.cpp
44
IR/LinalgOps.cpp
@@ -17,8 +17,12 @@ add_llvm_library(MLIRLinalg
1717

1818
add_dependencies(MLIRLinalg
1919

20-
MLIRAffineOps
2120
MLIRLinalgOpsIncGen
2221
MLIRLinalgLibraryOpsIncGen
22+
)
23+
target_link_libraries(MLIRLinalg
24+
25+
MLIRAffineOps
26+
MLIRIR
2327
MLIRStandardToLLVM
2428
)

lib/Dialect/LoopOps/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
file(GLOB globbed *.c *.cpp)
2-
add_llvm_library(MLIRLoopOps
2+
add_llvm_library(MLIRLoopOps STATIC
33
${globbed}
44

55
ADDITIONAL_HEADER_DIRS
66
${MLIR_MAIN_INCLUDE_DIR}/mlir/LoopOps
77
)
8-
add_dependencies(MLIRLoopOps MLIRLoopOpsIncGen MLIRStandardOps LLVMSupport)
9-
target_link_libraries(MLIRLoopOps LLVMSupport)
8+
add_dependencies(MLIRLoopOps MLIRLoopOpsIncGen MLIRStandardOps MLIRIR LLVMSupport)
9+
target_link_libraries(MLIRLoopOps MLIRStandardOps MLIRIR LLVMSupport)

lib/Dialect/QuantOps/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ add_dependencies(MLIRQuantOps
1919
MLIRQuantOpsIncGen
2020
MLIRSupport
2121
MLIRStandardOps)
22+
23+
target_link_libraries(MLIRQuantOps MLIRIR MLIRPass MLIRParser MLIRSupport MLIRTransforms MLIRAnalysis MLIRStandardOps LLVMSupport)

lib/Dialect/SPIRV/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ add_dependencies(MLIRSPIRV
1616
target_link_libraries(MLIRSPIRV
1717
MLIRIR
1818
MLIRParser
19-
MLIRSupport)
19+
MLIRSupport
20+
MLIRTranslation)
2021

2122
add_subdirectory(Serialization)

lib/Dialect/SPIRV/Serialization/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ add_dependencies(MLIRSPIRVSerialization
1515
target_link_libraries(MLIRSPIRVSerialization
1616
MLIRIR
1717
MLIRSPIRV
18-
MLIRSupport)
18+
MLIRSupport
19+
MLIRTranslation)
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
file(GLOB globbed *.c *.cpp)
2-
add_llvm_library(MLIRStandardOps
2+
add_llvm_library(MLIRStandardOps STATIC
33
${globbed}
44

55
ADDITIONAL_HEADER_DIRS
66
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/StandardOps
77
)
88
add_dependencies(MLIRStandardOps MLIRStandardOpsIncGen LLVMSupport)
9-
target_link_libraries(MLIRStandardOps LLVMSupport)
9+
target_link_libraries(MLIRStandardOps MLIRIR MLIRParser LLVMSupport)

lib/ExecutionEngine/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@ target_link_libraries(MLIRExecutionEngine
1111

1212
MLIRLLVMIR
1313
MLIRTargetLLVMIR
14+
Linalg1LLVMConversion
15+
LLVMAggressiveInstCombine
16+
LLVMAnalysis
1417
LLVMBitReader
1518
LLVMBitWriter
1619
LLVMExecutionEngine
20+
LLVMInstCombine
1721
LLVMOrcJIT
22+
LLVMMC
23+
LLVMScalarOpts
1824
LLVMSupport
25+
LLVMTarget
1926
LLVMTransformUtils
27+
LLVMVectorize
2028

2129
${outlibs})

lib/Parser/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_llvm_library(MLIRParser
1+
add_llvm_library(MLIRParser STATIC
22
Lexer.cpp
33
Parser.cpp
44
Token.cpp

lib/Pass/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
file(GLOB globbed *.c *.cpp)
2-
add_llvm_library(MLIRPass
2+
add_llvm_library(MLIRPass STATIC
33
${globbed}
44

55
ADDITIONAL_HEADER_DIRS
66
${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
77
)
8-
add_dependencies(MLIRPass MLIRAnalysis MLIRIR LLVMSupport)
8+
add_dependencies(MLIRPass MLIRIR LLVMSupport)
99
target_link_libraries(MLIRPass MLIRAnalysis MLIRIR LLVMSupport)

lib/Quantizer/CMakeLists.txt

+14-8
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@ add_llvm_library(MLIRQuantizerSupport
1010

1111
ADDITIONAL_HEADER_DIRS
1212
)
13-
add_dependencies(MLIRQuantizerSupport
14-
MLIRIR
15-
MLIRQuantOps
16-
MLIRSupport
17-
MLIRStandardOps)
13+
target_link_libraries(
14+
MLIRQuantizerSupport
15+
MLIRIR
16+
MLIRQuantOps
17+
MLIRSupport
18+
MLIRStandardOps)
1819

1920
# Configurations.
2021
add_llvm_library(MLIRQuantizerFxpMathConfig
2122
Configurations/FxpMathConfig.cpp
2223

2324
ADDITIONAL_HEADER_DIRS
2425
)
25-
add_dependencies(MLIRQuantizerFxpMathConfig
26-
MLIRFxpMathOpsIncGen
27-
MLIRQuantizerSupport)
26+
add_dependencies(
27+
MLIRQuantizerFxpMathConfig
28+
MLIRFxpMathOpsIncGen)
29+
target_link_libraries(
30+
MLIRQuantizerFxpMathConfig
31+
MLIRFxpMathOps
32+
MLIRIR
33+
MLIRQuantizerSupport)
2834

2935
# Transforms.
3036
add_llvm_library(MLIRQuantizerTransforms

lib/Support/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ add_llvm_library(MLIRSupport
1313
ADDITIONAL_HEADER_DIRS
1414
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
1515
)
16-
target_link_libraries(MLIRSupport LLVMSupport)
16+
target_link_libraries(MLIRSupport Threads::Threads LLVMSupport)
1717

1818
add_llvm_library(MLIROptMain
1919
MlirOptMain.cpp
2020

2121
ADDITIONAL_HEADER_DIRS
2222
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
2323
)
24-
target_link_libraries(MLIROptMain LLVMSupport)
24+
target_link_libraries(MLIROptMain MLIRIR MLIRParser LLVMSupport)
2525

2626
add_llvm_library(MLIRTranslateClParser
2727
TranslateClParser.cpp
2828

2929
ADDITIONAL_HEADER_DIRS
3030
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
3131
)
32-
target_link_libraries(MLIRTranslateClParser LLVMSupport)
32+
target_link_libraries(MLIRTranslateClParser MLIRTranslation MLIRIR MLIRAnalysis MLIRParser LLVMSupport)
3333

3434
add_llvm_library(MLIRJitRunner
3535
JitRunner.cpp

lib/Transforms/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ add_dependencies(MLIRTransforms MLIRStandardOpsIncGen)
3131
target_link_libraries(MLIRTransforms
3232
MLIRAffineOps
3333
MLIRAnalysis
34+
MLIREDSC
3435
MLIRLoopOps
3536
MLIRPass
3637
MLIRTransformUtils

test/lib/TestDialect/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ add_llvm_library(MLIRTestDialect
1515
)
1616
add_dependencies(MLIRTestDialect
1717
MLIRTestOpsIncGen
18-
MLIRIR
19-
LLVMSupport
2018
)
2119
target_link_libraries(MLIRTestDialect
2220
MLIRDialect
2321
MLIRIR
22+
MLIRPass
23+
MLIRTransforms
2424
LLVMSupport
2525
)

tools/mlir-opt/CMakeLists.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@ set(LLVM_OPTIONAL_SOURCES
33
)
44

55
set(LIB_LIBS
6+
Linalg1LLVMConversion
67
MLIRAnalysis
8+
MLIRIR
79
MLIRLLVMIR
10+
MLIROptMain
811
MLIRParser
912
MLIRPass
10-
MLIRTransforms
13+
MLIRQuantizerSupport
1114
MLIRSupport
15+
MLIRTransforms
1216
)
1317
add_llvm_library(MLIRMlirOptLib
1418
mlir-opt.cpp
1519
)
16-
target_link_libraries(MLIRMlirOptLib ${LIB_LIBS})
20+
target_link_libraries(MLIRMlirOptLib ${LIB_LIBS} MLIRIR)
1721

1822
set(LIBS
1923
MLIRAffineOps
@@ -40,7 +44,6 @@ set(LIBS
4044
MLIRStandardToLLVM
4145
MLIRTransforms
4246
MLIRTestDialect
43-
MLIRTestPass
4447
MLIRTestTransforms
4548
MLIRSupport
4649
MLIRVectorOps

0 commit comments

Comments
 (0)