Skip to content

Commit

Permalink
Add support for MSVC 2017
Browse files Browse the repository at this point in the history
Use the vswhere utility to detect the installation assuming the documentation is correct and this is always installed in a fixed location.
  • Loading branch information
sodevel committed Aug 29, 2019
1 parent d6ddd33 commit 2a561da
Showing 1 changed file with 63 additions and 1 deletion.
64 changes: 63 additions & 1 deletion wxBuild_wxWidgets.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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%
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2a561da

Please sign in to comment.