From 66a73c31cb7d1aadf9f5b8c0b7e06d40b6dfa0b6 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sun, 2 Feb 2020 18:22:39 +0100 Subject: [PATCH] Some small windows compile fixes --- CMakeLists.txt | 28 +++++++++++++++------------- src/query/command3.h | 5 +++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5b6866..b9d44cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ find_package(DataPipes REQUIRED) include_directories(${DataPipes_INCLUDE_DIR}) # LibEvent fucks up the CMAKE_FIND_LIBRARY_SUFFIXES variable -if (NOT find_event AND FALSE) +if (NOT find_event) function(find_event static) if(static) set(LIBEVENT_STATIC_LINK TRUE) @@ -66,18 +66,20 @@ else() endif() if (MSVC) - set(CompilerFlags - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_RELEASE - CMAKE_C_FLAGS - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_RELEASE - ) - foreach(CompilerFlag ${CompilerFlags}) - string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") - endforeach() - add_compile_options("/EHsc") #We require exception handling + set(CompilerFlags + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_RELEASE + ) + foreach(CompilerFlag ${CompilerFlags}) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") + endforeach() + add_compile_options("/EHsc") #We require exception handling else() set(CMAKE_CXX_FLAGS_RELEASE "-O3") #-DNDEBUG We want assert! endif() diff --git a/src/query/command3.h b/src/query/command3.h index 5bc8e80..5220e10 100644 --- a/src/query/command3.h +++ b/src/query/command3.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "escape.h" #include "converters/converter.h" @@ -131,7 +132,7 @@ namespace ts { std::vector flags{}; }; - template > + template , class vector_iter = std::vector::iterator> class command_builder_impl { public: explicit command_builder_impl(std::string command, size_t expected_bulk_size = 128, size_t expected_bulks = 1) : _identifier{std::move(command)}, expected_bulk_size{expected_bulk_size} { @@ -214,7 +215,7 @@ namespace ts { this->put_unchecked(index, key, std::string_view{data}); } private: - command_builder_impl(size_t expected, size_t identifier, vector_t::iterator begin, vector_t::iterator end) : expected_bulk_size{expected}, _identifier{identifier}, bulks{begin, end} {} + command_builder_impl(size_t expected, size_t identifier, vector_iter begin, vector_iter end) : expected_bulk_size{expected}, _identifier{identifier}, bulks{begin, end} {} void impl_put_unchecked(std::string& data, size_t index, const std::string_view& key, const std::string_view& value) { auto escaped_value = ts::query::escape(std::string{value});