THRIFT-3973: Provide some tools to make it easier to build thrift C++ on Windows
Client: C++

This closes #1162
diff --git a/build/wincpp/scripts/cl_setarch.bat b/build/wincpp/scripts/cl_setarch.bat
new file mode 100644
index 0000000..9570a1e
--- /dev/null
+++ b/build/wincpp/scripts/cl_setarch.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.
+:: 
+
+::
+:: Detect the architecture we're building for.
+:: Set the ARCH environment variable to one of:
+::   win32
+::   x64
+::
+:: Honors any existing ARCH environment variable
+::   setting instead of overwriting it, to allow it
+::   to be forced if needed.
+::
+:: Sets ERRORLEVEL to 0 if ARCH can be determined,
+::                 to 1 if it cannot.
+::
+
+IF DEFINED ARCH (
+  ECHO [warn ] using existing environment variable ARCH
+  EXIT /B 0
+)
+
+CALL :CHECK x64
+IF %ERRORLEVEL% == 0 (SET ARCH=x64) ELSE (SET ARCH=win32)
+
+IF NOT DEFINED ARCH (
+  ECHO [error] unable to determine the target architecture
+  EXIT /B 1
+)
+
+ECHO [info ] detected target architecture %ARCH%
+EXIT /B 0
+
+:CHECK
+cl /? 2>&1 | findstr /C:" for %1%" > nul
+EXIT /B %ERRORLEVEL%
diff --git a/build/wincpp/scripts/cl_setcompiler.bat b/build/wincpp/scripts/cl_setcompiler.bat
new file mode 100644
index 0000000..8405d76
--- /dev/null
+++ b/build/wincpp/scripts/cl_setcompiler.bat
@@ -0,0 +1,58 @@
+::
+:: 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:
+::   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
+)
+
+CALL :CHECK 16
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED COMPILER SET COMPILER=vc100)
+CALL :CHECK 17
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED COMPILER SET COMPILER=vc110)
+CALL :CHECK 18
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED COMPILER SET COMPILER=vc120)
+CALL :CHECK 19.00
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED COMPILER SET COMPILER=vc140)
+CALL :CHECK 19.10
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED COMPILER 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 %ERRORLEVEL%
diff --git a/build/wincpp/scripts/cl_setgenerator.bat b/build/wincpp/scripts/cl_setgenerator.bat
new file mode 100644
index 0000000..bae2742
--- /dev/null
+++ b/build/wincpp/scripts/cl_setgenerator.bat
@@ -0,0 +1,69 @@
+::
+:: 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".
+::
+:: 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.
+::
+:: Requires cl_setarch.bat to have been executed or the ARCH environment
+:: variable to be set.
+::
+
+IF "%ARCH%" == "x64" (SET GENARCH= Win64)
+
+IF DEFINED GENERATOR (
+  ECHO [warn ] using existing environment variable GENERATOR
+  EXIT /B 0
+)
+
+CALL :CHECK 16
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED GENERATOR SET GENERATOR=Visual Studio 10 2010%GENARCH%)
+CALL :CHECK 17
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED GENERATOR SET GENERATOR=Visual Studio 11 2012%GENARCH%)
+CALL :CHECK 18
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED GENERATOR SET GENERATOR=Visual Studio 12 2013%GENARCH%)
+CALL :CHECK 19.00
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED GENERATOR SET GENERATOR=Visual Studio 14 2015%GENARCH%)
+CALL :CHECK 19.10
+IF %ERRORLEVEL% == 0 (IF NOT DEFINED GENERATOR 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 %ERRORLEVEL%
diff --git a/build/wincpp/scripts/tpversions.bat b/build/wincpp/scripts/tpversions.bat
new file mode 100644
index 0000000..d80c868
--- /dev/null
+++ b/build/wincpp/scripts/tpversions.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.
+:: 
+
+::
+:: Set the versions of third party libraries to use.
+::
+
+IF NOT DEFINED TP_BOOST_VERSION    SET TP_BOOST_VERSION=1_62_0
+IF NOT DEFINED TP_LIBEVENT_VERSION SET TP_LIBEVENT_VERSION=2.1.7rc2
+IF NOT DEFINED TP_OPENSSL_VERSION  SET TP_OPENSSL_VERSION=1.1.0c
+IF NOT DEFINED TP_ZLIB_VERSION     SET TP_ZLIB_VERSION=1.2.9
+
+EXIT /B 0