2022-06-22 18:31:57 +00:00
|
|
|
cmake_minimum_required(VERSION 3.18...3.22)
|
2022-06-07 15:37:03 +00:00
|
|
|
project(sapphire-compiler LANGUAGES CXX C)
|
2022-03-11 16:00:09 +00:00
|
|
|
|
2022-06-22 18:31:57 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2022-03-11 16:00:09 +00:00
|
|
|
|
2022-06-07 15:37:03 +00:00
|
|
|
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})
|
|
|
|
|
2022-03-11 16:00:09 +00:00
|
|
|
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
|
2022-07-30 12:38:52 +00:00
|
|
|
src/external/FormatString/FormatString.hpp
|
2022-03-11 16:00:09 +00:00
|
|
|
src/FileIO.h
|
|
|
|
src/FileIO.cpp
|
|
|
|
src/Importer.cpp
|
|
|
|
src/Importer.h
|
|
|
|
src/Arguments.cpp
|
|
|
|
src/Arguments.h
|
|
|
|
src/Normalizer.cpp
|
|
|
|
src/Normalizer.h
|
2022-06-02 16:25:01 +00:00
|
|
|
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
|
2022-06-16 13:56:10 +00:00
|
|
|
src/AST/NumberNode.cpp
|
|
|
|
src/AST/NumberNode.h
|
2022-06-02 16:25:01 +00:00
|
|
|
src/AST/SumNode.cpp
|
|
|
|
src/AST/SumNode.h
|
2022-07-18 13:57:16 +00:00
|
|
|
src/AST/SyscallNode.cpp
|
|
|
|
src/AST/SyscallNode.h
|
2022-08-03 15:28:59 +00:00
|
|
|
src/AST/UnaryOpNode.cpp
|
|
|
|
src/AST/UnaryOpNode.h
|
2022-06-16 13:56:10 +00:00
|
|
|
src/utils.cpp
|
|
|
|
src/utils.h
|
2022-06-02 16:25:01 +00:00
|
|
|
src/Parser.cpp
|
|
|
|
src/Parser.h
|
2022-06-16 13:56:10 +00:00
|
|
|
src/sapphirepch.h
|
2022-07-15 12:28:05 +00:00
|
|
|
src/IRBuilder.cpp
|
|
|
|
src/IRBuilder.h
|
2022-07-30 12:54:25 +00:00
|
|
|
src/Result.h
|
2022-03-11 16:00:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(sapphirec PUBLIC src)
|
2022-07-30 12:38:52 +00:00
|
|
|
target_include_directories(sapphirec PUBLIC src/external/tclap-1.2.5/include)
|
|
|
|
target_include_directories(sapphirec PUBLIC src/external)
|
2022-06-16 13:56:10 +00:00
|
|
|
target_precompile_headers(sapphirec PUBLIC src/sapphirepch.h)
|
|
|
|
|
2022-06-07 15:37:03 +00:00
|
|
|
llvm_map_components_to_libnames(llvm_libs support core irreader)
|
|
|
|
|
|
|
|
# Link against LLVM libraries
|
|
|
|
target_link_libraries(sapphirec ${llvm_libs})
|
2022-06-22 18:31:57 +00:00
|
|
|
|
2022-07-19 12:18:53 +00:00
|
|
|
install(TARGETS sapphirec)
|
|
|
|
|
2022-07-19 13:11:24 +00:00
|
|
|
include_directories(src src/tclap-1.2.5/include)
|
|
|
|
|
2022-07-19 12:18:53 +00:00
|
|
|
include(cmake/clang-dev-tools.cmake)
|