Для себя делал кучу батников для быстрой настройки среды и сборки OpenSSL и MySQL
Настройка среды
DOS
@echo off
echo Setting up environment...
if "%1" == "" goto x86
if "%1" == x86 goto x86
if "%1" == x64 goto x64
:x86
set PERL=<Path_To_Perl_32>\bin\
set PYTHON=<Path_To_Python_32>\
set RUBY=<Path_To_Rubi_32>\bin\
set NASM=<Path_To_NAsm_32>\
set CMAKE=<Path_To_CMake_32>\bin\
goto usage
:x64
set PERL=<Path_To_Perl_64>\bin\
set PYTHON=<Path_To_Python_64>\
set RUBY=<Path_To_Rubi_64>\bin\
set NASM=<Path_To_NAsm_64>\
set CMAKE=<Path_To_CMake_64>\bin\
goto usage
:usage
set PATH=%PERL%;%PYTHOM%;%RUBY%;%NASM%;%CMAKE%;%PATH%
Сборка OpenSSL
DOS
echo Build OpenSSL
set OPENSSLSRC=<Path_To_OpenSSL_SRC>\
set OPENSSLINSTALL=<Path_Where_Will_Be_Installes_OpenSSL_Builds>\
cd %OPENSSLSRC%
set LNKD=Shared
set DMG=Release
if "%1" == "" goto x86
if "%1" == x86 goto x86
if "%1" == x64 goto x64
goto x86
:x86
set_vs_evn.bat x86
set VCARCH=VC-WIN32
set ORCH=32
goto testdebug
:x64
set_vs_evn.bat x64
set VCARCH=VC-WIN64A
set ORCH=64
goto testdebug
:testdebug
if "%2" == "" goto teststatic
if "%2" == "/release" goto teststatic
if "%2" == "/debug" goto makedebug
if "%2" == "release" goto teststatic
if "%2" == "debug" goto makedebug
if "%3" == "" goto teststatic
if "%3" == "/release" goto teststatic
if "%3" == "/debug" goto makedebug
if "%3" == "release" goto teststatic
if "%3" == "debug" goto makedebug
goto teststatic
:makedebug
set VCARCH=debug-%VCARCH%
set DMG=Debug
goto teststatic
:teststatic
if "%2" == "" goto configure
if "%2" == "/shared" goto configure
if "%2" == "/static" goto makestatic
if "%2" == "shared" goto configure
if "%2" == "static" goto makestatic
if "%3" == "" goto configure
if "%3" == "/shared" goto configure
if "%3" == "/static" goto makestatic
if "%3" == "shared" goto configure
if "%3" == "static" goto makestatic
goto configure
:makestatic
set LNKD=Static
goto configure
:configure
perl Configure %VCARCH% --prefix=%OPENSSLINSTALL%\OpenSSL_%ORCH%_%LNKD%_%DMG%
ms\do_ms
if "%LNKD" == "Shared" goto sharedbuild
if "%LNKD" == "Static" goto staticbuild
goto sharedbuild
:sharedbuild
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak install
goto :eof
:staticbuild
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
goto :eof
Сборка MySQL
DOS
echo Build MySSL
set MYSQLSRC=<Path_To_MySQL_SRC>\
set BOOSTSRC=<Path_To_BOOST_SRC>\
set BUILDROOT=<Path_For_Build_MySQL>\
cd %BUILDROOT%
if "%1" == "" goto x86
if "%1" == x86 goto x86
if "%1" == x64 goto x64
goto x86
:x86
set_vs_evn.bat x86
set VCARCH="Visual Studio 14 2015"
set ORCH=32
goto testdebug
:x64
set_vs_evn.bat x64
set VCARCH="Visual Studio 14 2015 Win64"
set ORCH=64
goto testdebug
:testdebug
if "%2" == "" goto makerelease
if "%2" == "/release" goto makerelease
if "%2" == "release" goto makerelease
if "%2" == "/debug" goto makedebug
if "%2" == "debug" goto makedebug
goto makerelease
:makedebug
set DMG=Debug
goto configureandbuild
:makerelease
set DMG=Release
goto configureandbuild
:configureandbuild
mkdir %BUILDROOT%\MySQL_%ORCH%_%DMG%
cd %BUILDROOT%\MySQL_%ORCH%_%DMG%
cmake %MYSQLSRC% -G %VCARCH% -DWITH_BOOST=%BOOSTSRC%
devenv.com MySQL.sln /build %DMG%
goto :eof
Ну а сама сборка
DOS
set_common_evn.bat
"c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
D:
cd D:\
build_OpenSSL.bat x64 release static
build_OpenSSL.bat x64 debug static
cd <Path_Where_Will_Be_Installes_OpenSSL_Builds>\OpenSSL_x86_Static_Debug_VisualStudio\lib
REN libeay32.lib libeay32D.lib
REN ssleay32.lib ssleay32D.lib
cd D:\
build_MySQL.bat x64 release
Далее правлю Src\qtbase\mkspecs\common\msvc-desktop.conf
QMAKE_CFLAGS_RELEASE = -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MTdd
Ну и в каталоге сборки Qt выполняю
DOS
..\..\Src\configure.bat -static -debug-and-release -platform win32-msvc2015 -c++std c++11 -prefix "..\..\..\..\..\Qt\5.7\msvc2015_x64_static" -opensource -confirm-license -nomake examples -nomake tests -make tools -qml-debug -opengl dynamic -system-proxies -make libs -qt-pcre -qt-libpng -qt-libjpeg -qt-zlib -qt-freetype -qt-sql-sqlite -qt-sql-odbc -qt-sql-mysql -openssl -openssl-linked OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_RELEASE="-llibeay32MT -lssleay32MT" OPENSSL_LIBS_DEBUG="-llibeay32MTd -lssleay32MTd" -l mysqlclient -I "<mysql-%Version%\include>l" -I "<Path_Where_Will_Be_Installes_OpenSSL_Builds>\OpenSSL_x86_Static_Release_VisualStudio\lib\include" -L "<Path_For_Build_MySQL>\libmysql\Release" -L "<Path_Where_Will_Be_Installes_OpenSSL_Builds>\OpenSSL_x86_Static_Debug_VisualStudio\lib" -L "<Path_Where_Will_Be_Installes_OpenSSL_Builds>\OpenSSL_x86_Static_Relesa_VisualStudio\lib" -L "c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64"
nmake /nologo
nmake /nologo install
mysql-%Version%\include можно взять в официальном пакете MySQL.
А вот на сборке версии для MinGW-W64 я спотыкаюсь на ошибках сборки MySQL и Qt.