6 changes: 4 additions & 2 deletions mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ add_mlir_conversion_library(MLIRLinalgToSPIRVTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
)

target_link_libraries(MLIRLinalgToSPIRVTransforms
LINK_LIBS
MLIRIR
MLIRLinalgOps
MLIRLinalgUtils
MLIRPass
MLIRSPIRV
MLIRSupport
MLIRTransforms
MLIRTransformUtils
LLVMSupport
)
17 changes: 5 additions & 12 deletions mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@ add_mlir_conversion_library(MLIRLoopToStandard

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopToStandard
)
add_dependencies(
MLIRLoopToStandard

LINK_LIBS
MLIRIR
MLIRLoopOps
MLIRPass
MLIRStandardOps
MLIRTransforms
LLVMCore
LLVMSupport
)
target_link_libraries(
MLIRLoopToStandard

MLIRLoopOps
MLIRTransforms
LLVMCore
LLVMSupport
)
)
23 changes: 11 additions & 12 deletions mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
set(LIBS
add_mlir_conversion_library(MLIRLoopsToGPU
LoopsToGPU.cpp
LoopsToGPUPass.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopsToGPU

LINK_LIBS
MLIRAffineOps
MLIRAffineToStandard
MLIRGPU
MLIRIR
MLIRLinalgOps
MLIRLoopOps
MLIRPass
MLIRStandardOps
MLIRSupport
MLIRTransforms
MLIRTransformUtils
LLVMSupport
)

add_mlir_conversion_library(MLIRLoopsToGPU
LoopsToGPU.cpp
LoopsToGPUPass.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopsToGPU
)
add_dependencies(MLIRLoopsToGPU ${LIBS})
target_link_libraries(MLIRLoopsToGPU ${LIBS})
)
17 changes: 5 additions & 12 deletions mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@ add_mlir_conversion_library(MLIRStandardToLLVM

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/StandardToLLVM
)
add_dependencies(
MLIRStandardToLLVM

LINK_LIBS
MLIRIR
MLIRLLVMIR
MLIRPass
MLIRStandardOps
MLIRTransforms
LLVMCore
LLVMSupport
)
target_link_libraries(
MLIRStandardToLLVM

MLIRLLVMIR
MLIRTransforms
LLVMCore
LLVMSupport
)
)
9 changes: 5 additions & 4 deletions mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ add_mlir_conversion_library(MLIRStandardToSPIRVTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
)

add_dependencies(MLIRStandardToSPIRVTransforms
MLIRStandardToSPIRVIncGen)
DEPENDS
MLIRStandardToSPIRVIncGen

target_link_libraries(MLIRStandardToSPIRVTransforms
LINK_LIBS
MLIRIR
MLIRPass
MLIRSPIRV
MLIRSupport
MLIRTransforms
MLIRTransformUtils
MLIRSPIRV
MLIRStandardOps
LLVMSupport
)
13 changes: 7 additions & 6 deletions mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ add_mlir_conversion_library(MLIRVectorToLLVM

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLLVM
)
set(LIBS

LINK_LIBS
MLIRIR
MLIRLLVMIR
MLIRPass
MLIRStandardOps
MLIRStandardToLLVM
MLIRVectorOps
MLIRTransforms
MLIRTransformUtils
LLVMCore
LLVMSupport
)

add_dependencies(MLIRVectorToLLVM ${LIBS})
target_link_libraries(MLIRVectorToLLVM ${LIBS})
)
13 changes: 8 additions & 5 deletions mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ add_mlir_conversion_library(MLIRVectorToLoops

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLoops
)
set(LIBS

LINK_LIBS
MLIRAffineOps
MLIREDSC
MLIRIR
MLIRLLVMIR
MLIRLoopOps
MLIRStandardOps
MLIRTransforms
MLIRTransformUtils
MLIRVectorOps
LLVMCore
LLVMSupport
)

add_dependencies(MLIRVectorToLoops ${LIBS})
target_link_libraries(MLIRVectorToLoops ${LIBS})
10 changes: 3 additions & 7 deletions mlir/lib/Dialect/AffineOps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ add_mlir_dialect_library(MLIRAffineOps

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/AffineOps
)
add_dependencies(MLIRAffineOps

DEPENDS
MLIRAffineOpsIncGen
MLIREDSC
MLIRIR
MLIRLoopLikeInterfaceIncGen
MLIRStandardOps
)
target_link_libraries(MLIRAffineOps

LINK_LIBS
MLIREDSC
MLIRIR
MLIRStandardOps
LLVMSupport
)
10 changes: 6 additions & 4 deletions mlir/lib/Dialect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ add_subdirectory(LoopOps)
add_subdirectory(OpenMP)
add_subdirectory(QuantOps)
add_subdirectory(SDBM)
add_subdirectory(Shape)
#add_subdirectory(Shape)
add_subdirectory(SPIRV)
add_subdirectory(StandardOps)
add_subdirectory(VectorOps)


