[all-commits] [llvm/llvm-project] 7ca473: [MLIR] Add support for out of tree external projec...

stephenneuendorffer via All-commits all-commits at lists.llvm.org
Tue Mar 17 19:43:54 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ca473a27bd589457d427eee9187d49a88fc9b01
      https://github.com/llvm/llvm-project/commit/7ca473a27bd589457d427eee9187d49a88fc9b01
  Author: Stephen Neuendorffer <stephen.neuendorffer at xilinx.com>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M mlir/cmake/modules/CMakeLists.txt
    A mlir/cmake/modules/MLIRConfig.cmake.in

  Log Message:
  -----------
  [MLIR] Add support for out of tree external projects using MLIR

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




More information about the All-commits mailing list