2024-02-18 11:26:57 +01:00
|
|
|
cmake_minimum_required(VERSION 3.21)
|
|
|
|
project(Elna)
|
|
|
|
|
2024-02-22 21:29:25 +01:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
2024-02-18 11:26:57 +01:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
2024-02-25 15:16:19 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2024-02-22 21:29:25 +01:00
|
|
|
|
2024-03-03 13:11:39 +01:00
|
|
|
find_package(Boost COMPONENTS program_options REQUIRED)
|
2024-07-07 18:50:15 +02:00
|
|
|
find_package(FLEX REQUIRED)
|
|
|
|
find_package(BISON REQUIRED)
|
2024-03-03 13:11:39 +01:00
|
|
|
include_directories(${Boost_INCLUDE_DIR})
|
|
|
|
|
2024-04-06 16:10:07 +02:00
|
|
|
FLEX_TARGET(scanner source/scanner.l ${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp)
|
|
|
|
|
2024-03-07 09:15:11 +01:00
|
|
|
add_executable(elna cli/main.cpp
|
2024-03-06 07:51:56 +01:00
|
|
|
source/lexer.cpp include/elna/source/lexer.hpp
|
|
|
|
source/parser.cpp include/elna/source/parser.hpp
|
2024-05-01 10:39:18 +02:00
|
|
|
source/types.cpp include/elna/source/types.hpp
|
|
|
|
source/symbol_table.cpp include/elna/source/symbol_table.hpp
|
2024-03-07 09:15:11 +01:00
|
|
|
source/result.cpp include/elna/source/result.hpp
|
2024-03-14 08:52:45 +01:00
|
|
|
source/semantic.cpp include/elna/source/semantic.hpp
|
2024-04-18 12:15:26 +02:00
|
|
|
source/optimizer.cpp include/elna/source/optimizer.hpp
|
2024-03-07 09:15:11 +01:00
|
|
|
backend/riscv.cpp include/elna/backend/riscv.hpp
|
|
|
|
backend/target.cpp include/elna/backend/target.hpp
|
|
|
|
cli/cl.cpp include/elna/cli/cl.hpp
|
2024-04-06 16:10:07 +02:00
|
|
|
${FLEX_scanner_OUTPUTS}
|
2024-02-22 21:29:25 +01:00
|
|
|
)
|
2024-02-25 15:16:19 +01:00
|
|
|
target_include_directories(elna PRIVATE include)
|
2024-03-03 13:11:39 +01:00
|
|
|
target_link_libraries(elna LINK_PUBLIC ${Boost_LIBRARIES})
|
2024-07-07 18:50:15 +02:00
|
|
|
|
|
|
|
FLEX_TARGET(lexer parser/lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
|
|
|
|
BISON_TARGET(parser parser/parser.yy ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
|
|
|
|
add_flex_bison_dependency(lexer parser)
|
|
|
|
|
|
|
|
add_executable(test parser/main.cpp
|
|
|
|
source/lexer.cpp include/elna/source/lexer.hpp
|
|
|
|
source/parser.cpp include/elna/source/parser.hpp
|
|
|
|
source/types.cpp include/elna/source/types.hpp
|
|
|
|
source/symbol_table.cpp include/elna/source/symbol_table.hpp
|
|
|
|
source/result.cpp include/elna/source/result.hpp
|
|
|
|
source/semantic.cpp include/elna/source/semantic.hpp
|
|
|
|
source/optimizer.cpp include/elna/source/optimizer.hpp
|
|
|
|
${BISON_parser_OUTPUTS} ${FLEX_lexer_OUTPUTS}
|
|
|
|
)
|
|
|
|
target_include_directories(test PRIVATE ${CMAKE_CURRENT_BINARY_DIR} parser include)
|
|
|
|
# target_link_libraries(test ${FLEX_LIBRARIES})
|