From 2a561da7676dadd542d3dc775d2516c622ad4b83 Mon Sep 17 00:00:00 2001 From: Steffen Olszewski Date: Sat, 14 Jul 2018 18:49:33 +0200 Subject: [PATCH] Add support for MSVC 2017 Use the vswhere utility to detect the installation assuming the documentation is correct and this is always installed in a fixed location. --- wxBuild_wxWidgets.bat | 64 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/wxBuild_wxWidgets.bat b/wxBuild_wxWidgets.bat index 14a7b47..c8109fd 100644 --- a/wxBuild_wxWidgets.bat +++ b/wxBuild_wxWidgets.bat @@ -28,7 +28,7 @@ :: V1.14 - Added support for VC 14.0 and external 3rd party libraries ::************************************************************************** SETLOCAL -set WXBUILD_VERSION=1.14 +set WXBUILD_VERSION=1.15 set WXBUILD_APPNAME=wxBuild_wxWidgets :: MinGW Gcc install location. This must match your systems configuration. set GCCDIR=C:\MinGW @@ -79,6 +79,10 @@ if %1 == VC140 goto SETUP_VC140_BUILD_ENVIRONMENT if %1 == vc140 goto SETUP_VC140_BUILD_ENVIRONMENT if %1 == VC140_64 goto SETUP_VC140_64_BUILD_ENVIRONMENT if %1 == vc140_64 goto SETUP_VC140_64_BUILD_ENVIRONMENT +if %1 == VC141 goto SETUP_VC141_BUILD_ENVIRONMENT +if %1 == vc141 goto SETUP_VC141_BUILD_ENVIRONMENT +if %1 == VC141_64 goto SETUP_VC141_64_BUILD_ENVIRONMENT +if %1 == vc141_64 goto SETUP_VC141_64_BUILD_ENVIRONMENT if %1 == MINGW goto SETUP_GCC_BUILD_ENVIRONMENT if %1 == mingw goto SETUP_GCC_BUILD_ENVIRONMENT if %1 == MINGW4 goto SETUP_GCC4_BUILD_ENVIRONMENT @@ -357,6 +361,62 @@ set BAKE_FORMAT=msvc set BAKE_OPTIONS_FILE=config.vc goto START +:SETUP_VC141_BUILD_ENVIRONMENT +:: Add the VS 2017 includes. +echo Setting environment for Visual C++ 14.1... +echo. +for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( + set InstallDir=%%i +) +if not exist "%InstallDir%\Common7\Tools\vsdevcmd.bat" ( + echo ERROR OCCURED! + echo Compiler not found. + goto END +) +call "%InstallDir%\Common7\Tools\vsdevcmd.bat" -no_logo -arch=x86 +set INCLUDE=%WXWIN%\include;%INCLUDE% +:: -- Setup the make executable and the actual makefile name -- +set MAKE=nmake +set MAKEFILE=makefile.vc +set FLAGS=USE_ODBC=1 USE_OPENGL=1 USE_QA=1 USE_GDIPLUS=1 CXXFLAGS=/DNEED_PBT_H=0 +set COMPILER_VERSION=141 +set COMPILER_NAME=vs2017 +set COMPILER_ARCH=32 +set BAKE_FORMAT=msvc +set BAKE_OPTIONS_FILE=config.vc +goto START + +:SETUP_VC141_64_BUILD_ENVIRONMENT +:: Add the VS 2017 64-bit includes. +echo Setting environment for Visual C++ 14.1 64-bit... +echo. +set CPU=AMD64 +set HOSTARCH=x86 +echo Determining Processor Architecture for VC141 64-bit Build. +if %PROCESSOR_ARCHITECTURE% == AMD64 set HOSTARCH=amd64 +echo Determined %HOSTARCH% +echo. +for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( + set InstallDir=%%i +) +if not exist "%InstallDir%\Common7\Tools\vsdevcmd.bat" ( + echo ERROR OCCURED! + echo Compiler not found. + goto END +) +call "%InstallDir%\Common7\Tools\vsdevcmd.bat" -no_logo -arch=amd64 -host_arch=%HOSTARCH% +set INCLUDE=%WXWIN%\include;%INCLUDE% +:: -- Setup the make executable and the actual makefile name -- +set MAKE=nmake +set MAKEFILE=makefile.vc +set FLAGS=USE_ODBC=1 USE_OPENGL=1 USE_QA=1 USE_GDIPLUS=1 CXXFLAGS=/DNEED_PBT_H=0 +set COMPILER_VERSION=141 +set COMPILER_NAME=vs2017 +set COMPILER_ARCH=64 +set BAKE_FORMAT=msvc +set BAKE_OPTIONS_FILE=config.vc +goto START + :SETUP_GCC_BUILD_ENVIRONMENT echo Assuming that GCC has been installed to: echo %GCCDIR% @@ -636,6 +696,8 @@ echo VC120 = Visual C++ 12.0 echo VC120_64 = Visual C++ 12.0 64-bit echo VC140 = Visual C++ 14.0 echo VC140_64 = Visual C++ 14.0 64-bit +echo VC141 = Visual C++ 14.1 +echo VC141_64 = Visual C++ 14.1 64-bit echo. echo BuildTarget Options: echo LIB = Builds all the static library targets.