cmake_minimum_required(VERSION 4.0)
project(DistributedHostGraph LANGUAGES CXX)

# Reference platform component, built as an installed-package consumer so it
# cannot accidentally rely on whole-repository linkage.
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

find_package(Void CONFIG REQUIRED COMPONENTS Functional Net)

add_library(distributed_host_graph STATIC
    src/cluster_fixture.cpp
    src/host_graph.cpp
    src/range_placement.cpp
    src/replicated_kv.cpp
    src/replicated_queue.cpp
    src/single_node.cpp)
target_include_directories(distributed_host_graph PUBLIC include)
target_link_libraries(distributed_host_graph PUBLIC Void::Functional Void::Net)

add_executable(distributed_host_graph_test tests/host_graph_test.cpp)
target_link_libraries(distributed_host_graph_test PRIVATE distributed_host_graph)

add_executable(distributed_single_node_test tests/single_node_test.cpp)
target_link_libraries(distributed_single_node_test PRIVATE distributed_host_graph)

add_executable(distributed_replicated_kv_test tests/replicated_kv_test.cpp)
target_link_libraries(distributed_replicated_kv_test PRIVATE distributed_host_graph)

add_executable(distributed_cluster_fixture_test tests/cluster_fixture_test.cpp)
target_link_libraries(distributed_cluster_fixture_test PRIVATE distributed_host_graph)

add_executable(distributed_replicated_queue_test tests/replicated_queue_test.cpp)
target_link_libraries(distributed_replicated_queue_test PRIVATE distributed_host_graph)

add_executable(distributed_operations_test tests/operations_test.cpp)
target_link_libraries(distributed_operations_test PRIVATE distributed_host_graph)

add_executable(distributed_range_placement_test tests/range_placement_test.cpp)
target_link_libraries(distributed_range_placement_test PRIVATE distributed_host_graph)

enable_testing()
add_test(NAME distributed_host_graph COMMAND distributed_host_graph_test)
add_test(NAME distributed_single_node COMMAND distributed_single_node_test)
add_test(NAME distributed_replicated_kv COMMAND distributed_replicated_kv_test)
add_test(NAME distributed_cluster_fixture COMMAND distributed_cluster_fixture_test)
add_test(NAME distributed_replicated_queue COMMAND distributed_replicated_queue_test)
add_test(NAME distributed_operations COMMAND distributed_operations_test)
add_test(NAME distributed_range_placement COMMAND distributed_range_placement_test)
