You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2017/03/10 11:20:01 UTC

thrift git commit: THRIFT-4081: appveyor retooling - added mingw64 build as a second job to the CI build process

Repository: thrift
Updated Branches:
  refs/heads/master 9b1544dc2 -> 07f59971b


THRIFT-4081: appveyor retooling - added mingw64 build as a second job to the CI build process

This closes #1205


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/07f59971
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/07f59971
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/07f59971

Branch: refs/heads/master
Commit: 07f59971bd11df619709444275298061ee69f707
Parents: 9b1544d
Author: James E. King, III <jk...@apache.org>
Authored: Fri Mar 10 06:18:33 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Fri Mar 10 06:18:33 2017 -0500

----------------------------------------------------------------------
 appveyor.yml                                    | 127 ++++++++++---------
 build/appveyor/MING-appveyor-build.bat          |  36 ++++++
 build/appveyor/MING-appveyor-install.bat        |  21 +++
 build/appveyor/MING-appveyor-test.bat           |  16 +++
 build/appveyor/MSVC-appveyor-build.bat          |  44 +++++++
 build/appveyor/MSVC-appveyor-install.bat        |  60 +++++++++
 build/appveyor/MSVC-appveyor-test.bat           |  29 +++++
 build/appveyor/MSYS-appveyor-build.bat          |  47 +++++++
 build/appveyor/MSYS-appveyor-install.bat        |  41 ++++++
 build/appveyor/MSYS-appveyor-test.bat           |  26 ++++
 build/appveyor/README.md                        |  34 +++++
 build/appveyor/build-libevent.bat               |  30 +++++
 build/appveyor/build-zlib.bat                   |  49 +++++++
 build/appveyor/cl_banner_apache_thrift.bat      |  24 ++++
 build/appveyor/cl_banner_build.bat              |  23 ++++
 build/appveyor/cl_banner_install.bat            |  23 ++++
 build/appveyor/cl_banner_test.bat               |  23 ++++
 build/appveyor/cl_setcompiler.bat               |  63 +++++++++
 build/appveyor/cl_setenv.bat                    |  79 ++++++++++++
 build/appveyor/cl_setgenerator.bat              |  74 +++++++++++
 build/appveyor/cl_showenv.bat                   |  67 ++++++++++
 build/appveyor/download_openssl.py              |  41 ------
 build/appveyor/simulate-appveyor.bat            |  35 +++++
 build/cmake/DefineOptions.cmake                 |  15 +--
 build/cmake/DefinePlatformSpecifc.cmake         |  14 +-
 build/cmake/NewPlatformDebug.cmake              |  43 +++++++
 .../cpp/src/thrift/generate/t_cpp_generator.cc  |   4 +-
 lib/cpp/CMakeLists.txt                          |   2 +-
 lib/cpp/src/thrift/concurrency/StdMutex.cpp     |   2 +
 lib/cpp/src/thrift/protocol/TProtocol.h         |   4 +-
 lib/cpp/src/thrift/transport/TPipe.cpp          |   2 +-
 lib/cpp/src/thrift/transport/TPipeServer.cpp    |   4 +-
 lib/cpp/src/thrift/transport/TServerSocket.cpp  |   2 +-
 lib/cpp/src/thrift/transport/TSocket.cpp        |   2 +-
 lib/cpp/src/thrift/windows/config.h             |  19 ++-
 lib/cpp/test/Base64Test.cpp                     |   4 +
 lib/cpp/test/CMakeLists.txt                     |   6 +-
 lib/cpp/test/TFileTransportTest.cpp             |  11 +-
 lib/cpp/test/TSSLSocketInterruptTest.cpp        |   2 +-
 lib/cpp/test/ZlibTest.cpp                       |   2 +-
 lib/java/CMakeLists.txt                         |   2 +-
 lib/py/src/ext/module.cpp                       |   7 +-
 42 files changed, 1006 insertions(+), 153 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index a4df229..b25e7d2 100755
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,3 +1,4 @@
+#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements. See the NOTICE file
 # distributed with this work for additional information
@@ -18,73 +19,77 @@
 
 # build Apache Thrift on AppVeyor - https://ci.appveyor.com
 
+version: '1.0.0-dev.{build}'
+
 shallow_clone: true
-clone_depth: 10
 
-version: '{build}'
 os:
-# - Windows Server 2012 R2
-- Visual Studio 2015
+  - Visual Studio 2015
+
+cache:
+  - C:\projects\thrift\buildcache -> build\appveyor\MSVC-appveyor-install.bat
+  - C:\ProgramData\chocolatey\lib -> build\appveyor\MSVC-appveyor-install.bat
+  - C:\msys64\var\cache\pacman    -> build\appveyor\MSYS-appveyor-install.bat
+
+configuration:
+# - Debug
+  - Release
+
+platform:
+# - x86
+  - x64
 
 environment:
-  BOOST_ROOT: C:\Libraries\boost_1_59_0
-  BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib64-msvc-14.0
+  matrix:
+   - PROFILE: MSVC2015
+     BOOST_VERSION: 1.63.0
+     LIBEVENT_VERSION: 2.0.22
+     PYTHON_VERSION: 3.6
+     QT_VERSION: 5.8
+     ZLIB_VERSION: 1.2.11
 
-install:
-- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64'
-- cd \
-  # Zlib
-- appveyor DownloadFile https://github.com/madler/zlib/archive/v1.2.8.tar.gz
-- 7z x v1.2.8.tar.gz -so | 7z x -si -ttar > nul
-- cd zlib-1.2.8
-- cmake -G "Visual Studio 14 2015 Win64" .
-- cmake --build . --config release
-- cd ..
-  # Libevent
-- appveyor DownloadFile https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
-- 7z x libevent-2.0.22-stable.tar.gz -so | 7z x -si -ttar > nul
-- cd libevent-2.0.22-stable
-- nmake -f Makefile.nmake
-- mkdir lib
-- move *.lib lib\
-- move WIN32-Code\event2\* include\event2\
-- move *.h include\
-- cd ..
-- appveyor-retry cinst -y ant
-- appveyor-retry cinst -y winflexbison3
-# installation of ant brings in the latest jdk and sets JAVA_HOME - we need to pick these up from the registry
-- refreshenv
-- cd %APPVEYOR_BUILD_FOLDER%
-# TODO: Enable Haskell build
-# - cinst HaskellPlatform -version 2014.2.0.0
+   - PROFILE: MINGW
+
+#   - PROFILE: MSVC2010
+#     BOOST_VERSION: 1.59.0
+#     LIBEVENT_VERSION: 2.0.22
+#     PYTHON_VERSION: 3.3
+#     ZLIB_VERSION: 1.2.8
+
+#   - PROFILE: MSYS
 
+matrix:
+  allow_failures:
+    # MSVC2010 appears to be 32-bit only in appveyor
+    - platform: x64
+      PROFILE: MSVC2010
+
+    # Only have 64-bit MinGW working so far (inside MSYS2)
+    - platform: x86
+      PROFILE: MINGW
+    - platform: x86
+      PROFILE: MSYS
+
+install:
+  - cd %APPVEYOR_BUILD_FOLDER%
+  - call build\appveyor\%PROFILE:~0,4%-appveyor-install.bat
+  - refreshenv
 
 build_script:
