Created
February 28, 2021 05:43
-
-
Save DeviousMalcontent/a0bf867e859aed863e2a8f09a34f7eb3 to your computer and use it in GitHub Desktop.
The build script that I have now started to use to build my Win32 C++ based projects; trying to remove the requirement for Visual Studio and just use the Build Tools, in the past I have had issues trying to compile older projects with newer versions and a lot of fucking around finding the SDKs, and the bloat. One thing to note, you will need to …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO off | |
SET projectpath=%CD:~0,-6% | |
if exist "MyProject.obj" del "MyProject.obj" | |
if exist "MyProject.exe" del "MyProject.exe" | |
REM Find MSVC Compiler install path. | |
REM Using MSVC 2019 Community | |
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" ( | |
ECHO Using MSVC 2019 Community... | |
CALL "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" | |
cl -nologo -EHsc -GR -Zc:forScope -Zc:wchar_t -I "%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.17763.0\um" -FeMyProject MyProject.cpp /link /LIBPATH:"%ProgramFiles(x86)%\Windows Kits\10\Lib\10.0.17763.0\um\x86" | |
PAUSE | |
EXIT | |
) | |
REM Using MSVC 2019 BuildTools | |
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat" ( | |
ECHO Using MSVC 2019 BuildTools... | |
CALL "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat" | |
cl -nologo -EHsc -GR -Zc:forScope -Zc:wchar_t -I "%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.17763.0\um" -FeMyProject MyProject.cpp /link /LIBPATH:"%ProgramFiles(x86)%\Windows Kits\10\Lib\10.0.17763.0\um\x86" | |
PAUSE | |
EXIT | |
) | |
REM Using MSVC 2017 Community | |
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" ( | |
ECHO Using MSVC 2017 Community... | |
CALL "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" | |
cl -nologo -EHsc -GR -Zc:forScope -Zc:wchar_t -I "%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.17763.0\um" -FeMyProject MyProject.cpp /link /LIBPATH:"%ProgramFiles(x86)%\Windows Kits\10\Lib\10.0.17763.0\um\x86" | |
PAUSE | |
EXIT | |
) | |
REM Using MSVC 2017 BuildTools | |
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars32.bat" ( | |
ECHO Using MSVC 2017 BuildTools... | |
CALL "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars32.bat" | |
cl -nologo -EHsc -GR -Zc:forScope -Zc:wchar_t -I "%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.17763.0\um" -FeMyProject MyProject.cpp /link /LIBPATH:"%ProgramFiles(x86)%\Windows Kits\10\Lib\10.0.17763.0\um\x86" | |
PAUSE | |
EXIT | |
) | |
ECHO Visual Studios or Visual CPP or MSVC Compiler (cl.exe) install path was not found. | |
ECHO Looking in each drive letter under \Program Files (86)\Microsoft Visual Studio\[Year]\[Edition]\VC\Auxiliary\Build\vcvars32.bat | |
ECHO. | |
ECHO You might have to edit this script or at a minimum download and install Visual Studio Build Tools from https://visualstudio.microsoft.com/downloads/ | |
ECHO. | |
PAUSE | |
EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment