CMakeLists.txt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Smartbotic Database Service
  2. # Find OpenSSL for encryption
  3. find_package(OpenSSL REQUIRED)
  4. # Find optional LZ4 for compression
  5. find_package(PkgConfig)
  6. if(PKG_CONFIG_FOUND)
  7. pkg_check_modules(LZ4 QUIET liblz4)
  8. endif()
  9. # Source files
  10. set(DATABASE_SERVICE_SOURCES
  11. src/main.cpp
  12. src/database_service.cpp
  13. src/database_grpc_impl.cpp
  14. src/memory_store.cpp
  15. src/persistence/persistence_manager.cpp
  16. src/persistence/wal.cpp
  17. src/persistence/snapshot.cpp
  18. src/encryption/encryption_manager.cpp
  19. src/events/event_manager.cpp
  20. src/files/file_manager.cpp
  21. src/files/file_store.cpp
  22. src/replication/replication_manager.cpp
  23. src/replication/sync_protocol.cpp
  24. src/replication/conflict_resolver.cpp
  25. src/migrations/migration_runner.cpp
  26. )
  27. # Create executable
  28. add_executable(smartbotic-database ${DATABASE_SERVICE_SOURCES})
  29. target_include_directories(smartbotic-database PRIVATE
  30. ${CMAKE_CURRENT_SOURCE_DIR}/src
  31. )
  32. # Link dependencies
  33. target_link_libraries(smartbotic-database PRIVATE
  34. smartbotic_db_proto
  35. OpenSSL::SSL
  36. OpenSSL::Crypto
  37. )
  38. if(TARGET nlohmann_json::nlohmann_json)
  39. target_link_libraries(smartbotic-database PRIVATE nlohmann_json::nlohmann_json)
  40. else()
  41. target_include_directories(smartbotic-database PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  42. endif()
  43. if(TARGET spdlog::spdlog)
  44. target_link_libraries(smartbotic-database PRIVATE spdlog::spdlog)
  45. else()
  46. target_link_libraries(smartbotic-database PRIVATE ${SPDLOG_LIBRARIES})
  47. target_include_directories(smartbotic-database PRIVATE ${SPDLOG_INCLUDE_DIRS})
  48. endif()
  49. # LZ4 compression support
  50. if(LZ4_FOUND)
  51. target_compile_definitions(smartbotic-database PRIVATE HAVE_LZ4)
  52. target_link_libraries(smartbotic-database PRIVATE ${LZ4_LIBRARIES})
  53. target_include_directories(smartbotic-database PRIVATE ${LZ4_INCLUDE_DIRS})
  54. endif()
  55. # Systemd support
  56. if(SYSTEMD_FOUND)
  57. target_compile_definitions(smartbotic-database PRIVATE HAVE_SYSTEMD)
  58. target_link_libraries(smartbotic-database PRIVATE ${SYSTEMD_LIBRARIES})
  59. target_include_directories(smartbotic-database PRIVATE ${SYSTEMD_INCLUDE_DIRS})
  60. endif()
  61. # Installation
  62. install(TARGETS smartbotic-database
  63. RUNTIME DESTINATION bin
  64. )