#
option(REDIS_STORAGE_BACKEND "Enable Redis remote storage" ON)
+option(HTTP_STORAGE_BACKEND "Enable HTTP remote storage" ON)
option(ENABLE_TESTING "Enable tests" ON)
include(InstallDirs)
message(STATUS "Configuration summary:")
message(STATUS " Storage backends:")
message(STATUS " file ON")
-message(STATUS " http ON")
+message(STATUS " http ${HTTP_STORAGE_BACKEND}")
message(STATUS " redis ${REDIS_STORAGE_BACKEND}")
message(STATUS " Dependencies:")
print_dependency_summary(" ")
endif()
find_package(Blake3 1.4.0 MODULE REQUIRED)
-find_package(CppHttplib 0.10.6 MODULE REQUIRED)
+if(HTTP_STORAGE_BACKEND)
+ find_package(CppHttplib 0.10.6 MODULE REQUIRED)
+endif()
find_package(Fmt 8.0.0 MODULE REQUIRED)
find_package(NonstdSpan 0.10.3 MODULE REQUIRED)
find_package(TlExpected 1.1.0 MODULE REQUIRED)
### Dependencies
- [BLAKE3](https://github.com/BLAKE3-team/BLAKE3)[^1]
-- [cpp-httplib](https://github.com/yhirose/cpp-httplib)[^1]
+- [cpp-httplib](https://github.com/yhirose/cpp-httplib)[^1] (optional, disable
+ with `-DHTTP_STORAGE_BACKEND=OFF`)
- [doctest](https://github.com/doctest/doctest)[^2] (optional, disable with `-D
ENABLE_TESTING=OFF`)
- [fmt](https://fmt.dev)[^1]
dep_tlexpected
dep_xxhash
PRIVATE
- dep_cpphttplib
dep_zstd
standard_settings
standard_warnings
target_link_libraries(ccache_framework PRIVATE dep_hiredis)
endif()
+if(HTTP_STORAGE_BACKEND)
+ target_compile_definitions(ccache_framework PUBLIC -DHAVE_HTTP_STORAGE_BACKEND)
+ target_link_libraries(ccache_framework PRIVATE dep_cpphttplib)
+endif()
+
add_executable(test-lockfile test_lockfile.cpp)
target_link_libraries(test-lockfile PRIVATE standard_settings standard_warnings ccache_framework)
set(
sources
filestorage.cpp
- httpstorage.cpp
remotestorage.cpp
)
list(APPEND sources redisstorage.cpp)
endif()
+if(HTTP_STORAGE_BACKEND)
+ list(APPEND sources httpstorage.cpp)
+endif()
+
file(GLOB headers *.hpp)
list(APPEND sources ${headers})
#include <ccache/core/exceptions.hpp>
#include <ccache/core/statistic.hpp>
#include <ccache/storage/remote/filestorage.hpp>
-#include <ccache/storage/remote/httpstorage.hpp>
+#ifdef HAVE_HTTP_STORAGE_BACKEND
+# include <ccache/storage/remote/httpstorage.hpp>
+#endif
#ifdef HAVE_REDIS_STORAGE_BACKEND
# include <ccache/storage/remote/redisstorage.hpp>
#endif
std::shared_ptr<remote::RemoteStorage>>
k_remote_storage_implementations = {
{"file", std::make_shared<remote::FileStorage>()},
+#ifdef HAVE_HTTP_STORAGE_BACKEND
{"http", std::make_shared<remote::HttpStorage>()},
+#endif
#ifdef HAVE_REDIS_STORAGE_BACKEND
{"redis", std::make_shared<remote::RedisStorage>()},
{"redis+unix", std::make_shared<remote::RedisStorage>()},
if(NOT TARGET dep_blake3)
add_subdirectory(blake3)
endif()
-if(NOT TARGET dep_cpphttplib)
- add_subdirectory(cpp-httplib)
+if(HTTP_STORAGE_BACKEND)
+ if(NOT TARGET dep_cpphttplib)
+ add_subdirectory(cpp-httplib)
+ endif()
endif()
if(NOT TARGET dep_fmt)
add_subdirectory(fmt)
addtest(readonly)
addtest(readonly_direct)
addtest(remote_file)
-addtest(remote_http)
+if(HTTP_STORAGE_BACKEND)
+ addtest(remote_http)
+endif()
addtest(remote_only)
addtest(remote_redis)
addtest(remote_redis_unix)