]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add Redis support for Windows
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 24 Jul 2021 20:01:02 +0000 (22:01 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 25 Jul 2021 14:15:42 +0000 (16:15 +0200)
.github/workflows/build.yaml
cmake/Findhiredis.cmake
cmake/config.h.in
src/storage/secondary/RedisStorage.cpp

index 056f5212c798dd70000bda5dc0159315db5b8a74..dce8f3512be6f00325de744b35b0776dc9671984 100644 (file)
@@ -182,7 +182,7 @@ jobs:
             os: ubuntu-18.04
             CC: i686-w64-mingw32-gcc-posix
             CXX: i686-w64-mingw32-g++-posix
-            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DREDIS_STORAGE_BACKEND=OFF
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
             RUN_TESTS: none
             apt_get: elfutils mingw-w64
 
@@ -191,7 +191,7 @@ jobs:
             CC: x86_64-w64-mingw32-gcc-posix
             CXX: x86_64-w64-mingw32-g++-posix
             ENABLE_CACHE_CLEANUP_TESTS: 1
-            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DREDIS_STORAGE_BACKEND=OFF
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
             RUN_TESTS: unittest-in-wine
             apt_get: elfutils mingw-w64 wine
 
@@ -203,7 +203,7 @@ jobs:
             CXX: cl
             ENABLE_CACHE_CLEANUP_TESTS: 1
             CMAKE_GENERATOR: Ninja
-            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DREDIS_STORAGE_BACKEND=OFF
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
             TEST_CC: clang -target i686-pc-windows-msvc
 
           - name: Windows VS2019 64-bit
@@ -214,7 +214,7 @@ jobs:
             CXX: cl
             ENABLE_CACHE_CLEANUP_TESTS: 1
             CMAKE_GENERATOR: Ninja
-            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DREDIS_STORAGE_BACKEND=OFF
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
             TEST_CC: clang -target x86_64-pc-windows-msvc
 
           - name: Clang address & UB sanitizer
index 21bec80e017ccd0216086d2fec55e53487e7e382..51d0ed0ba913d9a70a8eb2b3d306212ca7d956b9 100644 (file)
@@ -36,6 +36,11 @@ if(HIREDIS_FROM_INTERNET)
   )
   add_library(libhiredis_static STATIC EXCLUDE_FROM_ALL ${hiredis_sources})
   add_library(HIREDIS::HIREDIS ALIAS libhiredis_static)
+  if(WIN32)
+    target_compile_definitions(libhiredis_static PRIVATE _CRT_SECURE_NO_WARNINGS)
+    target_link_libraries(libhiredis_static PUBLIC ws2_32)
+  endif()
+
   make_directory("${hiredis_dir}/include")
   make_directory("${hiredis_dir}/include/hiredis")
   file(GLOB hiredis_headers "${hiredis_dir}/*.h")
index 65c8e7b8c28bfe0a2303e986351e485f2be093a7..67688a47c2409910f32ad97cb4ba360223dc9d35 100644 (file)
 #  ifdef _MSC_VER
 typedef unsigned __int32 mode_t;
 typedef int pid_t;
-#    ifdef _WIN64
-typedef __int64 ssize_t;
-#    else
-typedef int ssize_t;
-#    endif
-#  elif !defined(__MINGW32__)
-typedef __int64 ssize_t;
 #  endif // _MSC_VER
 #endif   // _WIN32
 
index 8740edcb28ab04c7956835730ff5ed2e5aa3cae9..8c12083cb7fbe4e2c4d05bfb14bfbd82aef15af4 100644 (file)
 #include <util/expected.hpp>
 #include <util/string.hpp>
 
+// Ignore "ISO C++ forbids flexible array member ‘buf’" warning from -Wpedantic.
 #ifdef __GNUC__
 #  pragma GCC diagnostic push
-// Ignore "ISO C++ forbids flexible array member ‘buf’" warning from -Wpedantic.
 #  pragma GCC diagnostic ignored "-Wpedantic"
 #endif
+#ifdef _MSC_VER
+#  pragma warning(push)
+#  pragma warning(disable : 4200)
+#endif
 #include <hiredis/hiredis.h>
+#ifdef _MSC_VER
+#  pragma warning(pop)
+#endif
 #ifdef __GNUC__
 #  pragma GCC diagnostic pop
 #endif