mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-01 06:46:34 +00:00

LLVM has a documented mechanism for passing configuration information to an out of tree project using cmake. See https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project. This patch adds similar support for MLIR. Using this requires something like: cmake_minimum_required(VERSION 3.4.3) project(SimpleProject) find_package(MLIR REQUIRED CONFIG) include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${MLIR_INCLUDE_DIRS}) link_directories(${LLVM_BUILD_LIBRARY_DIR}) add_definitions(${LLVM_DEFINITIONS}) set(CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR} ${MLIR_CMAKE_DIR} ) include(AddLLVM) include(TableGen) include(AddMLIR) add_executable(test-opt test-opt.cpp) llvm_update_compile_flags(test-opt) get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) message(dialects=${dialect_libs}) set(LIBS ${dialect_libs} ${conversion_libs} MLIRLoopOpsTransforms MLIRLoopAnalysis MLIRAnalysis MLIRDialect MLIREDSC MLIROptLib MLIRParser MLIRPass MLIRQuantizerFxpMathConfig MLIRQuantizerSupport MLIRQuantizerTransforms MLIRSPIRV MLIRSPIRVTestPasses MLIRSPIRVTransforms MLIRTransforms MLIRTransformUtils MLIRTestDialect MLIRTestIR MLIRTestPass MLIRTestTransforms MLIRSupport MLIRIR MLIROptLib LLVMSupport LLVMCore LLVMAsmParser ) target_link_libraries(test-opt ${LIBS}) Differential Revision: https://reviews.llvm.org/D76047
Multi-Level Intermediate Representation
See https://mlir.llvm.org/ for more information.