diff --git a/WORKSPACE b/WORKSPACE index a4bea9a..b7549cc 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,6 +1,8 @@ -new_http_archive( +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( name = "gtest", - build_file = "BUILD.gtest", + build_file = "@//:BUILD.gtest", sha256 = "f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf", strip_prefix = "googletest-release-1.8.0", url = "https://github.com/google/googletest/archive/release-1.8.0.zip", diff --git a/examples/cpp_redis_client.cpp b/examples/cpp_redis_client.cpp index 096ec1d..2c7db0e 100644 --- a/examples/cpp_redis_client.cpp +++ b/examples/cpp_redis_client.cpp @@ -28,6 +28,7 @@ int main(void) { winsock_initializer winsock_init; +#endif //! Enable logging cpp_redis::active_logger = std::unique_ptr(new cpp_redis::logger); diff --git a/examples/cpp_redis_future_client.cpp b/examples/cpp_redis_future_client.cpp index 3c06028..87828ca 100644 --- a/examples/cpp_redis_future_client.cpp +++ b/examples/cpp_redis_future_client.cpp @@ -23,11 +23,15 @@ #include #include +#if _WIN32 #include "winsock_initializer.h" +#endif int main(void) { +#if _WIN32 winsock_initializer winsock_init; +#endif //! Enable logging cpp_redis::active_logger = std::unique_ptr(new cpp_redis::logger); diff --git a/examples/cpp_redis_high_availability_client.cpp b/examples/cpp_redis_high_availability_client.cpp index 3350c0b..e2ec2ad 100644 --- a/examples/cpp_redis_high_availability_client.cpp +++ b/examples/cpp_redis_high_availability_client.cpp @@ -23,11 +23,15 @@ #include #include +#if _WIN32 #include "winsock_initializer.h" +#endif int main(void) { +#if _WIN32 winsock_initializer winsock_init; +#endif //! Enable logging cpp_redis::active_logger = std::unique_ptr(new cpp_redis::logger); diff --git a/examples/cpp_redis_kill.cpp b/examples/cpp_redis_kill.cpp index c85c271..c302905 100644 --- a/examples/cpp_redis_kill.cpp +++ b/examples/cpp_redis_kill.cpp @@ -24,11 +24,15 @@ #include #include +#if _WIN32 #include "winsock_initializer.h" +#endif int main(void) { +#if _WIN32 winsock_initializer winsock_init; +#endif cpp_redis::client client; client.connect("127.0.0.1", 6379, [](const std::string& host, std::size_t port, cpp_redis::connect_state status) { diff --git a/examples/cpp_redis_multi_exec.cpp b/examples/cpp_redis_multi_exec.cpp index e47fdc1..fc9922e 100644 --- a/examples/cpp_redis_multi_exec.cpp +++ b/examples/cpp_redis_multi_exec.cpp @@ -1,12 +1,16 @@ // The MIT License (MIT) +#if _WIN32 #include "winsock_initializer.h" +#endif #include #include int main(void) { +#if _WIN32 winsock_initializer winsock_init; +#endif cpp_redis::client client; client.connect("127.0.0.1", 6379, diff --git a/examples/cpp_redis_subscriber.cpp b/examples/cpp_redis_subscriber.cpp index 71a41bb..6c8e0e2 100644 --- a/examples/cpp_redis_subscriber.cpp +++ b/examples/cpp_redis_subscriber.cpp @@ -27,7 +27,9 @@ #include #include #include +#if _WIN32 #include "winsock_initializer.h" +#endif std::condition_variable should_exit; @@ -38,7 +40,9 @@ sigint_handler(int) { int main(void) { +#if _WIN32 winsock_initializer winsock_init; +#endif //! Enable logging cpp_redis::active_logger = std::unique_ptr(new cpp_redis::logger); diff --git a/repositories.bzl b/repositories.bzl index 86cc85a..3e506f2 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -1,7 +1,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -cpp_redis_repositories: +def cpp_redis_repositories(): """Add external dependencies to the workspace.""" maybe( http_archive,