Skip to content

Instantly share code, notes, and snippets.

@SpareSimian
Created April 11, 2021 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SpareSimian/02812be6fbaf00dadb8ee3cc7ca4610a to your computer and use it in GitHub Desktop.
Save SpareSimian/02812be6fbaf00dadb8ee3cc7ca4610a to your computer and use it in GitHub Desktop.
Build all variants of wxWidgets for Visual Studio 2019
@rem build all variations for VC16
@rem if running on 32 bit, we need to use the cross compiler for 64 bit
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set "OSWIDTH=32BIT" || set "OSWIDTH=64BIT"
if "%OSWIDTH%"=="32BIT" set VSAMD64=x86_amd64
if "%OSWIDTH%"=="64BIT" set VSAMD64=amd64
if "%OSWIDTH%"=="" exit /B 1
@echo using %VSAMD64% for 64 bit builds
@rem look for vswhere.exe, first in 32-bit land, then 64-bit
if not exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" goto novswhere86
set VSWHEREDIR=%ProgramFiles%\Microsoft Visual Studio\Installer
goto vswhere
:novswhere86
if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" exit /B 1
set VSWHEREDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer
:vswhere
@rem "for /f" gets confused by quoted executable paths with spaces so we have to pushd there
pushd %VSWHEREDIR%
for /f "tokens=* usebackq" %%i in (`.\vswhere.exe -version "[16.0,17.0)" -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
set InstallDir=%%i
)
popd
if not exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" exit /B 1
setlocal
call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %VSAMD64%
nmake -f makefile.vc SHARED=0 BUILD=debug RUNTIME_LIBS=dynamic COMPILER_PREFIX=vc16 TARGET_CPU=x64
nmake -f makefile.vc SHARED=0 BUILD=release RUNTIME_LIBS=dynamic COMPILER_PREFIX=vc16 TARGET_CPU=x64
nmake -f makefile.vc SHARED=0 BUILD=debug RUNTIME_LIBS=static COMPILER_PREFIX=vc16_static TARGET_CPU=x64
nmake -f makefile.vc SHARED=0 BUILD=release RUNTIME_LIBS=static COMPILER_PREFIX=vc16_static TARGET_CPU=x64
endlocal
setlocal
call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" x86
nmake -f makefile.vc SHARED=0 BUILD=debug RUNTIME_LIBS=dynamic COMPILER_PREFIX=vc16
nmake -f makefile.vc SHARED=0 BUILD=release RUNTIME_LIBS=dynamic COMPILER_PREFIX=vc16
nmake -f makefile.vc SHARED=0 BUILD=debug RUNTIME_LIBS=static COMPILER_PREFIX=vc16_static
nmake -f makefile.vc SHARED=0 BUILD=release RUNTIME_LIBS=static COMPILER_PREFIX=vc16_static
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment