66 lines
2.0 KiB
CMake
66 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(weaseldb VERSION 0.0.1)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
endif()
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wextra")
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
toml11
|
|
GIT_REPOSITORY https://github.com/ToruNiina/toml11.git
|
|
GIT_TAG be08ba2be2a964edcdb3d3e3ea8d100abc26f286 # v4.4.0
|
|
)
|
|
FetchContent_MakeAvailable(toml11)
|
|
|
|
FetchContent_Declare(
|
|
doctest
|
|
GIT_REPOSITORY https://github.com/doctest/doctest.git
|
|
GIT_TAG 1da23a3e8119ec5cce4f9388e91b065e20bf06f5 # v2.4.12
|
|
)
|
|
FetchContent_MakeAvailable(doctest)
|
|
|
|
FetchContent_Declare(
|
|
nanobench
|
|
GIT_REPOSITORY https://github.com/martinus/nanobench.git
|
|
GIT_TAG a5a50c2b33eea2ff1fcb355cacdface43eb42b25 # v4.3.11
|
|
)
|
|
FetchContent_MakeAvailable(nanobench)
|
|
|
|
include_directories(src)
|
|
|
|
find_package(weaseljson REQUIRED)
|
|
|
|
set(SOURCES src/main.cpp src/config.cpp src/commit_request.cpp)
|
|
|
|
add_executable(weaseldb ${SOURCES})
|
|
target_link_libraries(weaseldb Threads::Threads toml11::toml11 weaseljson)
|
|
|
|
enable_testing()
|
|
|
|
add_executable(test_arena_allocator tests/test_arena_allocator.cpp)
|
|
target_link_libraries(test_arena_allocator doctest::doctest)
|
|
target_include_directories(test_arena_allocator PRIVATE src)
|
|
|
|
add_executable(test_commit_request tests/test_commit_request.cpp
|
|
src/commit_request.cpp)
|
|
target_link_libraries(test_commit_request doctest::doctest weaseljson)
|
|
target_include_directories(test_commit_request PRIVATE src)
|
|
|
|
add_executable(bench_arena_allocator benchmarks/bench_arena_allocator.cpp)
|
|
target_link_libraries(bench_arena_allocator nanobench)
|
|
target_include_directories(bench_arena_allocator PRIVATE src)
|
|
|
|
add_test(NAME arena_allocator_tests COMMAND test_arena_allocator)
|
|
add_test(NAME commit_request_tests COMMAND test_commit_request)
|
|
add_test(NAME arena_allocator_benchmarks COMMAND bench_arena_allocator)
|