mirror of https://github.com/llvm/torch-mlir
54 lines
1.5 KiB
CMake
54 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
if(POLICY CMP0068)
|
|
cmake_policy(SET CMP0068 NEW)
|
|
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
|
|
endif()
|
|
|
|
if(POLICY CMP0075)
|
|
cmake_policy(SET CMP0075 NEW)
|
|
endif()
|
|
|
|
if(POLICY CMP0077)
|
|
cmake_policy(SET CMP0077 NEW)
|
|
endif()
|
|
|
|
project(npcomp LANGUAGES CXX C)
|
|
|
|
find_package(MLIR REQUIRED CONFIG)
|
|
|
|
message(STATUS "Using MLIRConfig.cmake in: ${MLIR_DIR}")
|
|
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")
|
|
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
|
|
include(TableGen)
|
|
include(AddLLVM)
|
|
include(AddMLIR)
|
|
include(HandleLLVMOptions)
|
|
|
|
include_directories(${LLVM_INCLUDE_DIRS})
|
|
include_directories(${MLIR_INCLUDE_DIRS})
|
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
|
include_directories(${PROJECT_BINARY_DIR}/include)
|
|
link_directories(${LLVM_BUILD_LIBRARY_DIR})
|
|
add_definitions(${LLVM_DEFINITIONS})
|
|
|
|
set(MLIR_NPCOMP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
set(MLIR_NPCOMP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
# TODO(laurenzo): Rationalize with how this is done elsewhere
|
|
find_package(PythonInterp REQUIRED)
|
|
find_package(PythonLibs REQUIRED)
|
|
message(STATUS "Found python include dirs: ${PYTHON_INCLUDE_DIRS}")
|
|
message(STATUS "Found ppython libraries: ${PYTHON_LIBRARIES}")
|
|
find_package(pybind11 CONFIG REQUIRED)
|
|
message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
|
|
|
|
add_subdirectory(include/npcomp)
|
|
add_subdirectory(lib)
|
|
add_subdirectory(python)
|
|
add_subdirectory(python_native)
|
|
add_subdirectory(tools)
|
|
add_subdirectory(test)
|