abacus: add cmake-based build system
This commit is contained in:
parent
549c1f0574
commit
331089d101
6 changed files with 76 additions and 0 deletions
12
src/CMakeLists.txt
Normal file
12
src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
add_executable(abacus abacus.cc)
|
||||
target_link_libraries(abacus PRIVATE common_options)
|
||||
|
||||
add_subdirectory(bignum)
|
||||
add_subdirectory(parse)
|
||||
|
||||
target_link_libraries(abacus PRIVATE
|
||||
bignum
|
||||
parse
|
||||
)
|
||||
|
||||
install(TARGETS abacus)
|
||||
9
src/bignum/CMakeLists.txt
Normal file
9
src/bignum/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
add_library(bignum STATIC
|
||||
bignum.cc
|
||||
bignum.hh
|
||||
)
|
||||
target_link_libraries(bignum PRIVATE common_options)
|
||||
|
||||
target_include_directories(bignum PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
)
|
||||
23
src/parse/CMakeLists.txt
Normal file
23
src/parse/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
find_package(BISON REQUIRED)
|
||||
find_package(FLEX REQUIRED)
|
||||
|
||||
bison_target(parser_sources parser.yy ${CMAKE_CURRENT_BINARY_DIR}/parser.cc DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.hh)
|
||||
flex_target(scanner_sources scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/scanner.cc)
|
||||
add_flex_bison_dependency(scanner_sources parser_sources)
|
||||
|
||||
add_library(parse STATIC
|
||||
parser-driver.cc
|
||||
parser-driver.hh
|
||||
${BISON_parser_sources_OUTPUTS}
|
||||
${FLEX_scanner_sources_OUTPUTS}
|
||||
)
|
||||
target_link_libraries(parse PRIVATE common_options)
|
||||
|
||||
target_link_libraries(parse PRIVATE
|
||||
bignum
|
||||
)
|
||||
|
||||
target_include_directories(parse PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue