diff --git a/core/lib/spdlog/include/spdlog/details/spdlog_impl.h b/core/lib/spdlog/include/spdlog/details/spdlog_impl.h index a8011db44a..03c02c91c0 100755 --- a/core/lib/spdlog/include/spdlog/details/spdlog_impl.h +++ b/core/lib/spdlog/include/spdlog/details/spdlog_impl.h @@ -17,7 +17,9 @@ #endif #ifdef _WIN32 -#include +#define UNDEF_WIN_32 _WIN32 +#undef _WIN32 +#include #else #include #endif @@ -243,3 +245,8 @@ inline void spdlog::drop_all() { details::registry::instance().drop_all(); } + +#ifdef UNDEF_WIN_32 +#define _WIN32 UNDEF_WIN_32 +#undef UNDEF_WIN_32 +#endif \ No newline at end of file diff --git a/core/lib/spdlog/include/spdlog/sinks/wincolor_sink.h b/core/lib/spdlog/include/spdlog/sinks/wincolor_sink.h deleted file mode 100755 index 5555d80188..0000000000 --- a/core/lib/spdlog/include/spdlog/sinks/wincolor_sink.h +++ /dev/null @@ -1,116 +0,0 @@ -// -// Copyright(c) 2016 spdlog -// Distributed under the MIT License (http://opensource.org/licenses/MIT) -// - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -namespace spdlog -{ -namespace sinks -{ -/* - * Windows color console sink. Uses WriteConsoleA to write to the console with colors - */ -template -class wincolor_sink: public base_sink -{ -public: - const WORD BOLD = FOREGROUND_INTENSITY; - const WORD RED = FOREGROUND_RED; - const WORD CYAN = FOREGROUND_GREEN | FOREGROUND_BLUE; - const WORD WHITE = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; - const WORD YELLOW = FOREGROUND_RED | FOREGROUND_GREEN; - - wincolor_sink(HANDLE std_handle): out_handle_(std_handle) - { - colors_[level::trace] = CYAN; - colors_[level::debug] = CYAN; - colors_[level::info] = WHITE | BOLD; - colors_[level::warn] = YELLOW | BOLD; - colors_[level::err] = RED | BOLD; // red bold - colors_[level::critical] = BACKGROUND_RED | WHITE | BOLD; // white bold on red background - colors_[level::off] = 0; - } - - virtual ~wincolor_sink() - { - flush(); - } - - wincolor_sink(const wincolor_sink& other) = delete; - wincolor_sink& operator=(const wincolor_sink& other) = delete; - - virtual void _sink_it(const details::log_msg& msg) override - { - auto color = colors_[msg.level]; - auto orig_attribs = set_console_attribs(color); - WriteConsoleA(out_handle_, msg.formatted.data(), static_cast(msg.formatted.size()), nullptr, nullptr); - SetConsoleTextAttribute(out_handle_, orig_attribs); //reset to orig colors - } - - virtual void flush() override - { - // windows console always flushed? - } - - // change the color for the given level - void set_color(level::level_enum level, WORD color) - { - std::lock_guard lock(_mutex); - colors_[level] = color; - } - -private: - HANDLE out_handle_; - std::map colors_; - - // set color and return the orig console attributes (for resetting later) - WORD set_console_attribs(WORD attribs) - { - CONSOLE_SCREEN_BUFFER_INFO orig_buffer_info; - GetConsoleScreenBufferInfo(out_handle_, &orig_buffer_info); - SetConsoleTextAttribute(out_handle_, attribs); - return orig_buffer_info.wAttributes; //return orig attribs - } -}; - -// -// windows color console to stdout -// -template -class wincolor_stdout_sink: public wincolor_sink -{ -public: - wincolor_stdout_sink():wincolor_sink(GetStdHandle(STD_OUTPUT_HANDLE)) - {} -}; - -typedef wincolor_stdout_sink wincolor_stdout_sink_mt; -typedef wincolor_stdout_sink wincolor_stdout_sink_st; - -// -// windows color console to stderr -// -template -class wincolor_stderr_sink: public wincolor_sink -{ -public: - wincolor_stderr_sink():wincolor_sink(GetStdHandle(STD_ERROR_HANDLE)) - {} -}; - -typedef wincolor_stderr_sink wincolor_stderr_sink_mt; -typedef wincolor_stderr_sink wincolor_stderr_sink_st; - -} -} diff --git a/core/test/preferences/json_preferences_test.cpp b/core/test/preferences/json_preferences_test.cpp index e157df5e3f..b53ed52459 100644 --- a/core/test/preferences/json_preferences_test.cpp +++ b/core/test/preferences/json_preferences_test.cpp @@ -150,7 +150,7 @@ TEST(JsonPreferences, StoreAndGetWithPreferencesAPI) { ->putString("my_string", "Hello World!") ->putBoolean("my_bool", true) ->putInt("my_int", 42) - ->putLong("my_long", 42L << 42) + ->putLong("my_long", 42LL << 42LL) ->putStringArray("my_string_array", std::vector({"Hello", "world", "!"})) ->commit(); })); @@ -168,7 +168,7 @@ TEST(JsonPreferences, StoreAndGetWithPreferencesAPI) { EXPECT_EQ(preferences->getString("my_fake_string", "Not My String"), "Not My String"); EXPECT_EQ(preferences->getString("my_string_to_remove", ""), "Remove this please!"); EXPECT_EQ(preferences->getInt("my_int", -1), 42); - EXPECT_EQ(preferences->getLong("my_long", -1), 42L << 42); + EXPECT_EQ(preferences->getLong("my_long", -1), 42LL << 42LL); EXPECT_EQ(preferences->getBoolean("my_bool", false), true); EXPECT_EQ(preferences->getStringArray("my_string_array", {}), std::vector({"Hello", "world", "!"})); preferences->edit()->remove("my_string_to_remove")->commit(); @@ -208,7 +208,7 @@ TEST(JsonPreferences, LoadAndGetWithPreferencesAPI) { EXPECT_EQ(preferences->getString("my_fake_string", "Not My String"), "Not My String"); EXPECT_EQ(preferences->getString("my_string_to_remove", ""), "Remove this please!"); EXPECT_EQ(preferences->getInt("my_int", -1), 42); - EXPECT_EQ(preferences->getLong("my_long", -1), 42L << 42); + EXPECT_EQ(preferences->getLong("my_long", -1), 42LL << 42LL); EXPECT_EQ(preferences->getBoolean("my_bool", false), true); EXPECT_EQ(preferences->getStringArray("my_string_array", {}), std::vector({"Hello", "world", "!"})); dispatcher->stop(); diff --git a/setup_on_travis.sh b/setup_on_travis.sh index 1dc1ea4dd1..803d0a5b1b 100644 --- a/setup_on_travis.sh +++ b/setup_on_travis.sh @@ -7,7 +7,7 @@ if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get -o Dpkg::Options::="--force-all" -y --force-yes install gcc-5 g++-5 sudo cp /bin/true /usr/bin/dpkg-maintscript-helper sudo apt-get -o Dpkg::Options::="--force-all" -y --force-yes install mingw-w64 - + bcd ash tools/install_mingw64.sh elif [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update brew upgrade cmake || true diff --git a/tools/install_mingw64.sh b/tools/install_mingw64.sh new file mode 100644 index 0000000000..5fec026722 --- /dev/null +++ b/tools/install_mingw64.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +mkdir tools/mingw64_tmp/ && cp tools/mingw64/* tools/mingw64_tmp/ +cd tools/mingw64_tmp +for file in *.xz; do + tar xvf ${file} +done +sudo rsync -lrK usr / \ No newline at end of file diff --git a/tools/mingw64/mingw-w64-binutils-2.27-1-x86_64.pkg.tar.xz b/tools/mingw64/mingw-w64-binutils-2.27-1-x86_64.pkg.tar.xz new file mode 100644 index 0000000000..1f86406f17 Binary files /dev/null and b/tools/mingw64/mingw-w64-binutils-2.27-1-x86_64.pkg.tar.xz differ diff --git a/tools/mingw64/mingw-w64-crt-5.0.0-1-any.pkg.tar.xz b/tools/mingw64/mingw-w64-crt-5.0.0-1-any.pkg.tar.xz new file mode 100644 index 0000000000..5f8fc61920 Binary files /dev/null and b/tools/mingw64/mingw-w64-crt-5.0.0-1-any.pkg.tar.xz differ diff --git a/tools/mingw64/mingw-w64-headers-5.0.0-1-any.pkg.tar.xz b/tools/mingw64/mingw-w64-headers-5.0.0-1-any.pkg.tar.xz new file mode 100644 index 0000000000..d70007e83d Binary files /dev/null and b/tools/mingw64/mingw-w64-headers-5.0.0-1-any.pkg.tar.xz differ diff --git a/tools/mingw64/mingw-w64-headers-bootstrap-5.0.0-1-any.pkg.tar.xz b/tools/mingw64/mingw-w64-headers-bootstrap-5.0.0-1-any.pkg.tar.xz new file mode 100644 index 0000000000..2466a364d2 Binary files /dev/null and b/tools/mingw64/mingw-w64-headers-bootstrap-5.0.0-1-any.pkg.tar.xz differ diff --git a/tools/mingw64/mingw-w64-winpthreads-5.0.0-1-any.pkg.tar.xz b/tools/mingw64/mingw-w64-winpthreads-5.0.0-1-any.pkg.tar.xz new file mode 100644 index 0000000000..2578c40db0 Binary files /dev/null and b/tools/mingw64/mingw-w64-winpthreads-5.0.0-1-any.pkg.tar.xz differ