set(LLVM_OPTIONAL_SOURCES
Traits.cpp
)

add_llvm_library(MLIRDialect
add_mlir_library(MLIRDialect
Traits.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect

LINK_LIBS
MLIRIR
LLVMSupport
)
target_link_libraries(MLIRDialect MLIRIR)
16 changes: 7 additions & 9 deletions mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ add_mlir_dialect_library(MLIRFxpMathOps

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/FxpMathOps
)

target_link_libraries(MLIRFxpMathOps
DEPENDS
MLIRFxpMathOpsIncGen

LINK_LIBS
MLIRQuantOps
MLIRIR
MLIRPass
MLIRSupport
MLIRStandardOps
MLIRTransforms
MLIRTransformUtils
LLVMSupport
)
add_dependencies(MLIRFxpMathOps
MLIRFxpMathOpsIncGen
MLIRQuantOps
MLIRIR
MLIRPass
MLIRSupport
MLIRStandardOps)
17 changes: 6 additions & 11 deletions mlir/lib/Dialect/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@ add_mlir_dialect_library(MLIRGPU

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/GPU
)
add_dependencies(MLIRGPU

DEPENDS
MLIRGPUOpsIncGen
MLIREDSC
MLIRIR
MLIRLLVMIR
MLIRLoopOps
MLIRSupport
MLIRTransformUtils
LLVMSupport)
target_link_libraries(MLIRGPU

LINK_LIBS
MLIREDSC
MLIRIR
MLIRLLVMIR
Expand All @@ -26,4 +20,5 @@ target_link_libraries(MLIRGPU
MLIRStandardOps
MLIRSupport
MLIRTransformUtils
LLVMSupport)
LLVMSupport
)
38 changes: 32 additions & 6 deletions mlir/lib/Dialect/LLVMIR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,50 @@ add_mlir_dialect_library(MLIRLLVMIR

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR

DEPENDS
MLIRLLVMOpsIncGen
MLIRLLVMConversionsIncGen

LINK_LIBS
LLVMAsmParser
LLVMCore
LLVMSupport
MLIRIR
MLIRSupport
)
add_dependencies(MLIRLLVMIR MLIRLLVMOpsIncGen MLIRLLVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
target_link_libraries(MLIRLLVMIR LLVMAsmParser LLVMCore LLVMSupport MLIRIR)

add_mlir_dialect_library(MLIRNVVMIR
IR/NVVMDialect.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR

DEPENDS
MLIRNVVMOpsIncGen
MLIRNVVMConversionsIncGen

LINK_LIBS
LLVMAsmParser
MLIRIR
MLIRLLVMIR
LLVMSupport
LLVMCore
)
add_dependencies(MLIRNVVMIR MLIRNVVMOpsIncGen MLIRNVVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
target_link_libraries(MLIRNVVMIR LLVMAsmParser MLIRIR MLIRLLVMIR LLVMSupport LLVMCore)

add_mlir_dialect_library(MLIRROCDLIR
IR/ROCDLDialect.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR

DEPENDS
MLIRROCDLOpsIncGen
MLIRROCDLConversionsIncGen

LINK_LIBS
LLVMAsmParser
LLVMCore
LLVMSupport
MLIRIR
)
add_dependencies(MLIRROCDLIR MLIRROCDLOpsIncGen MLIRROCDLConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
target_link_libraries(MLIRROCDLIR LLVMAsmParser LLVMCore LLVMSupport MLIRIR)
17 changes: 7 additions & 10 deletions mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
set(LIBS

MLIRLinalgOps
MLIRStandardOps
)


add_mlir_dialect_library(MLIRLinalgAnalysis
DependenceAnalysis.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg

DEPENDS
intrinsics_gen
)

add_dependencies(MLIRLinalgAnalysis ${LIBS})
target_link_libraries(MLIRLinalgAnalysis ${LIBS})
LINK_LIBS
MLIRIR
MLIRLinalgOps
MLIRStandardOps
LLVMSupport
)
23 changes: 10 additions & 13 deletions mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
set(LIBS

MLIREDSC
MLIRIR
MLIRAffineOps
MLIRLinalgOps
MLIRLoopOps
MLIRStandardOps
)

add_mlir_dialect_library(MLIRLinalgEDSC
Builders.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg

DEPENDS
intrinsics_gen
)

add_dependencies(MLIRLinalgEDSC ${LIBS})
target_link_libraries(MLIRLinalgEDSC ${LIBS})
LINK_LIBS
MLIREDSC
MLIRIR
MLIRAffineOps
MLIRLinalgOps
MLIRLoopOps
MLIRStandardOps
LLVMSupport
)
17 changes: 7 additions & 10 deletions mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
set(LIBS

MLIRIR
MLIRStandardOps
)

add_mlir_dialect_library(MLIRLinalgOps
LinalgOps.cpp
LinalgTypes.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg

DEPENDS
intrinsics_gen
)

LINK_LIBS
MLIRIR
MLIRStandardOps
MLIRSupport
LLVMSupport
)
add_dependencies(MLIRLinalgOps

${LIBS}
MLIRLinalgOpsIncGen
MLIRLinalgStructuredOpsIncGen
MLIRLinalgStructuredOpsInterfaceIncGen
)
target_link_libraries(MLIRLinalgOps ${LIBS})
36 changes: 15 additions & 21 deletions mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
set(LIBS
add_mlir_dialect_library(MLIRLinalgTransforms
Fusion.cpp
LinalgTransforms.cpp
LinalgToLoops.cpp
Promotion.cpp
Tiling.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg

DEPENDS
intrinsics_gen
MLIRLinalgTransformPatternsIncGen

LINK_LIBS
MLIRAffineOps
MLIRAnalysis
MLIREDSC
Expand All @@ -14,24 +27,5 @@ set(LIBS
MLIRStandardToLLVM
MLIRTransformUtils
MLIRVectorOps
LLVMSupport
)

add_mlir_dialect_library(MLIRLinalgTransforms
Fusion.cpp
LinalgTransforms.cpp
LinalgToLoops.cpp
Promotion.cpp
Tiling.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
DEPENDS
intrinsics_gen
)

add_dependencies(MLIRLinalgTransforms

${LIBS}
MLIRLinalgTransformPatternsIncGen
)
target_link_libraries(MLIRLinalgTransforms ${LIBS})
25 changes: 11 additions & 14 deletions mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
set(LIBS
add_mlir_dialect_library(MLIRLinalgUtils
Utils.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg

DEPENDS
intrinsics_gen

LINK_LIBS
MLIRAffineOps
MLIREDSC
MLIRIR
MLIRLinalgOps
MLIRLoopOps
MLIRPass
MLIRStandardOps
MLIRTransformUtils
LLVMSupport
)

add_mlir_dialect_library(MLIRLinalgUtils

Utils.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
DEPENDS
intrinsics_gen
)

add_dependencies(MLIRLinalgUtils ${LIBS})
target_link_libraries(MLIRLinalgUtils ${LIBS})
9 changes: 2 additions & 7 deletions mlir/lib/Dialect/LoopOps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ add_mlir_dialect_library(MLIRLoopOps

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/LoopOps
)
add_dependencies(MLIRLoopOps

MLIREDSC
DEPENDS
MLIRLoopLikeInterfaceIncGen
MLIRLoopOpsIncGen
MLIRStandardOps
LLVMSupport
)
target_link_libraries(MLIRLoopOps

LINK_LIBS
MLIREDSC
MLIRIR
MLIRStandardOps
Expand Down
8 changes: 6 additions & 2 deletions mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ add_mlir_dialect_library(MLIRLoopOpsTransforms

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LoopOps
)

target_link_libraries(MLIRLoopOpsTransforms
LINK_LIBS
MLIRAffineOps
MLIRIR
MLIRPass
MLIRLoopOps
MLIRStandardOps
MLIRSupport
LLVMSupport
)
11 changes: 8 additions & 3 deletions mlir/lib/Dialect/OpenMP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ add_mlir_dialect_library(MLIROpenMP

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenMP
)

add_dependencies(MLIROpenMP MLIROpenMPOpsIncGen)
target_link_libraries(MLIROpenMP MLIRIR)
DEPENDS
MLIROpenMPOpsIncGen

LINK_LIBS
MLIRIR
LLVMCore
LLVMSupport
)
13 changes: 5 additions & 8 deletions mlir/lib/Dialect/QuantOps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@ add_mlir_dialect_library(MLIRQuantOps

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/QuantOps
)
add_dependencies(MLIRQuantOps
MLIRIR
MLIRPass
MLIRQuantOpsIncGen
MLIRSupport
MLIRStandardOps)

target_link_libraries(MLIRQuantOps
DEPENDS
MLIRQuantOpsIncGen

LINK_LIBS
MLIRIR
MLIRPass
MLIRSupport
MLIRStandardOps
MLIRTransformUtils
LLVMSupport
)
9 changes: 6 additions & 3 deletions mlir/lib/Dialect/SDBM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ add_mlir_dialect_library(MLIRSDBM

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SDBM
)
add_dependencies(MLIRSDBM MLIRIR)
target_link_libraries(MLIRSDBM MLIRIR)

LINK_LIBS
MLIRIR
MLIRSupport
LLVMSupport
)
12 changes: 7 additions & 5 deletions mlir/lib/Dialect/SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,24 @@ add_mlir_dialect_library(MLIRSPIRV

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
)

add_dependencies(MLIRSPIRV
DEPENDS
MLIRSPIRVAvailabilityIncGen
MLIRSPIRVCanonicalizationIncGen
MLIRSPIRVEnumAvailabilityIncGen
MLIRSPIRVEnumsIncGen
MLIRSPIRVOpsIncGen
MLIRSPIRVOpUtilsGen
MLIRSPIRVTargetAndABIIncGen)
MLIRSPIRVTargetAndABIIncGen

target_link_libraries(MLIRSPIRV
LINK_LIBS
MLIRIR
MLIRParser
MLIRStandardOps
MLIRSupport
MLIRTransforms)
MLIRTransforms
LLVMSupport
)

add_subdirectory(Serialization)
add_subdirectory(Transforms)
12 changes: 7 additions & 5 deletions mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ add_mlir_dialect_library(MLIRSPIRVSerialization

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
)

add_dependencies(MLIRSPIRVSerialization
MLIRSPIRVSerializationGen)
DEPENDS
MLIRSPIRVSerializationGen

target_link_libraries(MLIRSPIRVSerialization
LINK_LIBS
MLIRIR
MLIRParser
MLIRSPIRV
MLIRSupport
MLIRTranslation)
MLIRTranslation
LLVMSupport
)
8 changes: 6 additions & 2 deletions mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ add_mlir_dialect_library(MLIRSPIRVTransforms

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
)

target_link_libraries(MLIRSPIRVTransforms
LINK_LIBS
MLIRIR
MLIRPass
MLIRSPIRV
MLIRStandardOps
MLIRTransforms
MLIRTransformUtils
LLVMSupport
)
11 changes: 4 additions & 7 deletions mlir/lib/Dialect/StandardOps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ add_mlir_dialect_library(MLIRStandardOps

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/StandardOps
)
add_dependencies(MLIRStandardOps

DEPENDS
MLIRCallOpInterfacesIncGen
MLIREDSC
MLIRIR
MLIRStandardOpsIncGen
LLVMSupport
)
target_link_libraries(MLIRStandardOps

LINK_LIBS
MLIREDSC
MLIRIR
MLIRSupport
LLVMCore
LLVMSupport
)
16 changes: 12 additions & 4 deletions mlir/lib/Dialect/VectorOps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ add_mlir_dialect_library(MLIRVectorOps

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/VectorOps
)

add_dependencies(MLIRVectorOps MLIRVectorOpsIncGen)
add_dependencies(MLIRVectorOps MLIRVectorTransformPatternsIncGen)
DEPENDS
MLIRVectorOpsIncGen
MLIRVectorTransformPatternsIncGen

target_link_libraries(MLIRVectorOps MLIRIR MLIRStandardOps MLIRAffineOps MLIRLoopOps MLIRLoopAnalysis)
LINK_LIBS
MLIREDSC
MLIRIR
MLIRStandardOps
MLIRAffineOps
MLIRLoopOps
MLIRLoopAnalysis
LLVMSupport
)
16 changes: 7 additions & 9 deletions mlir/lib/EDSC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,27 @@ set(LLVM_OPTIONAL_SOURCES
CoreAPIs.cpp
)

