85 lines
2.3 KiB
CMake
85 lines
2.3 KiB
CMake
cmake_minimum_required(VERSION 3.18...3.22)
|
|
project(sapphire-compiler LANGUAGES CXX C)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
find_package(LLVM REQUIRED CONFIG)
|
|
|
|
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
|
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
|
|
|
|
include_directories(${LLVM_INCLUDE_DIRS})
|
|
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
|
|
add_definitions(${LLVM_DEFINITIONS_LIST})
|
|
|
|
add_executable(
|
|
sapphirec
|
|
src/sapphire.cpp
|
|
src/Lexer.cpp
|
|
src/Lexer.h
|
|
src/Token.h
|
|
src/Token.cpp
|
|
src/Location.h
|
|
src/Location.cpp
|
|
src/Error.h
|
|
src/Error.cpp
|
|
src/external/FormatString/FormatString.hpp
|
|
src/FileIO.h
|
|
src/FileIO.cpp
|
|
src/Arguments.cpp
|
|
src/Arguments.h
|
|
src/AST/ASTNode.cpp
|
|
src/AST/ASTNode.h
|
|
src/AST/BinaryOpNode.cpp
|
|
src/AST/BinaryOpNode.h
|
|
src/AST/ExprNode.cpp
|
|
src/AST/ExprNode.h
|
|
src/AST/MulNode.cpp
|
|
src/AST/MulNode.h
|
|
src/AST/StatementNode.cpp
|
|
src/AST/StatementNode.h
|
|
src/AST/NumberNode.cpp
|
|
src/AST/NumberNode.h
|
|
src/AST/SumNode.cpp
|
|
src/AST/SumNode.h
|
|
src/AST/SyscallNode.cpp
|
|
src/AST/SyscallNode.h
|
|
src/AST/UnaryOpNode.cpp
|
|
src/AST/UnaryOpNode.h
|
|
src/AST/ProgramNode.cpp
|
|
src/AST/ProgramNode.h
|
|
src/AST/TopLevelNode.cpp
|
|
src/AST/TopLevelNode.h
|
|
src/AST/FunctionPrototype.cpp
|
|
src/AST/FunctionPrototype.h
|
|
src/AST/FunctionNode.cpp
|
|
src/AST/FunctionNode.h
|
|
src/AST/EmptyFunctionNode.cpp
|
|
src/AST/EmptyFunctionNode.h
|
|
src/GlobalContext.cpp
|
|
src/GlobalContext.h
|
|
src/utils.cpp
|
|
src/utils.h
|
|
src/Parser.cpp
|
|
src/Parser.h
|
|
src/sapphirepch.h
|
|
src/IRBuilder.cpp
|
|
src/IRBuilder.h
|
|
src/Result.h
|
|
)
|
|
|
|
target_include_directories(sapphirec PUBLIC src)
|
|
target_include_directories(sapphirec PUBLIC src/external/tclap-1.2.5/include)
|
|
target_include_directories(sapphirec PUBLIC src/external)
|
|
target_precompile_headers(sapphirec PUBLIC src/sapphirepch.h)
|
|
|
|
llvm_map_components_to_libnames(llvm_libs all core support irreader x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils)
|
|
|
|
target_link_libraries(sapphirec ${llvm_libs})
|
|
|
|
install(TARGETS sapphirec)
|
|
|
|
include_directories(src src/tclap-1.2.5/include)
|
|
|
|
include(cmake/clang-dev-tools.cmake) |