Last active
March 30, 2025 15:18
-
-
Save gianmaria/6cf92051ae8a964850de68d971625283 to your computer and use it in GitHub Desktop.
build.bat
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 | |
setlocal | |
set mode=%1 | |
if "%mode%"=="debug" ( | |
set optimization=/Od /Zi /MDd | |
set macro=/D "_DEBUG" | |
) else if "%mode%"=="release" ( | |
set optimization=/O2 /Zi /MD | |
set macro=/D "_NDEBUG" | |
) else ( | |
echo Invalid mode specified. Use "debug" or "release". | |
exit /b 1 | |
) | |
echo Building in: %mode% | |
rem echo Options: %opt% | |
rem echo Macros: %macro% | |
rem exit /b 0 | |
set base=%~dp0 | |
if not exist build\%mode% mkdir build\%mode% | |
pushd build\%mode% | |
cl /nologo /FC /std:c++20 ^ | |
/EHsc ^ | |
/Wall /external:anglebrackets /external:W0 ^ | |
/wd4820 /wd5045 /wd4365 ^ | |
%optimization% ^ | |
/utf-8 /Zc:__cplusplus ^ | |
%macro% ^ | |
/D "_CONSOLE" /D "_UNICODE" /D "UNICODE" ^ | |
%base%\main.cpp ^ | |
/link ^ | |
Psapi.lib Advapi32.lib ^ | |
/MANIFEST:EMBED /MANIFESTUAC:"level='requireAdministrator' uiAccess='false'" ^ | |
/MACHINE:X64 /SUBSYSTEM:CONSOLE /DEBUG:full /OUT:main.exe | |
popd | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment