CMakeLists.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. )
  8. add_executable(test_vector_storage ${TEST_VECTOR_SOURCES})
  9. target_include_directories(test_vector_storage PRIVATE
  10. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  11. )
  12. # nlohmann/json
  13. if(TARGET nlohmann_json::nlohmann_json)
  14. target_link_libraries(test_vector_storage PRIVATE nlohmann_json::nlohmann_json)
  15. else()
  16. target_include_directories(test_vector_storage PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  17. endif()
  18. # spdlog
  19. if(TARGET spdlog::spdlog)
  20. target_link_libraries(test_vector_storage PRIVATE spdlog::spdlog)
  21. else()
  22. target_link_libraries(test_vector_storage PRIVATE ${SPDLOG_LIBRARIES})
  23. target_include_directories(test_vector_storage PRIVATE ${SPDLOG_INCLUDE_DIRS})
  24. endif()
  25. # Threads (required by MemoryStore background threads)
  26. find_package(Threads REQUIRED)
  27. target_link_libraries(test_vector_storage PRIVATE Threads::Threads)
  28. # View projection unit test
  29. set(TEST_VIEWS_SOURCES
  30. test_views.cpp
  31. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/projection.cpp
  32. )
  33. add_executable(test_views ${TEST_VIEWS_SOURCES})
  34. target_include_directories(test_views PRIVATE
  35. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  36. )
  37. # nlohmann/json
  38. if(TARGET nlohmann_json::nlohmann_json)
  39. target_link_libraries(test_views PRIVATE nlohmann_json::nlohmann_json)
  40. else()
  41. target_include_directories(test_views PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  42. endif()
  43. # Register with CTest
  44. enable_testing()
  45. add_test(NAME vector_storage COMMAND test_vector_storage)
  46. add_test(NAME views COMMAND test_views)