cmake_minimum_required(VERSION 3.12.1)
project(autotensor LANGUAGES CXX)
set (MINDSPORE "${PROJECT_SOURCE_DIR}/../../..")
set (TVM_KERNEL_LITE "${PROJECT_SOURCE_DIR}/lite")
set (THIRDPARTY "${MINDSPORE}/third_party")
set (TVM_CLEAN_SOURCE "${THIRDPARTY}/incubator-tvm")
set (TVM_BUILD_SOURCE "${PROJECT_SOURCE_DIR}/incubator-tvm")
set (BUILD_DIR "${PROJECT_SOURCE_DIR}")
set (TVM_KERNEL_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
set (TVM_OUTPUT_DIR ${TVM_KERNEL_OUTPUT_DIR}/incubator-tvm)

set (LLVM_CONFIG  $ENV{LLVM_PATH})
if (NOT LLVM_CONFIG)
  message(FATAL_ERROR "please set LLVM_PATH in env")
endif()
set (CMAKE_BUILD_TYPE "Release")

include(${TVM_BUILD_SOURCE}/cmake/util/Util.cmake)
include(${TVM_BUILD_SOURCE}/cmake/util/FindLLVM.cmake)
if(EXISTS ${TVM_BUILD_SOURCE}/cmake/config.cmake)
  include(${TVM_BUILD_SOURCE}/cmake/config.cmake)
endif()
add_subdirectory(${TVM_KERNEL_LITE})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

