CMakeLists.txt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Tests for smartbotic-database
  2. # Vector storage integration test
  3. # Compiles memory_store.cpp directly — no dependency on the full service executable.
  4. set(TEST_VECTOR_SOURCES
  5. test_vector_storage.cpp
  6. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  7. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  8. )
  9. add_executable(test_vector_storage ${TEST_VECTOR_SOURCES})
  10. target_include_directories(test_vector_storage PRIVATE
  11. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  12. )
  13. # nlohmann/json
  14. if(TARGET nlohmann_json::nlohmann_json)
  15. target_link_libraries(test_vector_storage PRIVATE nlohmann_json::nlohmann_json)
  16. else()
  17. target_include_directories(test_vector_storage PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  18. endif()
  19. # spdlog
  20. if(TARGET spdlog::spdlog)
  21. target_link_libraries(test_vector_storage PRIVATE spdlog::spdlog)
  22. else()
  23. target_link_libraries(test_vector_storage PRIVATE ${SPDLOG_LIBRARIES})
  24. target_include_directories(test_vector_storage PRIVATE ${SPDLOG_INCLUDE_DIRS})
  25. endif()
  26. # Threads (required by MemoryStore background threads)
  27. find_package(Threads REQUIRED)
  28. target_link_libraries(test_vector_storage PRIVATE Threads::Threads)
  29. # View projection unit test
  30. set(TEST_VIEWS_SOURCES
  31. test_views.cpp
  32. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/projection.cpp
  33. )
  34. add_executable(test_views ${TEST_VIEWS_SOURCES})
  35. target_include_directories(test_views PRIVATE
  36. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  37. )
  38. # nlohmann/json
  39. if(TARGET nlohmann_json::nlohmann_json)
  40. target_link_libraries(test_views PRIVATE nlohmann_json::nlohmann_json)
  41. else()
  42. target_include_directories(test_views PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  43. endif()
  44. # Register with CTest
  45. enable_testing()
  46. add_test(NAME vector_storage COMMAND test_vector_storage)
  47. add_test(NAME views COMMAND test_views)