2024-12-21 00:08:48 +01:00
|
|
|
cmake_minimum_required(VERSION 3.21)
|
|
|
|
project(Elna)
|
|
|
|
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
2024-12-27 10:51:46 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2024-12-21 00:08:48 +01:00
|
|
|
|
2024-12-27 10:51:46 +01:00
|
|
|
find_package(Boost CONFIG COMPONENTS process program_options REQUIRED)
|
2024-12-21 00:08:48 +01:00
|
|
|
find_package(FLEX REQUIRED)
|
|
|
|
find_package(BISON REQUIRED)
|
|
|
|
|
2024-12-23 13:54:11 +01:00
|
|
|
FLEX_TARGET(lexer source/lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/lexer.cc)
|
|
|
|
BISON_TARGET(parser source/parser.yy ${CMAKE_CURRENT_BINARY_DIR}/parser.cc)
|
2024-12-21 00:08:48 +01:00
|
|
|
add_flex_bison_dependency(lexer parser)
|
|
|
|
|
2024-12-27 10:51:46 +01:00
|
|
|
add_library(elna-frontend
|
2024-12-23 13:54:11 +01:00
|
|
|
source/ast.cc include/elna/source/ast.h
|
|
|
|
source/types.cc include/elna/source/types.h
|
|
|
|
source/driver.cc include/elna/source/driver.h
|
|
|
|
source/symbol_table.cc include/elna/source/symbol_table.h
|
|
|
|
source/result.cc include/elna/source/result.h
|
|
|
|
source/semantic.cc include/elna/source/semantic.h
|
2024-12-21 00:08:48 +01:00
|
|
|
${BISON_parser_OUTPUTS} ${FLEX_lexer_OUTPUTS}
|
|
|
|
)
|
2024-12-27 10:51:46 +01:00
|
|
|
target_include_directories(elna-frontend PRIVATE ${CMAKE_CURRENT_BINARY_DIR} include)
|
|
|
|
target_compile_options(elna-frontend PRIVATE
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions -fno-rtti>
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(elna cli/main.cc)
|
|
|
|
target_link_libraries(elna PRIVATE elna-frontend)
|
|
|
|
target_include_directories(elna PRIVATE ${CMAKE_CURRENT_BINARY_DIR} include ${Boost_INCLUDE_DIR})
|
|
|
|
target_link_libraries(elna LINK_PUBLIC ${Boost_LIBRARIES})
|
|
|
|
target_compile_options(elna PRIVATE
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions -fno-rtti>
|
|
|
|
)
|