-- echo PATH=%PATH%
-- set PATH=C:\ProgramData\chocolatey\bin;%PATH%
-- echo JAVA_HOME=%JAVA_HOME%
-# TODO: Enable Haskell build
-# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\bin
-# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\lib\extralibs\bin
-- set PATH=C:\Python27-x64\scripts;C:\Python27-x64;%PATH%
-- pip install ipaddress backports.ssl_match_hostname tornado twisted
-- mkdir cmake-build
-- cd cmake-build
-- cmake -G "Visual Studio 14 2015 Win64" -DWITH_SHARED_LIB=OFF -DLIBEVENT_ROOT=C:\libevent-2.0.22-stable -DZLIB_INCLUDE_DIR=C:\zlib-1.2.8 -DZLIB_LIBRARY=C:\zlib-1.2.8\release\zlibstatic.lib -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ..
-- findstr /b /e BUILD_COMPILER:BOOL=ON CMakeCache.txt
-- findstr /b /e BUILD_CPP:BOOL=ON CMakeCache.txt
-- findstr /b /e BUILD_JAVA:BOOL=ON CMakeCache.txt
-- findstr /b /e BUILD_PYTHON:BOOL=ON CMakeCache.txt
-# - findstr /b /e BUILD_C_GLIB:BOOL=ON CMakeCache.txt
-# - findstr /b /e BUILD_HASKELL:BOOL=ON CMakeCache.txt
-- findstr /b /e BUILD_TESTING:BOOL=ON CMakeCache.txt
-# - cmake --build .
-- cmake --build . --config Release
-# TODO: Fix cpack
-# - cpack
-# TODO: Run more tests
-# CTest fails to invoke ant seemingly due to "ant.bat" v.s. "ant" (shell script) conflict.
-# Currently, everything that involves OpenSSL seems to hang forever on our Appveyor setup.
-# Also a few C++ tests hang (on Appveyor or on Windows in general).
-- ctest -C Release --timeout 600 -VV -E "(StressTestNonBlocking|PythonTestSSLSocket|python_test$|^Java)"
-# TODO make it perfect ;-r
+  - cd %APPVEYOR_BUILD_FOLDER%
+  - call build\appveyor\%PROFILE:~0,4%-appveyor-build.bat
+
+test_script:
+  - cd %APPVEYOR_BUILD_FOLDER%
+  - call build\appveyor\%PROFILE:~0,4%-appveyor-test.bat
+
+# artifact capture disabled as it might increase service cost for little gain:
+#
+# artifacts:
+#  - path: local-thrift-inst
+#    name: cmake installed content
+#    type: zip
+#
+#  - path: local-thrift-build\Testing
+#    name: ctest output
+#    type: zip

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MING-appveyor-build.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MING-appveyor-build.bat b/build/appveyor/MING-appveyor-build.bat
new file mode 100644
index 0000000..838e428
--- /dev/null
+++ b/build/appveyor/MING-appveyor-build.bat
@@ -0,0 +1,36 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+@ECHO OFF
+SETLOCAL EnableDelayedExpansion
+
+CD build\appveyor                           || EXIT /B
+CALL cl_banner_build.bat                    || EXIT /B
+CALL cl_setenv.bat                          || EXIT /B
+
+SET CMAKEARGS=^
+  -G'%GENERATOR%' ^
+  -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+  -DCMAKE_INSTALL_PREFIX=%INSTDIR_MSYS% ^
+  -DCMAKE_MAKE_PROGRAM=/mingw64/bin/mingw32-make ^
+  -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe ^
+  -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++.exe ^
+  -DWITH_LIBEVENT=OFF ^
+  -DWITH_PYTHON=OFF ^
+  -DWITH_SHARED_LIB=OFF ^
+  -DWITH_STATIC_LIB=ON
+
+@ECHO ON
+%BASH% -lc "mkdir -p %BUILDDIR_MSYS% && cd %BUILDDIR_MSYS% && cmake.exe %SRCDIR_MSYS% %CMAKEARGS% && cmake --build . --config %CONFIGURATION% --target install" || EXIT /B
+@ECHO OFF

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MING-appveyor-install.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MING-appveyor-install.bat b/build/appveyor/MING-appveyor-install.bat
new file mode 100644
index 0000000..0d5f99e
--- /dev/null
+++ b/build/appveyor/MING-appveyor-install.bat
@@ -0,0 +1,21 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+::
+:: Appveyor install script for MinGW
+:: Installs (or builds) third party packages we need
+::
+
+:: Same as the MSYS installation requirements
+CALL build\appveyor\MSYS-appveyor-install.bat

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MING-appveyor-test.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MING-appveyor-test.bat b/build/appveyor/MING-appveyor-test.bat
new file mode 100644
index 0000000..c37c72a
--- /dev/null
+++ b/build/appveyor/MING-appveyor-test.bat
@@ -0,0 +1,16 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+:: Same as MSYS2
+CALL build\appveyor\MSYS-appveyor-test.bat

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MSVC-appveyor-build.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSVC-appveyor-build.bat b/build/appveyor/MSVC-appveyor-build.bat
new file mode 100644
index 0000000..ee022cb
--- /dev/null
+++ b/build/appveyor/MSVC-appveyor-build.bat
@@ -0,0 +1,44 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+@ECHO OFF
+SETLOCAL EnableDelayedExpansion
+
+CD build\appveyor                           || EXIT /B
+CALL cl_banner_build.bat                    || EXIT /B
+CALL cl_setenv.bat                          || EXIT /B
+MKDIR "%BUILDDIR%"                          || EXIT /B
+CD "%BUILDDIR%"                             || EXIT /B
+
+@ECHO ON
+  cmake "%SRCDIR%" ^
+    -G"%GENERATOR%" ^
+    -DBOOST_ROOT="%BOOST_ROOT%" ^
+    -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ^
+    -DCMAKE_BUILD_TYPE="%CONFIGURATION%" ^
+    -DCMAKE_INSTALL_PREFIX="%INSTDIR%" ^
+    -DINTTYPES_ROOT="%WIN3P%\msinttypes" ^
+    -DLIBEVENT_ROOT="%WIN3P%\libevent-%LIBEVENT_VERSION%-stable" ^
+    -DOPENSSL_ROOT_DIR="%OPENSSL_ROOT%" ^
+    -DOPENSSL_USE_STATIC_LIBS=OFF ^
+    -DZLIB_LIBRARY="%WIN3P%\zlib-inst\lib\zlib%ZLIB_LIB_SUFFIX%.lib" ^
+    -DZLIB_ROOT="%WIN3P%\zlib-inst" ^
+    -DWITH_PYTHON=%WITH_PYTHON% ^
+    -DWITH_SHARED_LIB=OFF ^
+    -DWITH_STATIC_LIB=ON                    || EXIT /B
+@ECHO OFF
+
+cmake --build . ^
+  --config "%CONFIGURATION%" ^
+  --target INSTALL                          || EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MSVC-appveyor-install.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSVC-appveyor-install.bat b/build/appveyor/MSVC-appveyor-install.bat
new file mode 100644
index 0000000..5343d85
--- /dev/null
+++ b/build/appveyor/MSVC-appveyor-install.bat
@@ -0,0 +1,60 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+::
+:: Appveyor install script for MSVC
+:: Installs (or builds) third party packages we need
+::
+
+@ECHO OFF
+SETLOCAL EnableDelayedExpansion
+
+CD build\appveyor                         || EXIT /B
+CALL cl_banner_install.bat                || EXIT /B
+CALL cl_setenv.bat                        || EXIT /B
+CALL cl_showenv.bat                       || EXIT /B
+MKDIR "%WIN3P%"                           || EXIT /B
+
+:: Install ant - this also installs the latest JDK as a dependency
+:: The installation of JDK requires us to pick up PATH and JAVE_HOME from the registry
+cinst -c "%BUILDCACHE%" -y ant            || EXIT /B
+
+:: Install bison and flex
+cinst -c "%BUILDCACHE%" -y winflexbison3  || EXIT /B
+
+:: zlib
+CD "%APPVEYOR_SCRIPTS%"                   || EXIT /B
+call build-zlib.bat                       || EXIT /B
+
+:: libevent
+CD "%APPVEYOR_SCRIPTS%"                   || EXIT /B
+call build-libevent.bat                   || EXIT /B
+
+:: python packages
+pip install backports.ssl_match_hostname ^
+            ipaddress ^
+            tornado ^
+            twisted                       || EXIT /B
+
+:: msinttypes - for MSVC2010 only
+SET MSINTTYPESURL=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/msinttypes/msinttypes-r26.zip
+IF "%COMPILER%" == "vc100" (
+  MKDIR "%WIN3P%\msinttypes"              || EXIT /B
+  CD "%WIN3P%\msinttypes"                 || EXIT /B
+  appveyor DownloadFile "%MSINTTYPESURL%" || EXIT /B
+  7z x "msinttypes-r26.zip"               || EXIT /B
+)
+
+:: Haskell (GHC) and cabal
+cinst -c "%BUILDCACHE%" -y ghc            || EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MSVC-appveyor-test.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSVC-appveyor-test.bat b/build/appveyor/MSVC-appveyor-test.bat
new file mode 100644
index 0000000..1737085
--- /dev/null
+++ b/build/appveyor/MSVC-appveyor-test.bat
@@ -0,0 +1,29 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+@ECHO OFF
+SETLOCAL EnableDelayedExpansion
+CD build\appveyor              || EXIT /B
+CALL cl_banner_test.bat        || EXIT /B
+CALL cl_setenv.bat             || EXIT /B
+CD "%BUILDDIR%"                || EXIT /B
+
+:: Add directories to the path to find DLLs of third party libraries so tests run
+SET PATH=%BOOST_LIBRARYDIR%;%OPENSSL_ROOT%\bin;%WIN3P%\zlib-inst\bin;%PATH%
+
+:: The stress test is long running on appveyor (2+ minutes)
+:: and not terribly useful with one core, so we disable it
+SET DISABLED_TESTS=StressTestNonBlocking
+
+ctest -C %CONFIGURATION% --timeout 600 -VV -E "(%DISABLED_TESTS%)" || EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MSYS-appveyor-build.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSYS-appveyor-build.bat b/build/appveyor/MSYS-appveyor-build.bat
new file mode 100644
index 0000000..b9d8955
--- /dev/null
+++ b/build/appveyor/MSYS-appveyor-build.bat
@@ -0,0 +1,47 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+@ECHO OFF
+SETLOCAL EnableDelayedExpansion
+
+CD build\appveyor                           || EXIT /B
+CALL cl_banner_build.bat                    || EXIT /B
+CALL cl_setenv.bat                          || EXIT /B
+
+SET BASH=C:\msys64\usr\bin\bash
+SET CMAKE=/c/msys64/mingw64/bin/cmake.exe
+
+@ECHO ON
+SET CMAKEARGS=-G\"%GENERATOR%\" ^
+  -DBoost_DEBUG=ON ^
+  -DBoost_NAMESPACE=libboost ^
+  -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% ^
+  -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^
+  -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+  -DCMAKE_C_COMPILER=gcc.exe ^
+  -DCMAKE_CXX_COMPILER=g++.exe ^
+  -DCMAKE_MAKE_PROGRAM=make.exe ^
+  -DCMAKE_INSTALL_PREFIX=%INSTDIR_MSYS% ^
+  -DOPENSSL_LIBRARIES=%OPENSSL_LIBRARIES% ^
+  -DOPENSSL_ROOT_DIR=%OPENSSL_ROOT% ^
+  -DOPENSSL_USE_STATIC_LIBS=ON ^
+  -DWITH_BOOST_STATIC=ON ^
+  -DWITH_JAVA=OFF ^
+  -DWITH_LIBEVENT=OFF ^
+  -DWITH_PYTHON=%WITH_PYTHON% ^
+  -DWITH_SHARED_LIB=OFF ^
+  -DWITH_STATIC_LIB=ON
+
+%BASH% -lc "mkdir %BUILDDIR_MSYS% && cd %BUILDDIR_MSYS% && %CMAKE% %SRCDIR_MSYS% %CMAKEARGS% && %CMAKE% --build . --config %CONFIGURATION% --target install" || EXIT /B
+@ECHO OFF

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MSYS-appveyor-install.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSYS-appveyor-install.bat b/build/appveyor/MSYS-appveyor-install.bat
new file mode 100644
index 0000000..252f47d
--- /dev/null
+++ b/build/appveyor/MSYS-appveyor-install.bat
@@ -0,0 +1,41 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+::
+:: Appveyor install script for MSYS
+:: Installs (or builds) third party packages we need
+::
+
+@ECHO OFF
+SETLOCAL EnableDelayedExpansion
+
+CD build\appveyor                          || EXIT /B
+CALL cl_banner_install.bat                 || EXIT /B
+CALL cl_setenv.bat                         || EXIT /B
+CALL cl_showenv.bat                        || EXIT /B
+
+SET PACKAGES=^
+  --needed -S bison flex ^
+  make ^
+  openssl openssl-devel ^
+  mingw-w64-x86_64-boost ^
+  mingw-w64-x86_64-cmake ^
+  mingw-w64-x86_64-toolchain ^
+  zlib zlib-devel
+
+:: omitting libevent-devel for now it is version 2.1.4 and doesn't play nice with MinGW
+
+%BASH% -lc "pacman --noconfirm -Syu"       || EXIT /B
+%BASH% -lc "pacman --noconfirm -Su"        || EXIT /B
+%BASH% -lc "pacman --noconfirm %PACKAGES%" || EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/MSYS-appveyor-test.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSYS-appveyor-test.bat b/build/appveyor/MSYS-appveyor-test.bat
new file mode 100644
index 0000000..0f37ec5
--- /dev/null
+++ b/build/appveyor/MSYS-appveyor-test.bat
@@ -0,0 +1,26 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+@ECHO OFF
+SETLOCAL EnableDelayedExpansion
+
+CD build\appveyor              || EXIT /B
+CALL cl_banner_test.bat        || EXIT /B
+CALL cl_setenv.bat             || EXIT /B
+CD "%BUILDDIR%"                || EXIT /B
+
+:: randomly fails on mingw; see Jira THRIFT-4106
+SET DISABLED_TESTS=concurrency_test
+
+%BASH% -lc "cd %BUILDDIR_MSYS% && ctest.exe -C %CONFIGURATION% --timeout 300 -VV -E '(%DISABLED_TESTS%)'" || EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/README.md
----------------------------------------------------------------------
diff --git a/build/appveyor/README.md b/build/appveyor/README.md
new file mode 100644
index 0000000..1a2aa30
--- /dev/null
+++ b/build/appveyor/README.md
@@ -0,0 +1,34 @@
+<!---
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Appveyor Build
+
+Appveyor is capable of building MSVC 2010 through 2015 as well as
+having the latest MSYS2/MinGW 64-bit environment.  It has many versions
+of boost and python installed as well.  See what appveyor has
+[installed on build workers](https://www.appveyor.com/docs/installed-software/).
+
+We run a matrix build on Appveyor and build the following combinations:
+
+* MinGW x64 (gcc 6.3.0)
+* MSVC 2010 x86, an older boost, an older python
+* MSVC 2015 x86/x64, the latest boost, the latest python
+* MSYS2 x64 (gcc 6.3.0) - this is a work in progress
+
+The Appveyor script takes the first four letters from the PROFILE specified in
+the environment stanza and runs these scripts in order:
+
+????-appveyor-install.bat will install third party libraries and set up the environment
+????-appveyor-build.bat will build with cmake
+????-appveyor-test.bat will run ctest

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/build-libevent.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/build-libevent.bat b/build/appveyor/build-libevent.bat
new file mode 100644
index 0000000..13c74ee
--- /dev/null
+++ b/build/appveyor/build-libevent.bat
@@ -0,0 +1,30 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+SETLOCAL EnableDelayedExpansion
+
+SET URLFILE=libevent-%LIBEVENT_VERSION%-stable.tar.gz
+SET URL=https://github.com/libevent/libevent/releases/download/release-%LIBEVENT_VERSION%-stable/%URLFILE%
+
+CD %WIN3P%                                       || EXIT /B
+appveyor DownloadFile %URL%                      || EXIT /B
+7z x %URLFILE% -so | 7z x -si -ttar > nul        || EXIT /B
+CD "libevent-%LIBEVENT_VERSION%-stable"          || EXIT /B
+nmake -f Makefile.nmake                          || EXIT /B
+mkdir lib                                        || EXIT /B
+move *.lib lib\                                  || EXIT /B
+move WIN32-Code\event2\* include\event2\         || EXIT /B
+move *.h include\                                || EXIT /B
+
+ENDLOCAL

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/build-zlib.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/build-zlib.bat b/build/appveyor/build-zlib.bat
new file mode 100644
index 0000000..d8811a1
--- /dev/null
+++ b/build/appveyor/build-zlib.bat
@@ -0,0 +1,49 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+SETLOCAL EnableDelayedExpansion
+
+SET PACKAGE=zlib-%ZLIB_VERSION%
+SET BUILDDIR=%WIN3P%\zlib-build
+SET INSTDIR=%WIN3P%\zlib-inst
+SET SRCDIR=%WIN3P%\%PACKAGE%
+SET URLFILE=%PACKAGE%.tar.gz
+
+:: This allows us to tolerate when the current version is archived
+SET URL=http://zlib.net/%URLFILE%
+SET FURL=http://zlib.net/fossils/%URLFILE%
+
+:: Download
+CD "%WIN3P%"                                                     || EXIT /B
+appveyor DownloadFile "%URL%"
+IF ERRORLEVEL 1 (
+    appveyor DownloadFile "%FURL%"                               || EXIT /B
+)
+7z x "%URLFILE%" -so | 7z x -si -ttar > nul                      || EXIT /B
+
+:: Generate
+MKDIR "%BUILDDIR%"                                               || EXIT /B
+CD "%BUILDDIR%"                                                  || EXIT /B
+cmake "%SRCDIR%" ^
+      -G"NMake Makefiles" ^
+      -DCMAKE_INSTALL_PREFIX="%INSTDIR%" ^
+      -DCMAKE_BUILD_TYPE="%CONFIGURATION%"                       || EXIT /B
+
+:: Build
+nmake /fMakefile install                                         || EXIT /B
+IF "%CONFIGURATION%" == "Debug" (
+    COPY "%BUILDDIR%\zlibd.pdb" "%INSTDIR%\bin\"                 || EXIT /B
+)
+
+ENDLOCAL

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/cl_banner_apache_thrift.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_banner_apache_thrift.bat b/build/appveyor/cl_banner_apache_thrift.bat
new file mode 100644
index 0000000..78f2a2a
--- /dev/null
+++ b/build/appveyor/cl_banner_apache_thrift.bat
@@ -0,0 +1,24 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+:: A visual indicator in a large log helps you locate things when scanning
+:: http://www.patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Apache%20Thrift
+
+ECHO/
+ECHO    ___                 __         ________       _ _____
+ECHO   / _ | ___  ___ _____/ /  ___   /_  __/ /  ____(_) _/ /_
+ECHO  / __ |/ _ \/ _ `/ __/ _ \/ -_)   / / / _ \/ __/ / _/ __/
+ECHO /_/ |_/ .__/\_,_/\__/_//_/\__/   /_/ /_//_/_/ /_/_/ \__/
+ECHO      /_/
+ECHO/

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/cl_banner_build.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_banner_build.bat b/build/appveyor/cl_banner_build.bat
new file mode 100644
index 0000000..60272f3
--- /dev/null
+++ b/build/appveyor/cl_banner_build.bat
@@ -0,0 +1,23 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+:: A visual indicator in a large log helps you locate things when scanning
+:: http://www.patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Build
+
+ECHO/
+ECHO    ___       _ __   __
+ECHO   / _ )__ __(_) /__/ /
+ECHO  / _  / // / / / _  /     @@@ BUILD
+ECHO /____/\_,_/_/_/\_,_/
+ECHO/

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/cl_banner_install.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_banner_install.bat b/build/appveyor/cl_banner_install.bat
new file mode 100644
index 0000000..fde3da2
--- /dev/null
+++ b/build/appveyor/cl_banner_install.bat
@@ -0,0 +1,23 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+:: A visual indicator in a large log helps you locate things when scanning
+:: http://www.patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Install
+
+ECHO/
+ECHO    ____         __       ____
+ECHO   /  _/__  ___ / /____ _/ / /
+ECHO  _/ // _ \(_-^</ __/ _ \/ / /     @@@ INSTALL
+ECHO /___/_//_/___/\__/\_,_/_/_/
+ECHO/

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/cl_banner_test.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_banner_test.bat b/build/appveyor/cl_banner_test.bat
new file mode 100644
index 0000000..44e2d10
--- /dev/null
+++ b/build/appveyor/cl_banner_test.bat
@@ -0,0 +1,23 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+:: A visual indicator in a large log helps you locate things when scanning
+:: http://www.patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Test
+
+ECHO/
+ECHO  ______        __
+ECHO /_  __/__ ___ / /_
+ECHO  / / / -_^|_-^</ __/     @@@ TEST
+ECHO /_/  \__/___/\__/
+ECHO/

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/cl_setcompiler.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_setcompiler.bat b/build/appveyor/cl_setcompiler.bat
new file mode 100644
index 0000000..b97da73
--- /dev/null
+++ b/build/appveyor/cl_setcompiler.bat
@@ -0,0 +1,63 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+::
+:: Detect the compiler edition we're building in.
+:: Set the COMPILER environment variable to one of:
+::   gcc   = MinGW / MSYS2 and gcc toolchain
+::   vc100 = Visual Studio 2010
+::   vc110 = Visual Studio 2012
+::   vc120 = Visual Studio 2013
+::   vc140 = Visual Studio 2015
+::   vc150 = Visual Studio 2017
+::
+:: Honors any existing COMPILER environment variable
+::   setting instead of overwriting it, to allow it
+::   to be forced if needed.
+::
+:: Sets ERRORLEVEL to 0 if COMPILER can be determined,
+::                 to 1 if it cannot.
+::
+
+IF DEFINED COMPILER (
+  ECHO [warn ] using existing environment variable COMPILER
+  EXIT /B 0
+)
+
+IF NOT "%PROFILE:~0,4%" == "MSVC" (
+  SET COMPILER=gcc
+) ELSE (
+  CALL :CHECK 16
+  IF !ERRORLEVEL! == 0 (SET COMPILER=vc100)
+  CALL :CHECK 17
+  IF !ERRORLEVEL! == 0 (SET COMPILER=vc110)
+  CALL :CHECK 18
+  IF !ERRORLEVEL! == 0 (SET COMPILER=vc120)
+  CALL :CHECK 19.00
+  IF !ERRORLEVEL! == 0 (SET COMPILER=vc140)
+  CALL :CHECK 19.10
+  IF !ERRORLEVEL! == 0 (SET COMPILER=vc150)
+)
+
+IF NOT DEFINED COMPILER (
+  ECHO [error] unable to determine the compiler edition
+  EXIT /B 1
+)
+
+ECHO [info ] detected compiler edition    %COMPILER%
+EXIT /B 0
+
+:CHECK
+cl /? 2>&1 | findstr /C:"Version %1%." > nul
+EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/cl_setenv.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_setenv.bat b/build/appveyor/cl_setenv.bat
new file mode 100644
index 0000000..d907d5e
--- /dev/null
+++ b/build/appveyor/cl_setenv.bat
@@ -0,0 +1,79 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+       IF "%PROFILE%" == "MSVC2010" (
+  CALL "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" %PLATFORM%
+) ELSE IF "%PROFILE%" == "MSVC2012" (
+  CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" %PLATFORM%
+) ELSE IF "%PROFILE%" == "MSVC2013" (
+  CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %PLATFORM%
+) ELSE IF "%PROFILE%" == "MSVC2015" (
+  CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PLATFORM%
+) ELSE IF "%PROFILE%" == "MSVC2017" (
+  CALL "C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC\vcvarsall.bat" %PLATFORM%
+) ELSE IF "%PROFILE%" == "MINGW" (
+  SET MSYS2_PATH_TYPE=stock
+) ELSE IF "%PROFILE%" == "MSYS" (
+  SET MSYS2_PATH_TYPE=stock
+) ELSE (
+  ECHO Unsupported PROFILE=%PROFILE% or PLATFORM=%PLATFORM%
+  EXIT /B 1
+)
+
+CALL cl_setcompiler.bat   || EXIT /B
+CALL cl_setgenerator.bat  || EXIT /B
+
+SET APPVEYOR_SCRIPTS=%APPVEYOR_BUILD_FOLDER%\build\appveyor
+SET BUILDCACHE=%APPVEYOR_BUILD_FOLDER%\buildcache
+SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\local-thrift-build
+SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\local-thrift-inst
+SET SRCDIR=%APPVEYOR_BUILD_FOLDER%
+
+SET BOOST_ROOT=C:\Libraries\boost_%BOOST_VERSION:.=_%
+SET BOOST_LIBRARYDIR=%BOOST_ROOT%\lib%PLATFORM:~-2,2%-msvc-%COMPILER:~-3,2%.0
+SET OPENSSL_ROOT=C:\OpenSSL-Win%PLATFORM:~-2,2%
+SET WIN3P=%APPVEYOR_BUILD_FOLDER%\thirdparty
+IF "%PYTHON_VERSION%" == "" (
+  SET WITH_PYTHON=OFF
+) ELSE (
+  SET WITH_PYTHON=ON
+  SET PATH=C:\Python%PYTHON_VERSION:.=%\scripts;C:\Python%PYTHON_VERSION:.=%;!PATH!
+)
+IF "%CONFIGURATION%" == "Debug" (SET ZLIB_STATIC_SUFFIX=d)
+
+IF NOT "%QT_VERSION%" == "" (
+  IF /i "%PLATFORM%" == "x64" SET QTEXT=_64
+  SET PATH=C:\Qt\%QT_VERSION%\%PROFILE%!QTEXT!\bin;!PATH!
+)
+
+IF NOT "%PROFILE:~0,4%" == "MSVC" (
+
+  SET BASH=C:\msys64\usr\bin\bash.exe
+  SET BOOST_ROOT=
+  SET BOOST_INCLUDEDIR=/mingw64/include
+  SET BOOST_LIBRARYDIR=/mingw64/lib
+  SET OPENSSL_LIBRARIES=/mingw64/lib
+  SET OPENSSL_ROOT=/mingw64
+  SET WIN3P=
+
+  !BASH! -lc "sed -i '/export PATH=\/mingw64\/bin/d' ~/.bash_profile && echo 'export PATH=/mingw64/bin:$PATH' >> ~/.bash_profile" || EXIT /B
+
+)
+
+SET BUILDDIR_MSYS=%BUILDDIR:\=/%
+SET BUILDDIR_MSYS=/c%BUILDDIR_MSYS:~2%
+SET INSTDIR_MSYS=%INSTDIR:\=/%
+SET INSTDIR_MSYS=/c%INSTDIR_MSYS:~2%
+SET SRCDIR_MSYS=%SRCDIR:\=/%
+SET SRCDIR_MSYS=/c%SRCDIR_MSYS:~2%

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/cl_setgenerator.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_setgenerator.bat b/build/appveyor/cl_setgenerator.bat
new file mode 100644
index 0000000..7ca9853
--- /dev/null
+++ b/build/appveyor/cl_setgenerator.bat
@@ -0,0 +1,74 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+::
+:: Detect the compiler edition we're building in and then
+:: set the GENERATOR environment variable to one of:
+::
+::  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
+::                                 Optional [arch] can be "Win64" or "ARM".
+::  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
+::                                 Optional [arch] can be "Win64" or "ARM".
+::  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
+::                                 Optional [arch] can be "Win64" or "ARM".
+::  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
+::                                 Optional [arch] can be "Win64" or "ARM".
+::  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
+::                                 Optional [arch] can be "Win64" or "IA64".
+::  MinGW Makefiles              = Generates makefiles for MinGW
+::  MSYS Makefiles               = Generates makefiles for MSYS
+::
+:: Honors any existing GENERATOR environment variable
+::   setting instead of overwriting it, to allow it
+::   to be forced if needed.
+::
+:: Sets ERRORLEVEL to 0 if GENERATOR can be determined,
+::                 to 1 if it cannot.
+::
+
+IF DEFINED GENERATOR (
+  ECHO [warn ] using existing environment variable GENERATOR
+  EXIT /B 0
+)
+
+
+IF "%PROFILE:~0,4%" == "MING" (
+  SET GENERATOR=MinGW Makefiles
+) ELSE IF "%PROFILE:~0,4%" == "MSYS" (
+  SET GENERATOR=MSYS Makefiles
+) ELSE (
+  IF /i "%PLATFORM%" == "x64" SET GENARCH= Win64
+  CALL :CHECK 16
+  IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 10 2010!GENARCH!
+  CALL :CHECK 17
+  IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 11 2012!GENARCH!
+  CALL :CHECK 18
+  IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 12 2013!GENARCH!
+  CALL :CHECK 19.00
+  IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 14 2015!GENARCH!
+  CALL :CHECK 19.10
+  IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 15 2017!GENARCH!
+)
+
+IF NOT DEFINED GENERATOR (
+  ECHO [error] unable to determine the CMake generator to use
+  EXIT /B 1
+)
+
+ECHO [info ] using CMake generator        %GENERATOR%
+EXIT /B 0
+
+:CHECK
+cl /? 2>&1 | findstr /C:"Version %1%." > nul
+EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/cl_showenv.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_showenv.bat b/build/appveyor/cl_showenv.bat
new file mode 100644
index 0000000..33dd660
--- /dev/null
+++ b/build/appveyor/cl_showenv.bat
@@ -0,0 +1,67 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+ECHO/
+ECHO ===============================================================================
+IF "%PROFILE:~0,4%" == "MSVC" (
+ECHO Versions
+ECHO -------------------------------------------------------------------------------
+ECHO boost                 = %BOOST_VERSION%
+ECHO libevent              = %LIBEVENT_VERSION%
+ECHO python                = %PYTHON_VERSION%
+ECHO qt                    = %QT_VERSION%
+ECHO zlib                  = %ZLIB_VERSION%
+ECHO/
+)
+ECHO Appveyor Variables
+ECHO -------------------------------------------------------------------------------
+ECHO APPVEYOR_BUILD_FOLDER = %APPVEYOR_BUILD_FOLDER%
+ECHO CONFIGURATION         = %CONFIGURATION%
+ECHO PLATFORM              = %PLATFORM%
+ECHO PROFILE               = %PROFILE%
+ECHO/
+ECHO Our Variables
+ECHO -------------------------------------------------------------------------------
+ECHO APPVEYOR_SCRIPTS      = %APPVEYOR_SCRIPTS%
+ECHO BOOST_ROOT            = %BOOST_ROOT%
+ECHO BOOST_INCLUDEDIR      = %BOOST_INCLUDEDIR%
+ECHO BOOST_LIBRARYDIR      = %BOOST_LIBRARYDIR%
+ECHO BUILDCACHE            = %BUILDCACHE%
+ECHO BUILDDIR              = %BUILDDIR%
+ECHO COMPILER              = %COMPILER%
+ECHO GENERATOR             = %GENERATOR%
+ECHO INSTDIR               = %INSTDIR%
+ECHO JAVA_HOME             = %JAVA_HOME%
+ECHO OPENSSL_ROOT          = %OPENSSL_ROOT%
+ECHO SRCDIR                = %SRCDIR%
+ECHO WIN3P                 = %WIN3P%
+ECHO WITH_PYTHON           = %WITH_PYTHON%
+ECHO ZLIB_STATIC_SUFFIX    = %ZLIB_STATIC_SUFFIX%
+IF NOT "%PROFILE:~0,4%" == "MSVC" (
+ECHO/
+ECHO MSYS2/MinGW
+ECHO -------------------------------------------------------------------------------
+ECHO BUILDDIR_MSYS         = %BUILDDIR_MSYS%
+ECHO INSTDIR_MSYS          = %INSTDIR_MSYS%
+ECHO MSYS2_PATH_TYPE       = %MSYS2_PATH_TYPE%
+ECHO SRCDIR_MSYS           = %SRCDIR_MSYS%
+ECHO PATH                  =
+C:\msys64\usr\bin\bash -lc "echo $PATH"
+)
+ECHO/
+ECHO Windows PATH
+ECHO -------------------------------------------------------------------------------
+ECHO %PATH%
+ECHO ===============================================================================
+ECHO/

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/download_openssl.py
----------------------------------------------------------------------
diff --git a/build/appveyor/download_openssl.py b/build/appveyor/download_openssl.py
deleted file mode 100644
index fcb72e5..0000000
--- a/build/appveyor/download_openssl.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import urllib.request
-import sys
-
-OUT = 'Win64OpenSSL.exe'
-
-URL_STR = 'https://slproweb.com/download/Win64OpenSSL-%s.exe'
-
-VERSION_MAJOR = 1
-VERSION_MINOR = 0
-VERSION_PATCH = 2
-VERSION_SUFFIX = 'j'
-VERSION_STR = '%d_%d_%d%s'
-
-TRY_COUNT = 4
-
-
-def main():
-    for patch in range(VERSION_PATCH, TRY_COUNT):
-        for suffix in range(TRY_COUNT):
-            if patch == VERSION_PATCH:
-                s = VERSION_SUFFIX
-            else:
-                s = 'a'
-            s = chr(ord(s) + suffix)
-            ver = VERSION_STR % (VERSION_MAJOR, VERSION_MINOR, patch, s)
-            url = URL_STR % ver
-            try:
-                with urllib.request.urlopen(url) as res:
-                    if res.getcode() == 200:
-                        with open(OUT, 'wb') as out:
-                            out.write(res.read())
-                            print('successfully downloaded from ' + url)
-                            return 0
-            except urllib.error.HTTPError:
-                pass
-            print('failed to download from ' + url, file=sys.stderr)
-    print('could not download openssl', file=sys.stderr)
-    return 1
-
-if __name__ == '__main__':
-    sys.exit(main())

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/appveyor/simulate-appveyor.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/simulate-appveyor.bat b/build/appveyor/simulate-appveyor.bat
new file mode 100644
index 0000000..b32c0da
--- /dev/null
+++ b/build/appveyor/simulate-appveyor.bat
@@ -0,0 +1,35 @@
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+::
+
+::
+:: Helps build thrift by pretending to be appveyor
+:: Usage:
+::   cd build\appveyor
+::   simulate-appveyor.bat [Debug|Release] [x86|x64] [MINGW|MSVC2015]
+::
+
+@ECHO OFF
+SETLOCAL EnableDelayedExpansion
+
+SET APPVEYOR_BUILD_FOLDER=%~dp0..\..
+SET CONFIGURATION=%1
+SET PLATFORM=%2
+SET PROFILE=%3
+
+CD %APPVEYOR_BUILD_FOLDER%
+CALL build\appveyor\%PROFILE:~0,4%-appveyor-install.bat || EXIT /B
+CD %APPVEYOR_BUILD_FOLDER%
+CALL build\appveyor\%PROFILE:~0,4%-appveyor-build.bat   || EXIT /B
+CD %APPVEYOR_BUILD_FOLDER%
+CALL build\appveyor\%PROFILE:~0,4%-appveyor-test.bat

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/cmake/DefineOptions.cmake
----------------------------------------------------------------------
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index c2bc717..93fe2c0 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -40,7 +40,7 @@ option(BUILD_LIBRARIES "Build Thrift libraries" ON)
 # and enables the library if all are found. This means the default is to build as
 # much as possible but leaving out libraries if their dependencies are not met.
 
-CMAKE_DEPENDENT_OPTION(WITH_BOOST_STATIC "Build with Boost static link library" OFF "NOT MSVC" ON)
+option(WITH_BOOST_STATIC "Build with Boost static link library" OFF)
 set(Boost_USE_STATIC_LIBS ${WITH_BOOST_STATIC})
 if (NOT WITH_BOOST_STATIC)
     add_definitions(-DBOOST_ALL_DYN_LINK)
@@ -194,16 +194,13 @@ MESSAGE_DEP(CABAL_FOUND "Cabal missing")
 message(STATUS " Library features:")
 message(STATUS "  Build shared libraries:                     ${WITH_SHARED_LIB}")
 message(STATUS "  Build static libraries:                     ${WITH_STATIC_LIB}")
-message(STATUS "  Build with ZLIB support:                    ${WITH_ZLIB}")
+message(STATUS "  Build with Boost static link library:       ${WITH_BOOST_STATIC}")
+message(STATUS "  Build with Boost thread support:            ${WITH_BOOSTTHREADS}")
+message(STATUS "  Build with C++ std::thread support:         ${WITH_STDTHREADS}")
 message(STATUS "  Build with libevent support:                ${WITH_LIBEVENT}")
+message(STATUS "  Build with OpenSSL support:                 ${WITH_OPENSSL}")
 message(STATUS "  Build with Qt4 support:                     ${WITH_QT4}")
 message(STATUS "  Build with Qt5 support:                     ${WITH_QT5}")
-message(STATUS "  Build with OpenSSL support:                 ${WITH_OPENSSL}")
-message(STATUS "  Build with Boost thread support:            ${WITH_BOOSTTHREADS}")
-message(STATUS "  Build with C++ std::thread support:         ${WITH_STDTHREADS}")
-message(STATUS "  Build with Boost static link library:       ${WITH_BOOST_STATIC}")
-if(MSVC)
-    message(STATUS "    - Enabled for Visual C++")
-endif()
+message(STATUS "  Build with ZLIB support:                    ${WITH_ZLIB}")
 message(STATUS "----------------------------------------------------------")
 endmacro(PRINT_CONFIG_SUMMARY)

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/cmake/DefinePlatformSpecifc.cmake
----------------------------------------------------------------------
diff --git a/build/cmake/DefinePlatformSpecifc.cmake b/build/cmake/DefinePlatformSpecifc.cmake
index f70ec0d..28cc5c2 100644
--- a/build/cmake/DefinePlatformSpecifc.cmake
+++ b/build/cmake/DefinePlatformSpecifc.cmake
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+# Uncomment this to show some basic cmake variables about platforms
+# include (NewPlatformDebug)
 
 # Visual Studio specific options
 if(MSVC)
@@ -96,16 +98,12 @@ elseif(WITH_STDTHREADS)
   add_definitions("-DUSE_STD_THREAD=1")
 endif()
 
-# GCC and Clang.
+# GCC and Clang: use C++11
 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-  # FIXME -pedantic can not be used at the moment because of: https://issues.apache.org/jira/browse/THRIFT-2784
-  #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall -Wextra -pedantic")
-  # FIXME enabling c++11 breaks some Linux builds on Travis by triggering a g++ bug, see
-  # https://travis-ci.org/apache/thrift/jobs/58017022
-  # on the other hand, both MacOSX and FreeBSD need c++11
-  if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall -Wextra")
+  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.6")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
   endif()
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -Wextra -pedantic")
 endif()
 
 # If gcc older than 4.8 is detected and plugin support was requested, fail fast

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/build/cmake/NewPlatformDebug.cmake
----------------------------------------------------------------------
diff --git a/build/cmake/NewPlatformDebug.cmake b/build/cmake/NewPlatformDebug.cmake
new file mode 100644
index 0000000..76cac15
--- /dev/null
+++ b/build/cmake/NewPlatformDebug.cmake
@@ -0,0 +1,43 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# For debugging new platforms, just to see what some environment flags are...
+#
+macro(SHOWFLAG flag)
+  message(STATUS "${flag} = ${${flag}}")
+endmacro(SHOWFLAG)
+
+set(NEWPLATFORMDEBUG ON)
+
+if(NEWPLATFORMDEBUG)
+  SHOWFLAG("APPLE")
+  SHOWFLAG("BORLAND")
+  SHOWFLAG("CMAKE_C_COMPILER_ID")
+  SHOWFLAG("CMAKE_CXX_COMPILER_ID")
+  SHOWFLAG("CMAKE_COMPILER_IS_GNUCC")
+  SHOWFLAG("CMAKE_COMPILER_IS_GNUCXX")
+  SHOWFLAG("CYGWIN")
+  SHOWFLAG("MINGW")
+  SHOWFLAG("MSVC")
+  SHOWFLAG("MSYS")
+  SHOWFLAG("UNIX")
+  SHOWFLAG("WATCOM")
+  SHOWFLAG("WIN32")
+endif(NEWPLATFORMDEBUG)

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
index c6df8e9..e484afa 100644
--- a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
@@ -1727,7 +1727,7 @@ void t_cpp_generator::generate_service(t_service* tservice) {
 
   f_header_ << endl << ns_open_ << endl << endl;
 
-  f_header_ << "#ifdef _WIN32\n"
+  f_header_ << "#ifdef _MSC_VER\n"
                "  #pragma warning( push )\n"
                "  #pragma warning (disable : 4250 ) //inheriting methods via dominance \n"
                "#endif\n\n";
@@ -1783,7 +1783,7 @@ void t_cpp_generator::generate_service(t_service* tservice) {
     generate_service_async_skeleton(tservice);
   }
 
-  f_header_ << "#ifdef _WIN32\n"
+  f_header_ << "#ifdef _MSC_VER\n"
                "  #pragma warning( pop )\n"
                "#endif\n\n";
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index d07b400..9a1ef10 100755
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -68,7 +68,7 @@ if (NOT WINCE)
 endif()
 
 
-if (WIN32)
+if (WIN32 AND NOT MSYS)
     list(APPEND thriftcpp_SOURCES
         src/thrift/windows/TWinsockSingleton.cpp
         src/thrift/windows/SocketPair.cpp

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/src/thrift/concurrency/StdMutex.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/concurrency/StdMutex.cpp b/lib/cpp/src/thrift/concurrency/StdMutex.cpp
index 69678a2..49c18d8 100644
--- a/lib/cpp/src/thrift/concurrency/StdMutex.cpp
+++ b/lib/cpp/src/thrift/concurrency/StdMutex.cpp
@@ -38,6 +38,7 @@ namespace concurrency {
 class Mutex::impl : public std::timed_mutex {};
 
 Mutex::Mutex(Initializer init) : impl_(new Mutex::impl()) {
+  ((void)init);
 }
 
 void* Mutex::getUnderlyingImpl() const {
@@ -61,6 +62,7 @@ void Mutex::unlock() const {
 }
 
 void Mutex::DEFAULT_INITIALIZER(void* arg) {
+  ((void)arg);
 }
 }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/src/thrift/protocol/TProtocol.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/protocol/TProtocol.h b/lib/cpp/src/thrift/protocol/TProtocol.h
index 448c4fe..276cefa 100644
--- a/lib/cpp/src/thrift/protocol/TProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TProtocol.h
@@ -601,7 +601,7 @@ public:
 
   virtual boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) = 0;
   virtual boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> inTrans,
-						   boost::shared_ptr<TTransport> outTrans) {
+               boost::shared_ptr<TTransport> outTrans) {
     (void)outTrans;
     return getProtocol(inTrans);
   }
@@ -672,7 +672,7 @@ uint32_t skip(Protocol_& prot, TType type) {
     return prot.readBool(boolv);
   }
   case T_BYTE: {
-    int8_t bytev;
+    int8_t bytev = 0;
     return prot.readByte(bytev);
   }
   case T_I16: {

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/src/thrift/transport/TPipe.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TPipe.cpp b/lib/cpp/src/thrift/transport/TPipe.cpp
index 75ce5d2..0f48903 100644
--- a/lib/cpp/src/thrift/transport/TPipe.cpp
+++ b/lib/cpp/src/thrift/transport/TPipe.cpp
@@ -346,7 +346,7 @@ string TPipe::getPipename() {
 }
 
 void TPipe::setPipename(const std::string& pipename) {
-  if (pipename.find("\\\\") == -1)
+  if (pipename.find("\\\\") == std::string::npos)
     pipename_ = "\\\\.\\pipe\\" + pipename;
   else
     pipename_ = pipename;

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/src/thrift/transport/TPipeServer.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp
index cf6b410..5a07f30 100644
--- a/lib/cpp/src/thrift/transport/TPipeServer.cpp
+++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp
@@ -361,7 +361,7 @@ bool TNamedPipeServer::createNamedPipe(const TAutoCrit & /*lockProof*/) {
     GlobalOutput.perror("TPipeServer::TCreateNamedPipe() GLE=", lastError);
     throw TTransportException(TTransportException::NOT_OPEN,
                               "TCreateNamedPipe() failed",
-							  lastError);
+                lastError);
     return false;
   }
 
@@ -409,7 +409,7 @@ string TPipeServer::getPipename() {
 }
 
 void TPipeServer::setPipename(const std::string& pipename) {
-  if (pipename.find("\\\\") == -1)
+  if (pipename.find("\\\\") == std::string::npos)
     pipename_ = "\\\\.\\pipe\\" + pipename;
   else
     pipename_ = pipename;

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/src/thrift/transport/TServerSocket.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TServerSocket.cpp b/lib/cpp/src/thrift/transport/TServerSocket.cpp
index 8b65319..dc698d5 100644
--- a/lib/cpp/src/thrift/transport/TServerSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TServerSocket.cpp
@@ -609,7 +609,7 @@ shared_ptr<TTransport> TServerSocket::acceptImpl() {
   THRIFT_SOCKET clientSocket
       = ::accept(serverSocket_, (struct sockaddr*)&clientAddress, (socklen_t*)&size);
 
-  if (clientSocket == -1) {
+  if (clientSocket == THRIFT_INVALID_SOCKET) {
     int errno_copy = THRIFT_GET_SOCKET_ERROR;
     GlobalOutput.perror("TServerSocket::acceptImpl() ::accept() ", errno_copy);
     throw TTransportException(TTransportException::UNKNOWN, "accept()", errno_copy);

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/src/thrift/transport/TSocket.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp
index 9fad590..21a9aca 100644
--- a/lib/cpp/src/thrift/transport/TSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSocket.cpp
@@ -763,7 +763,7 @@ void TSocket::setSendTimeout(int ms) {
 void TSocket::setKeepAlive(bool keepAlive) {
   keepAlive_ = keepAlive;
 
-  if (socket_ == -1) {
+  if (socket_ == THRIFT_INVALID_SOCKET) {
     return;
   }
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/src/thrift/windows/config.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h
index f54cb5e..bc4aa42 100644
--- a/lib/cpp/src/thrift/windows/config.h
+++ b/lib/cpp/src/thrift/windows/config.h
@@ -66,7 +66,9 @@
 #define SIGNED_RIGHT_SHIFT_IS 1
 #endif
 
+#ifndef __MINGW32__
 #pragma warning(disable : 4996) // Deprecated posix name.
+#endif
 
 #define HAVE_GETTIMEOFDAY 1
 #define HAVE_SYS_STAT_H 1
@@ -97,11 +99,14 @@ typedef boost::uint8_t uint8_t;
 // windows
 #include <Winsock2.h>
 #include <ws2tcpip.h>
-#ifdef _WIN32_WCE
-#pragma comment(lib, "Ws2.lib")
-#else
-#pragma comment(lib, "Ws2_32.lib")
-#pragma comment(lib, "advapi32.lib") // For security APIs in TPipeServer
-#pragma comment(lib, "Shlwapi.lib")  // For StrStrIA in TPipeServer
-#endif
+#ifndef __MINGW32__
+  #ifdef _WIN32_WCE
+  #pragma comment(lib, "Ws2.lib")
+  #else
+  #pragma comment(lib, "Ws2_32.lib")
+  #pragma comment(lib, "advapi32.lib") // For security APIs in TPipeServer
+  #pragma comment(lib, "Shlwapi.lib")  // For StrStrIA in TPipeServer
+  #endif
+#endif // __MINGW32__
+
 #endif // _THRIFT_WINDOWS_CONFIG_H_

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/test/Base64Test.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/Base64Test.cpp b/lib/cpp/test/Base64Test.cpp
index e9e86dd..7686e4e 100644
--- a/lib/cpp/test/Base64Test.cpp
+++ b/lib/cpp/test/Base64Test.cpp
@@ -37,6 +37,10 @@ void setupTestData(int i, uint8_t* data, int& len) {
 }
 
 void checkEncoding(uint8_t* data, int len) {
+#ifdef NDEBUG
+  ((void)data);
+#endif
+
   for (int i = 0; i < len; i++) {
     BOOST_ASSERT(isalnum(data[i]) || data[i] == '/' || data[i] == '+');
   }

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/lib/cpp/test/CMakeLists.txt b/lib/cpp/test/CMakeLists.txt
index b7a7798..ef3d417 100644
--- a/lib/cpp/test/CMakeLists.txt
+++ b/lib/cpp/test/CMakeLists.txt
@@ -79,7 +79,7 @@ set(UnitTest_SOURCES
     TServerTransportTest.cpp
 )
 
-if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC)
+if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC AND NOT MINGW)
     list(APPEND UnitTest_SOURCES RWMutexStarveTest.cpp)
 endif()
 
@@ -112,7 +112,7 @@ LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift)
 if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
 target_link_libraries(TInterruptTest -lrt)
 endif ()
-add_test(NAME TInterruptTest COMMAND TInterruptTest "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
+add_test(NAME TInterruptTest COMMAND TInterruptTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
 
 add_executable(TServerIntegrationTest TServerIntegrationTest.cpp)
 target_link_libraries(TServerIntegrationTest
@@ -317,7 +317,7 @@ LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift)
 if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
 target_link_libraries(SecurityTest -lrt)
 endif ()
-add_test(NAME SecurityTest COMMAND SecurityTest "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
+add_test(NAME SecurityTest COMMAND SecurityTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
 
 endif()
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/test/TFileTransportTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/TFileTransportTest.cpp b/lib/cpp/test/TFileTransportTest.cpp
index 82e84e8..700a1ac 100644
--- a/lib/cpp/test/TFileTransportTest.cpp
+++ b/lib/cpp/test/TFileTransportTest.cpp
@@ -83,7 +83,7 @@ public:
   void fsync(int fd) {
     (void)fd;
     FsyncCall call;
-    gettimeofday(&call.time, NULL);
+    THRIFT_GETTIMEOFDAY(&call.time, NULL);
     calls_.push_back(call);
   }
 
@@ -100,6 +100,7 @@ class TempFile {
 public:
   TempFile(const char* directory, const char* prefix) {
   #ifdef __MINGW32__
+    ((void)directory);
     size_t path_len = strlen(prefix) + 8;
     path_ = new char[path_len];
     snprintf(path_, path_len, "%sXXXXXX", prefix);
@@ -208,9 +209,9 @@ BOOST_AUTO_TEST_CASE(test_destructor) {
     struct timeval start;
     struct timeval end;
 
-    gettimeofday(&start, NULL);
+    THRIFT_GETTIMEOFDAY(&start, NULL);
     delete transport;
-    gettimeofday(&end, NULL);
+    THRIFT_GETTIMEOFDAY(&end, NULL);
 
     int delta = time_diff(&start, &end);
 
@@ -331,13 +332,13 @@ BOOST_AUTO_TEST_CASE(test_noop_flush) {
   transport.write(buf, 1);
 
   struct timeval start;
-  gettimeofday(&start, NULL);
+  THRIFT_GETTIMEOFDAY(&start, NULL);
 
   for (unsigned int n = 0; n < 10; ++n) {
     transport.flush();
 
     struct timeval now;
-    gettimeofday(&now, NULL);
+    THRIFT_GETTIMEOFDAY(&now, NULL);
 
     // Fail if at any point we've been running for longer than half a second.
     // (With the buggy code, TFileTransport used to take 3 seconds per flush())

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/test/TSSLSocketInterruptTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/TSSLSocketInterruptTest.cpp b/lib/cpp/test/TSSLSocketInterruptTest.cpp
index ba43daf..bf5c7d7 100644
--- a/lib/cpp/test/TSSLSocketInterruptTest.cpp
+++ b/lib/cpp/test/TSSLSocketInterruptTest.cpp
@@ -214,7 +214,7 @@ void peekerWorker(boost::shared_ptr<TTransport> tt, bool expectedResult) {
   uint8_t buf[400];
   try {
     tt->read(buf, 1);
-    tt->peek();
+    BOOST_CHECK_EQUAL(expectedResult, tt->peek());
   } catch (const TTransportException& tx) {
     BOOST_CHECK_EQUAL(TTransportException::TIMED_OUT, tx.getType());
   }

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/cpp/test/ZlibTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/ZlibTest.cpp b/lib/cpp/test/ZlibTest.cpp
index a4387a9..25db4b8 100644
--- a/lib/cpp/test/ZlibTest.cpp
+++ b/lib/cpp/test/ZlibTest.cpp
@@ -21,7 +21,7 @@
 #define _GNU_SOURCE // needed for getopt_long
 #endif
 
-#if (_MSC_VER <= 1700)
+#if defined(_MSC_VER) && (_MSC_VER <= 1700)
 // polynomial and std::fill_t warning happens in MSVC 2010, 2013, maybe others
 // https://svn.boost.org/trac/boost/ticket/11426
 #pragma warning(disable:4996)

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/java/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/lib/java/CMakeLists.txt b/lib/java/CMakeLists.txt
index 57b97f1..f7a1a63 100644
--- a/lib/java/CMakeLists.txt
+++ b/lib/java/CMakeLists.txt
@@ -74,7 +74,7 @@ else(ANDROID)
 
     if(BUILD_TESTING)
         add_test(NAME JavaTest
-                 COMMAND ${Ant_EXECUTABLE} ${ANT_FLAGS} -Dbuild.dir="${CMAKE_CURRENT_BINARY_DIR}" -Dthrift.compiler="${THRIFT_COMPILER}" -f build.xml test
+                 COMMAND ${Ant_EXECUTABLE} ${ANT_FLAGS} -Dbuild.dir=${CMAKE_CURRENT_BINARY_DIR} -Dthrift.compiler=${THRIFT_COMPILER} -f build.xml test
                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
     endif()
 endif(ANDROID)

http://git-wip-us.apache.org/repos/asf/thrift/blob/07f59971/lib/py/src/ext/module.cpp
----------------------------------------------------------------------
diff --git a/lib/py/src/ext/module.cpp b/lib/py/src/ext/module.cpp
index 34ec7f6..7158b8f 100644
--- a/lib/py/src/ext/module.cpp
+++ b/lib/py/src/ext/module.cpp
@@ -87,12 +87,7 @@ static PyObject* decode_impl(PyObject* args) {
   }
 
   T protocol;
-#ifdef _MSC_VER
-  // workaround strange VC++ 2015 bug where #else path does not compile
-  int32_t default_limit = INT32_MAX;
-#else
-  int32_t default_limit = std::numeric_limits<int32_t>::max();
-#endif
+  int32_t default_limit = (std::numeric_limits<int32_t>::max)();
   protocol.setStringLengthLimit(
       as_long_then_delete(PyObject_GetAttr(oprot, INTERN_STRING(string_length_limit)),
                           default_limit));