add_llvm_library(MLIREDSC
add_mlir_library(MLIREDSC
Builders.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/EDSC
)
target_link_libraries(MLIREDSC
PUBLIC

LINK_LIBS
MLIRIR
MLIRSupport
LLVMSupport
)

add_llvm_library(MLIREDSCInterface
add_mlir_library(MLIREDSCInterface
CoreAPIs.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/EDSC
)
add_dependencies(MLIREDSCInterface MLIRIR)
target_link_libraries(MLIREDSCInterface
PUBLIC

LINK_LIBS
MLIRIR
MLIRSupport
MLIRParser
LLVMSupport
)
12 changes: 7 additions & 5 deletions mlir/lib/ExecutionEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ set(LLVM_OPTIONAL_SOURCES
)

llvm_map_components_to_libnames(outlibs "nativecodegen" "IPO")
add_llvm_library(MLIRExecutionEngine
add_mlir_library(MLIRExecutionEngine
ExecutionEngine.cpp
OptUtils.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/ExecutionEngine
)
target_link_libraries(MLIRExecutionEngine

LINK_LIBS
MLIRIR
MLIRLLVMIR
MLIRSupport
MLIRTargetLLVMIR
LLVMBitReader
LLVMBitWriter
LLVMCore
LLVMExecutionEngine
LLVMObject
LLVMOrcJIT
Expand All @@ -32,8 +34,8 @@ target_link_libraries(MLIRExecutionEngine
LLVMTarget
LLVMVectorize
LLVMTransformUtils

${outlibs})
${outlibs}
)

add_llvm_library(mlir_c_runner_utils SHARED CRunnerUtils.cpp)
target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS)
Expand Down
13 changes: 10 additions & 3 deletions mlir/lib/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
file(GLOB globbed *.c *.cpp)
add_llvm_library(MLIRIR
add_mlir_library(MLIRIR
${globbed}

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR

DEPENDS
MLIRCallOpInterfacesIncGen
MLIROpAsmInterfacesIncGen

LINK_LIBS
MLIRSupport
LLVMSupport
${LLVM_PTHREAD_LIB}
)
add_dependencies(MLIRIR MLIRCallOpInterfacesIncGen MLIROpAsmInterfacesIncGen MLIRSupport LLVMSupport)
target_link_libraries(MLIRIR MLIRSupport LLVMSupport)
9 changes: 6 additions & 3 deletions mlir/lib/Parser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
add_llvm_library(MLIRParser
add_mlir_library(MLIRParser
Lexer.cpp
Parser.cpp
Token.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Parser

LINK_LIBS
MLIRIR
MLIRAnalysis
LLVMSupport
)
add_dependencies(MLIRParser MLIRIR MLIRAnalysis)
target_link_libraries(MLIRParser MLIRIR MLIRAnalysis)
11 changes: 8 additions & 3 deletions mlir/lib/Pass/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
file(GLOB globbed *.c *.cpp)
add_llvm_library(MLIRPass
add_mlir_library(MLIRPass
${globbed}

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass

LINK_LIBS
MLIRAnalysis
MLIRIR
MLIRSupport
LLVMIRReader
LLVMSupport
)
add_dependencies(MLIRPass MLIRAnalysis MLIRIR LLVMSupport)
target_link_libraries(MLIRPass MLIRAnalysis MLIRIR LLVMSupport)
36 changes: 15 additions & 21 deletions mlir/lib/Quantizer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Support.
add_llvm_library(MLIRQuantizerSupport
add_mlir_library(MLIRQuantizerSupport
Support/Configuration.cpp
Support/ConstraintAnalysisGraph.cpp
Support/Metadata.cpp
Expand All @@ -9,14 +9,8 @@ add_llvm_library(MLIRQuantizerSupport
Support/UniformSolvers.cpp

ADDITIONAL_HEADER_DIRS
)

add_dependencies(MLIRQuantizerSupport
MLIRIR
MLIRQuantOps
MLIRSupport
MLIRStandardOps)
target_link_libraries(MLIRQuantizerSupport
LINK_LIBS
MLIRIR
MLIRQuantOps
MLIRSupport
Expand All @@ -25,39 +19,39 @@ target_link_libraries(MLIRQuantizerSupport
)

# Configurations.
add_llvm_library(MLIRQuantizerFxpMathConfig
add_mlir_library(MLIRQuantizerFxpMathConfig
Configurations/FxpMathConfig.cpp

ADDITIONAL_HEADER_DIRS
)

add_dependencies(MLIRQuantizerFxpMathConfig
MLIRFxpMathOpsIncGen
MLIRQuantizerSupport)
target_link_libraries(MLIRQuantizerFxpMathConfig
DEPENDS
MLIRFxpMathOpsIncGen

LINK_LIBS
MLIRIR
MLIRFxpMathOps
MLIRQuantOps
MLIRQuantizerSupport
MLIRStandardOps
MLIRSupport
LLVMSupport
)

# Transforms.
add_llvm_library(MLIRQuantizerTransforms
add_mlir_library(MLIRQuantizerTransforms
Transforms/AddDefaultStatsTestPass.cpp
Transforms/InferQuantizedTypesPass.cpp
Transforms/RemoveInstrumentationPass.cpp

ADDITIONAL_HEADER_DIRS
)
add_dependencies(MLIRQuantizerTransforms
MLIRQuantizerFxpMathConfig
MLIRQuantizerSupport
MLIRPass)
target_link_libraries(MLIRQuantizerTransforms

LINK_LIBS
MLIRIR
MLIRQuantizerFxpMathConfig
MLIRQuantizerSupport
MLIRQuantOps
MLIRPass
MLIRTransforms
MLIRTransformUtils
LLVMSupport
)
37 changes: 26 additions & 11 deletions mlir/lib/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,64 @@ set(LLVM_OPTIONAL_SOURCES
TranslateClParser.cpp
)

add_llvm_library(MLIRSupport
add_mlir_library(MLIRSupport
FileUtilities.cpp
StorageUniquer.cpp
ToolUtilities.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support

LINK_LIBS
LLVMSupport
${LLVM_PTHREAD_LIB}
)
target_link_libraries(MLIRSupport LLVMSupport ${LLVM_PTHREAD_LIB})

add_llvm_library(MLIROptLib
add_mlir_library(MLIROptLib
MlirOptMain.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
)
target_link_libraries(MLIROptLib

LINK_LIBS
MLIRIR
MLIRPass
MLIRParser
LLVMSupport
MLIRSupport
LLVMSupport
)

add_llvm_library(MLIRTranslateClParser
add_mlir_library(MLIRTranslateClParser
TranslateClParser.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support

LINK_LIBS
LLVMSupport
MLIRAnalysis
MLIRIR
MLIRTranslation
MLIRParser
)
target_link_libraries(MLIRTranslateClParser LLVMSupport MLIRIR MLIRTranslation MLIRParser)

add_llvm_library(MLIRJitRunner
JitRunner.cpp
)
target_link_libraries(MLIRJitRunner PRIVATE

LINK_LIBS
MLIRExecutionEngine
MLIRIR
MLIRLLVMIR
MLIRParser
MLIRStandardOps
MLIRTargetLLVMIR
MLIRTransforms
MLIRStandardToLLVM
MLIRSupport
LLVMCore
LLVMOrcJIT
LLVMSupport
)
LLVMX86CodeGen
LLVMX86Desc
LLVMX86Info
)
5 changes: 4 additions & 1 deletion mlir/lib/TableGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ add_llvm_library(LLVMMLIRTableGen

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/TableGen

LINK_LIBS
LLVMSupport
LLVMTableGen
)
target_link_libraries(LLVMMLIRTableGen LLVMSupport LLVMTableGen)
52 changes: 40 additions & 12 deletions mlir/lib/Target/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,50 +1,78 @@
add_llvm_library(MLIRTargetLLVMIRModuleTranslation
add_mlir_library(MLIRTargetLLVMIRModuleTranslation
LLVMIR/DebugTranslation.cpp
LLVMIR/ModuleTranslation.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR

DEPENDS
intrinsics_gen

LINK_LIBS
MLIRLLVMIR
LLVMCore
LLVMIRReader
LLVMSupport
LLVMTransformUtils
MLIRIR
MLIRSupport
MLIRTranslation
)
target_link_libraries(MLIRTargetLLVMIRModuleTranslation
MLIRLLVMIR LLVMCore LLVMIRReader LLVMSupport LLVMTransformUtils
MLIRTranslation)
add_llvm_library(MLIRTargetLLVMIR

add_mlir_library(MLIRTargetLLVMIR
LLVMIR/ConvertFromLLVMIR.cpp
LLVMIR/ConvertToLLVMIR.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR

LINK_LIBS
MLIRIR
MLIRLLVMIR
MLIRSupport
MLIRTargetLLVMIRModuleTranslation
MLIRTranslation
LLVMCore
LLVMIRReader
LLVMSupport
)
target_link_libraries(MLIRTargetLLVMIR MLIRTargetLLVMIRModuleTranslation)
add_llvm_library(MLIRTargetNVVMIR

add_mlir_library(MLIRTargetNVVMIR
LLVMIR/ConvertToNVVMIR.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR

DEPENDS
intrinsics_gen
)
target_link_libraries(MLIRTargetNVVMIR

LINK_LIBS
MLIRGPU
MLIRIR
MLIRLLVMIR
MLIRNVVMIR
MLIRTargetLLVMIRModuleTranslation
MLIRTranslation
LLVMCore
LLVMSupport
)
add_llvm_library(MLIRTargetROCDLIR

add_mlir_library(MLIRTargetROCDLIR
LLVMIR/ConvertToROCDLIR.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR

DEPENDS
intrinsics_gen
)
target_link_libraries(MLIRTargetROCDLIR

LINK_LIBS
MLIRGPU
MLIRIR
MLIRLLVMIR
MLIRROCDLIR
MLIRTargetLLVMIRModuleTranslation
MLIRTranslation
LLVMCore
LLVMSupport
)
15 changes: 10 additions & 5 deletions mlir/lib/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_subdirectory(Utils)

add_llvm_library(MLIRTransforms
add_mlir_library(MLIRTransforms
AffineDataCopyGeneration.cpp
AffineLoopInvariantCodeMotion.cpp
Canonicalizer.cpp
Expand All @@ -26,16 +26,21 @@ add_llvm_library(MLIRTransforms

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
)

add_dependencies(MLIRTransforms
DEPENDS
MLIRLoopLikeInterfaceIncGen
MLIRStandardOpsIncGen)
target_link_libraries(MLIRTransforms
MLIRStandardOpsIncGen

LINK_LIBS
MLIRAffineOps
MLIRAnalysis
MLIRIR
MLIRLoopOps
MLIRLoopAnalysis
MLIRPass
MLIRSupport
MLIRStandardOps
MLIRTransformUtils
MLIRVectorOps
LLVMSupport
)
11 changes: 7 additions & 4 deletions mlir/lib/Transforms/Utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_llvm_library(MLIRTransformUtils
add_mlir_library(MLIRTransformUtils
FoldUtils.cpp
GreedyPatternRewriteDriver.cpp
InliningUtils.cpp
Expand All @@ -9,14 +9,17 @@ add_llvm_library(MLIRTransformUtils

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
)

add_dependencies(MLIRTransformUtils MLIRStandardOpsIncGen)
target_link_libraries(MLIRTransformUtils
DEPENDS
MLIRStandardOpsIncGen

LINK_LIBS
MLIRAffineOps
MLIRAnalysis
MLIRIR
MLIRLoopAnalysis
MLIRLoopOps
MLIRPass
MLIRStandardOps
LLVMSupport
)
8 changes: 5 additions & 3 deletions mlir/lib/Translation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
add_llvm_library(MLIRTranslation
add_mlir_library(MLIRTranslation
Translation.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Translation
)
target_link_libraries(MLIRTranslation LLVMSupport)

LINK_LIBS
LLVMSupport
)
1 change: 1 addition & 0 deletions mlir/test/EDSC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ target_link_libraries(mlir-edsc-builder-api-test
MLIRStandardOps
MLIRTransforms
MLIRVectorOps
MLIRTransformUtils
LLVMCore
LLVMSupport
)
Expand Down
1 change: 1 addition & 0 deletions mlir/test/SDBM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target_link_libraries(mlir-sdbm-api-test
PRIVATE
MLIRIR
MLIRSDBM
MLIRSupport
LLVMCore
LLVMSupport
)
Expand Down
6 changes: 4 additions & 2 deletions mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ add_llvm_library(MLIRSPIRVTestPasses
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
)

target_link_libraries(MLIRSPIRVTestPasses PRIVATE
LINK_LIBS
MLIRIR
MLIRPass
MLIRSPIRV
MLIRSupport
MLIRTransforms
MLIRTransformUtils
LLVMSupport
)
12 changes: 6 additions & 6 deletions mlir/test/lib/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ add_llvm_library(MLIRTestIR
TestSymbolUses.cpp

ADDITIONAL_HEADER_DIRS

LINK_LIBS
MLIRIR
MLIRPass
MLIRStandardOps
LLVMSupport
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../TestDialect)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../TestDialect)
add_dependencies(MLIRTestIR
MLIRTestDialect
)
target_link_libraries(MLIRTestIR
MLIRPass
)
5 changes: 3 additions & 2 deletions mlir/test/lib/Pass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ add_llvm_library(MLIRTestPass

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
)
target_link_libraries(MLIRTestPass

LINK_LIBS
MLIRIR
MLIRPass
LLVMSupport
)
10 changes: 6 additions & 4 deletions mlir/test/lib/TestDialect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ add_public_tablegen_target(MLIRTestOpsIncGen)
add_llvm_library(MLIRTestDialect
TestDialect.cpp
TestPatterns.cpp
)
add_dependencies(MLIRTestDialect

DEPENDS
MLIRTestOpsIncGen
MLIRTypeInferOpInterfaceIncGen
)
target_link_libraries(MLIRTestDialect

LINK_LIBS
MLIRAnalysis
MLIRDialect
MLIRIR
MLIRLinalgTransforms
MLIRPass
MLIRStandardOps
MLIRTransforms
MLIRTransformUtils
LLVMSupport
Expand Down
26 changes: 16 additions & 10 deletions mlir/test/lib/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,33 @@ add_llvm_library(MLIRTestTransforms

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../TestDialect)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../TestDialect)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../DeclarativeTransforms)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../DeclarativeTransforms)
add_dependencies(MLIRTestTransforms MLIRStandardOpsIncGen)
add_dependencies(MLIRTestTransforms MLIRTestLinalgTransformPatternsIncGen)
add_dependencies(MLIRTestTransforms MLIRTestVectorTransformPatternsIncGen)
target_link_libraries(MLIRTestTransforms
DEPENDS
MLIRStandardOpsIncGen
MLIRTestLinalgTransformPatternsIncGen
MLIRTestVectorTransformPatternsIncGen

LINK_LIBS
MLIRAffineOps
MLIRAnalysis
MLIRLoopAnalysis
MLIREDSC
MLIRGPU
MLIRIR
MLIRLinalgOps
MLIRLinalgTransforms
MLIRLoopOps
MLIRGPU
MLIRPass
MLIRStandardOps
MLIRTestDialect
MLIRTransformUtils
MLIRVectorToLoops
MLIRVectorOps
)
LLVMSupport
)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../TestDialect)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../TestDialect)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../DeclarativeTransforms)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../DeclarativeTransforms)
6 changes: 4 additions & 2 deletions mlir/test/mlir-cpu-runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ set(LLVM_OPTIONAL_SOURCES
add_llvm_library(cblas SHARED cblas.cpp)
target_compile_definitions(cblas PRIVATE cblas_EXPORTS)

add_llvm_library(cblas_interface SHARED cblas_interface.cpp)
target_link_libraries(cblas_interface PRIVATE cblas)
add_llvm_library(cblas_interface SHARED cblas_interface.cpp
LINK_LIBS
cblas
)
target_compile_definitions(cblas_interface PRIVATE cblas_interface_EXPORTS)

1 change: 1 addition & 0 deletions mlir/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ add_subdirectory(mlir-opt)
add_subdirectory(mlir-tblgen)
add_subdirectory(mlir-translate)
add_subdirectory(mlir-vulkan-runner)
add_subdirectory(mlir-shlib)
5 changes: 4 additions & 1 deletion mlir/tools/mlir-cpu-runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ target_link_libraries(mlir-cpu-runner PRIVATE
MLIRSupport
LLVMCore
LLVMSupport
)
LLVMX86CodeGen
LLVMX86Desc
LLVMX86Info
)
14 changes: 8 additions & 6 deletions mlir/tools/mlir-cuda-runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ if(MLIR_CUDA_RUNNER_ENABLED)

add_llvm_library(cuda-runtime-wrappers SHARED
cuda-runtime-wrappers.cpp

LINK_LIBS
LLVMSupport
${CUDA_RUNTIME_LIBRARY}
)
target_include_directories(cuda-runtime-wrappers
PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
LLVMSupport
)
target_link_libraries(cuda-runtime-wrappers
LLVMSupport
${CUDA_RUNTIME_LIBRARY}
)

get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
Expand Down Expand Up @@ -68,8 +68,10 @@ if(MLIR_CUDA_RUNNER_ENABLED)

add_llvm_tool(mlir-cuda-runner
mlir-cuda-runner.cpp
)
add_dependencies(mlir-cuda-runner cuda-runtime-wrappers)

DEPENDS
cuda-runtime-wrappers
)
target_include_directories(mlir-cuda-runner
PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
)
Expand Down
8 changes: 5 additions & 3 deletions mlir/tools/mlir-opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ set(LLVM_OPTIONAL_SOURCES

set(LIB_LIBS
MLIRAnalysis
MLIRIR
MLIRLLVMIR
MLIROptLib
MLIRParser
MLIRPass
MLIRTransforms
MLIRSupport
)
LLVMSupport
)
add_llvm_library(MLIRMlirOptMain
mlir-opt.cpp
)
target_link_libraries(MLIRMlirOptMain

LINK_LIBS
${LIB_LIBS}
)

Expand Down
42 changes: 42 additions & 0 deletions mlir/tools/mlir-shlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Building libmlir-cpp.so fails if LLVM_ENABLE_PIC=Off
if (NOT LLVM_ENABLE_PIC)
return()
endif()

# Building libmlir-cpp.so may not work on MSVC
if (MSVC)
return()
endif()

get_property(mlir_libs GLOBAL PROPERTY MLIR_ALL_LIBS)
list(REMOVE_DUPLICATES mlir_libs)

foreach (lib ${mlir_libs})
if(XCODE)
# Xcode doesn't support object libraries, so we have to trick it into
# linking the static libraries instead.
list(APPEND _DEPS "-force_load" ${lib})
else()
list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
endif()
list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
endforeach ()

if(MLIR_LINK_MLIR_DYLIB)
set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
endif()

# libMLIR.so depends on LLVM components. To avoid multiple
# copies of those LLVM components, libMLIR.so depends on libLLVM.so.
# This probably won't work if some LLVM components are not included
# in libLLVM.so.
if(LLVM_BUILD_LLVM_DYLIB)
add_llvm_library(MLIR
SHARED
${INSTALL_WITH_TOOLCHAIN}

mlir-shlib.cpp
)
target_link_libraries(MLIR PRIVATE LLVM ${LLVM_PTHREAD_LIB})
whole_archive_link(MLIR ${mlir_libs})
endif()
1 change: 1 addition & 0 deletions mlir/tools/mlir-shlib/mlir-shlib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Intentionally empty source file to make CMake happy
5 changes: 4 additions & 1 deletion mlir/unittests/Dialect/SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ add_mlir_unittest(MLIRSPIRVTests
)
target_link_libraries(MLIRSPIRVTests
PRIVATE
MLIRIR
MLIRSPIRV
MLIRSPIRVSerialization)
MLIRSPIRVSerialization
MLIRStandardOps
MLIRSupport)

whole_archive_link(MLIRSPIRVTests MLIRSPIRV)

5 changes: 4 additions & 1 deletion mlir/unittests/Pass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ add_mlir_unittest(MLIRPassTests
)
target_link_libraries(MLIRPassTests
PRIVATE
MLIRPass)
MLIRIR
MLIRPass
MLIRStandardOps
MLIRSupport)
5 changes: 4 additions & 1 deletion mlir/unittests/SDBM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ add_mlir_unittest(MLIRSDBMTests
)
target_link_libraries(MLIRSDBMTests
PRIVATE
MLIRIR
MLIRSDBM
)
MLIRStandardOps
MLIRSupport
)
whole_archive_link(MLIRSDBMTests MLIRSDBM)