2024-04-09 09:03:21 +00:00
|
|
|
find_package(Readline REQUIRED)
|
|
|
|
find_package(FLEX REQUIRED)
|
|
|
|
find_package(BISON REQUIRED)
|
2024-04-12 08:39:24 +00:00
|
|
|
find_package(LLVM CONFIG REQUIRED)
|
2024-04-09 09:03:21 +00:00
|
|
|
set(PARSER_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
set(LEXER_OUT "${PARSER_DIR}/lexer.c")
|
|
|
|
set(PARSER_OUT "${PARSER_DIR}/parser.c")
|
2024-04-12 06:08:52 +00:00
|
|
|
flex_target(LEXER addrexp.l "${LEXER_OUT}" DEFINES_FILE "${PARSER_DIR}/addrexp_lex.h")
|
|
|
|
bison_target(PARSER addrexp.y "${PARSER_OUT}" DEFINES_FILE "${PARSER_DIR}/addrexp.h")
|
2024-04-09 09:03:21 +00:00
|
|
|
add_flex_bison_dependency(LEXER PARSER)
|
|
|
|
|
2024-04-12 08:39:24 +00:00
|
|
|
add_library(sdb OBJECT sdb.cpp console.cpp disasm.cpp "${LEXER_OUT}" "${PARSER_OUT}")
|
|
|
|
llvm_map_components_to_libnames(LLVM_LIBS core target asmparser riscvasmparser riscvdesc riscvdisassembler riscvinfo riscvtargetmca)
|
2024-04-10 12:12:41 +00:00
|
|
|
target_link_libraries(sdb PUBLIC ${LLVM_LIBS})
|
2024-04-09 09:03:21 +00:00
|
|
|
target_link_libraries(sdb PRIVATE ${Readline_LIBRARY})
|
2024-04-12 06:08:52 +00:00
|
|
|
target_include_directories(sdb PRIVATE ${PARSER_DIR})
|
2024-04-09 09:03:21 +00:00
|
|
|
target_include_directories(sdb PRIVATE ${Readline_INCLUDE_DIR})
|
|
|
|
target_include_directories(sdb PUBLIC include)
|