-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
47 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
find_package(SQLite3) | ||
|
||
macro(target name source) | ||
add_executable(${name} ${source}) | ||
if (SQLite3_FOUND) | ||
target_include_directories(${name} PRIVATE ${SQLite3_INCLUDE_DIRS}) | ||
target_link_libraries(${name} PRIVATE miniraft coroio ${SQLite3_LIBRARIES}) | ||
else() | ||
target_link_libraries(${name} miniraft coroio) | ||
endif() | ||
endmacro() | ||
|
||
target(kv kv.cpp) | ||
|
||
if (SQLite3_FOUND) | ||
target(sql sql.cpp) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
add_library(miniraft | ||
messages.cpp | ||
raft.cpp | ||
server.cpp | ||
persist.cpp | ||
) | ||
|
||
target_link_libraries(miniraft PUBLIC coroio) | ||
target_compile_features(miniraft PUBLIC cxx_std_20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(CMOCKA REQUIRED cmocka) | ||
|
||
macro(ut name source) | ||
add_executable(${name} ${source}) | ||
target_include_directories(${name} PRIVATE ${CMOCKA_INCLUDE_DIRS}) | ||
target_link_directories(${name} PRIVATE ${CMOCKA_LIBRARY_DIRS}) | ||
target_link_libraries(${name} PRIVATE miniraft coroio ${CMOCKA_LIBRARIES}) | ||
|
||
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name}) | ||
set_tests_properties(${name} PROPERTIES ENVIRONMENT "CMOCKA_MESSAGE_OUTPUT=xml;CMOCKA_XML_FILE=${name}.xml") | ||
endmacro() | ||
|
||
if (CMOCKA_FOUND) | ||
ut(test_raft test_raft.cpp) | ||
ut(test_read_write test_read_write.cpp) | ||
endif () |