[MLIR][CAPI] On MINGW don't link against libMLIR
authorValentin Churavy <v.churavy@gmail.com>
Sun, 18 Jul 2021 10:05:46 +0000 (12:05 +0200)
committerValentin Churavy <v.churavy@gmail.com>
Sun, 18 Jul 2021 10:06:12 +0000 (12:06 +0200)
commit0c164ea9e6879732f9a9ed8d45b7780d7b58edf7
tree6aac44b7103e3b0b99c6589536ecc16def869d13
parent0cd98bef1b6feec067a4c60df4df4d44a842811d
[MLIR][CAPI] On MINGW don't link against libMLIR

Cross-compiling MLIR with MINGW failed because adding libMLIR to the libraries to link against would lead to duplicated symbols.

```
[09:28:14] ninja: job failed: : && /opt/bin/i686-w64-mingw32-libgfortran4-cxx03/i686-w64-mingw32-g++ --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/  -remap -D__USING_SJLJ_EXCEPTIONS__ -D__CRT__NO_INLINE -fno-gnu-unique -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment  -O2 -DNDEBUG   -shared -o bin/libMLIRPublicAPI.dll -Wl,--out-implib,lib/libMLIRPublicAPI.dll.a -Wl,--major-image-version,0,--minor-image-version,0 tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/AffineExpr.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/AffineMap.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/BuiltinAttributes.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/BuiltinTypes.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/Diagnostics.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/IntegerSet.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/IR.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/Pass.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/Support.cpp.obj tools/mlir/lib/CAPI/Registration/CMakeFiles/obj.MLIRCAPIRegistration.dir/Registration.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPILinalg.dir/Linalg.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPISCF.dir/SCF.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPIShape.dir/Shape.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPIStandard.dir/Standard.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPITensor.dir/Tensor.cpp.obj tools/mlir/lib/CAPI/Transforms/CMakeFiles/obj.MLIRCAPITransforms.dir/Passes.cpp.obj  lib/libMLIR.dll.a  lib/libMLIRIR.a  lib/libMLIRParser.a  lib/libMLIRSupport.a  lib/libMLIRPass.a  lib/libMLIRCAPIIR.a  lib/libMLIRAffine.a  lib/libMLIRAffineEDSC.a  lib/libMLIRAffineTransforms.a  lib/libMLIRAffineUtils.a  lib/libMLIRArmNeon.a  lib/libMLIRArmSVE.a  lib/libMLIRAsync.a  lib/libMLIRAsyncTransforms.a  lib/libMLIRAVX512.a  lib/libMLIRComplex.a  lib/libMLIRGPU.a  lib/libMLIRLinalgAnalysis.a  lib/libMLIRLinalgEDSC.a  lib/libMLIRLinalg.a  lib/libMLIRLinalgTransforms.a  lib/libMLIRLinalgUtils.a  lib/libMLIRLLVMIRTransforms.a  lib/libMLIRLLVMIR.a  lib/libMLIRLLVMAVX512.a  lib/libMLIRLLVMArmNeon.a  lib/libMLIRLLVMArmSVE.a  lib/libMLIRNVVMIR.a  lib/libMLIRROCDLIR.a  lib/libMLIROpenACC.a  lib/libMLIROpenMP.a  lib/libMLIRPDL.a  lib/libMLIRPDLInterp.a  lib/libMLIRQuant.a  lib/libMLIRSCF.a  lib/libMLIRSCFTransforms.a  lib/libMLIRSDBM.a  lib/libMLIRShape.a  lib/libMLIRShapeOpsTransforms.a  lib/libMLIRSPIRV.a  lib/libMLIRSPIRVModuleCombiner.a  lib/libMLIRSPIRVConversion.a  lib/libMLIRSPIRVTransforms.a  lib/libMLIRSPIRVUtils.a  lib/libMLIRStandard.a  lib/libMLIRStandardOpsTransforms.a  lib/libMLIRTensor.a  lib/libMLIRTensorTransforms.a  lib/libMLIRTosa.a  lib/libMLIRTosaTransforms.a  lib/libMLIRVector.a  lib/libMLIRCAPIIR.a  lib/libMLIRLinalg.a  lib/libMLIRCAPIIR.a  lib/libMLIRSCF.a  lib/libMLIRCAPIIR.a  lib/libMLIRShape.a  lib/libMLIRCAPIIR.a  lib/libMLIRStandard.a  lib/libMLIRCAPIIR.a  lib/libMLIRTensor.a  lib/libMLIRTransforms.a  lib/libMLIRAsync.a  lib/libMLIRAffineUtils.a  lib/libMLIRLinalgAnalysis.a  lib/libMLIRLinalgEDSC.a  lib/libMLIRVectorToSCF.a  lib/libMLIRVectorToLLVM.a  lib/libMLIRArmNeonToLLVM.a  lib/libMLIRArmNeon.a  lib/libMLIRLLVMArmNeon.a  lib/libMLIRAVX512ToLLVM.a  lib/libMLIRAVX512.a  lib/libMLIRLLVMAVX512.a  lib/libMLIRArmSVEToLLVM.a  lib/libMLIRArmSVE.a  lib/libMLIRLLVMArmSVE.a  lib/libMLIRStandardToLLVM.a  lib/libMLIRTargetLLVMIRModuleTranslation.a  lib/libMLIRLLVMIRTransforms.a  lib/libMLIRLLVMIR.a  lib/libMLIROpenMP.a  lib/libMLIRTranslation.a  lib/libMLIRSPIRVConversion.a  lib/libMLIRSPIRV.a  lib/libMLIRParser.a  lib/libMLIRTransforms.a  lib/libMLIRVector.a  lib/libMLIRAffineEDSC.a  lib/libMLIRLinalg.a  lib/libMLIRCopyOpInterface.a  lib/libMLIRTosa.a  lib/libMLIRQuant.a  lib/libMLIRTransformUtils.a  lib/libMLIRLoopAnalysis.a  lib/libMLIRPresburger.a  lib/libMLIRRewrite.a  lib/libMLIRPDLToPDLInterp.a  lib/libMLIRPass.a  lib/libMLIRAnalysis.a  lib/libMLIRAffine.a  lib/libMLIRSCF.a  lib/libMLIRLoopLikeInterface.a  lib/libMLIRPDLInterp.a  lib/libMLIRPDL.a  lib/libMLIRInferTypeOpInterface.a  lib/libMLIRStandard.a  lib/libMLIRTensor.a  lib/libMLIREDSC.a  lib/libMLIRCastInterfaces.a  lib/libMLIRVectorInterfaces.a  lib/libMLIRSideEffectInterfaces.a  lib/libMLIRDialect.a  lib/libMLIRViewLikeInterface.a  lib/libMLIRCallInterfaces.a  lib/libMLIRControlFlowInterfaces.a  lib/libMLIRIR.a  lib/libMLIRSupport.a  lib/libLLVM.dll.a  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && :
[09:28:14] lib/libMLIRAffine.a(AffineOps.cpp.obj):AffineOps.cpp:(.text+0x1d600): multiple definition of `mlir::AffineDialect::initialize()'
[09:28:14] lib/libMLIR.dll.a(d008729.o):(.text+0x0): first defined here
[09:28:14] lib/libMLIRArmSVE.a(ArmSVEDialect.cpp.obj):ArmSVEDialect.cpp:(.text+0x5be0): multiple definition of `mlir::arm_sve::ArmSVEDialect::initialize()'
[09:28:14] lib/libMLIR.dll.a(d039020.o):(.text+0x0): first defined here
[09:28:14] lib/libMLIRAsync.a(Async.cpp.obj):Async.cpp:(.text+0xc0d0): multiple definition of `mlir::async::AsyncDialect::initialize()'
[09:28:14] lib/libMLIR.dll.a(d023173.o):(.text+0x0): first defined here
...
```

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D106169
mlir/lib/CAPI/CMakeLists.txt