# Smartbotic Database Service # Find OpenSSL for encryption find_package(OpenSSL REQUIRED) # Find optional LZ4 for compression find_package(PkgConfig) if(PKG_CONFIG_FOUND) pkg_check_modules(LZ4 QUIET liblz4) endif() # Source files set(DATABASE_SERVICE_SOURCES src/main.cpp src/database_service.cpp src/database_grpc_impl.cpp src/memory_store.cpp src/persistence/persistence_manager.cpp src/persistence/wal.cpp src/persistence/snapshot.cpp src/encryption/encryption_manager.cpp src/events/event_manager.cpp src/files/file_manager.cpp src/files/file_store.cpp src/replication/replication_manager.cpp src/replication/sync_protocol.cpp src/replication/conflict_resolver.cpp src/migrations/migration_runner.cpp src/views/projection.cpp src/views/view_manager.cpp src/config/collection_config_manager.cpp src/config/config_loader.cpp ) # Create executable add_executable(smartbotic-database ${DATABASE_SERVICE_SOURCES}) target_include_directories(smartbotic-database PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) # Link dependencies if(BUILD_SHARED_LIBS) target_link_libraries(smartbotic-database PRIVATE smartbotic-db-client) else() target_link_libraries(smartbotic-database PRIVATE smartbotic_db_proto) endif() target_link_libraries(smartbotic-database PRIVATE OpenSSL::SSL OpenSSL::Crypto ) if(TARGET nlohmann_json::nlohmann_json) target_link_libraries(smartbotic-database PRIVATE nlohmann_json::nlohmann_json) else() target_include_directories(smartbotic-database PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS}) endif() if(TARGET spdlog::spdlog) target_link_libraries(smartbotic-database PRIVATE spdlog::spdlog) else() target_link_libraries(smartbotic-database PRIVATE ${SPDLOG_LIBRARIES}) target_include_directories(smartbotic-database PRIVATE ${SPDLOG_INCLUDE_DIRS}) endif() # LZ4 compression support if(LZ4_FOUND) target_compile_definitions(smartbotic-database PRIVATE HAVE_LZ4) target_link_libraries(smartbotic-database PRIVATE ${LZ4_LIBRARIES}) target_include_directories(smartbotic-database PRIVATE ${LZ4_INCLUDE_DIRS}) endif() # Systemd support if(SYSTEMD_FOUND) target_compile_definitions(smartbotic-database PRIVATE HAVE_SYSTEMD) target_link_libraries(smartbotic-database PRIVATE ${SYSTEMD_LIBRARIES}) target_include_directories(smartbotic-database PRIVATE ${SYSTEMD_INCLUDE_DIRS}) endif() # Installation install(TARGETS smartbotic-database RUNTIME DESTINATION bin )