diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0c4cdfc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.12) +project(toyc) + +set(CMAKE_CXX_STANDARD 14) + +find_package(LLVM CONFIG PATHS "${MLIR_INSTALL_PREFIX}" NO_DEFAULT_PATH) + +if (LLVM_FOUND) + message(STATUS "Using LLVM ${LLVM_PACKAGE_VERSION} at ${LLVM_INSTALL_PREFIX}") +else() + message(FATAL_ERROR "LLVM not found; it is derived from MLIR_INSTALL_PREFIX which has value of ${MLIR_INSTALL_PREFIX}") +endif() + +llvm_map_components_to_libnames(llvm_libs support) + +if (NOT ${LLVM_ENABLE_RTTI}) + set(CMAKE_CXX_FLAGS "-fno-rtti ${CMAKE_CXX_FLAGS}") +endif() + +include_directories( + include + ${LLVM_INCLUDE_DIR}) + +link_directories(${LLVM_LIBRARY_DIR}) + +add_definitions(${LLVM_DEFINITIONS}) + +add_executable(toyc + toyc.cpp + parser/AST.cpp + mlir/EarlyLowering.cpp + mlir/LateLowering.cpp + mlir/MLIRGen.cpp + mlir/ShapeInferencePass.cpp + mlir/ToyDialect.cpp + mlir/ToyCombine.cpp + ) + +SET(WHOLE_ARCHIEVE -Wl,--whole-archive MLIRStandardOps MLIRAffineOps -Wl,--no-whole-archive) +target_link_libraries(toyc + PRIVATE + ${llvm_libs} + Linalg3DialectConstruction + Linalg3 + Linalg2 + Linalg1 + ${WHOLE_ARCHIEVE} + MLIRAnalysis + MLIREDSC + MLIRExecutionEngine + MLIRIR + MLIRLLVMIR + MLIRParser + MLIRPass + MLIRTargetLLVMIR + MLIRTransforms + MLIRSupport + ) |