45 lines · plain
1get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)2get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)3 4include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)5include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)6 7# GCC, unlike clang, issues a warning when one virtual function is overridden8# in a derived class but one or more other virtual functions with the same9# name and different signature from a base class are not overridden. This10# leads to many warnings in the MLIR and ClangIR code when using the11# OpenConversionPattern<>::matchAndRewrite() function in the ordinary way.12# The "hiding" behavior is what we want, so we're just disabling the warning13# here.14if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))15 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual")16endif()17 18add_clang_tool(cir-opt19 cir-opt.cpp20)21 22clang_target_link_libraries(cir-opt23 PRIVATE24 clangCIR25 clangCIRLoweringDirectToLLVM26 MLIRCIR27 MLIRCIRTransforms28)29 30target_link_libraries(cir-opt31 PRIVATE32 ${dialect_libs}33 ${conversion_libs}34 MLIRAnalysis35 MLIRDialect36 MLIRIR37 MLIRMemRefDialect38 MLIROptLib39 MLIRParser40 MLIRPass41 MLIRSideEffectInterfaces42 MLIRTransforms43 MLIRTransformUtils44)45