Last active
August 29, 2024 06:26
-
-
Save doccaico/3eee601ef282a1daad5850336b368fc4 to your computer and use it in GitHub Desktop.
CL Runner (msvc, cl.exe, raylib, stb) bat, cmd
This file contains 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 | |
REM Based on https://github.com/michal-z/cgame/blob/main/build.bat | |
SETLOCAL | |
SET NAME=main | |
IF "%1" == "" ( SET MODE=D && GOTO :MAIN | |
) ELSE IF "%1" == "--debug" ( SET MODE=D && GOTO :MAIN | |
) ELSE IF "%1" == "--release" ( SET MODE=R && GOTO :MAIN | |
) ELSE IF "%1" == "--help" ( GOTO :HELP | |
) ELSE IF "%1" == "-h" ( GOTO :HELP | |
) ELSE ( GOTO :HELP | |
) | |
:HELP | |
ECHO Usage : $ build [--debug^|--release^|-h^|--help] | |
ECHO Example: $ build ^| build --debug | |
ECHO $ build --release | |
ECHO $ build -h ^| build --help | |
GOTO :EOF | |
:MAIN | |
SET CC=cl.exe | |
SET C_FLAGS=/std:c17 /nologo /GR- /permissive- /W4 /WX /I"lib" /D_CRT_SECURE_NO_WARNINGS | |
IF %MODE%==D SET C_FLAGS=%C_FLAGS% /GS /Od /RTCs /D"_DEBUG" | |
IF %MODE%==R SET C_FLAGS=%C_FLAGS% /GS- /O2 /Oi /Ot /D"NDEBUG" | |
SET LINK_FLAGS=/INCREMENTAL:NO /NOLOGO | |
IF %MODE%==D SET LINK_FLAGS=%LINK_FLAGS% /DEBUG:FULL | |
IF %MODE%==R SET LINK_FLAGS=%LINK_FLAGS% | |
%CC% %C_FLAGS% /MP /Fe:"%NAME%.exe" "src\*.c" ^ | |
/link %LINK_FLAGS% | |
REM vim:set fenc=cp932 ff=dos |
This file contains 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 PRG=main.exe | |
if "%1" == "pch" ( goto :PCH | |
) else if "%1" == "run" ( goto :RUN | |
) else ( | |
echo Usage : $ build [pch^|run] "FILE_A FILE_B ..." | |
echo Example: $ build pch | |
echo $ build "main.cpp path.cpp" | |
goto :EOF | |
) | |
:PCH | |
CL /permissive- /std:c++17 /Zc:__cplusplus /EHsc /nologo /W4 /w44365 /FIALL.H /YcALL.H EMPTY.CPP | |
goto :EOF | |
:RUN | |
CL /permissive- /std:c++17 /Zc:__cplusplus /EHsc /nologo /W4 /w44365 /FIALL.H /FpALL.PCH %~2 ^ | |
/link /OUT:%PRG% && .\%PRG% | |
goto :EOF | |
REM vim:set fenc=cp932 ff=dos |
This file contains 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 | |
REM Based on https://github.com/michal-z/cgame/blob/main/build.bat | |
SETLOCAL | |
SET NAME=flappy | |
IF "%1" == "" ( SET MODE=D && GOTO :MAIN | |
) ELSE IF "%1" == "--debug" ( SET MODE=D && GOTO :MAIN | |
) ELSE IF "%1" == "--release" ( SET MODE=R && GOTO :MAIN | |
) ELSE IF "%1" == "--help" ( GOTO :HELP | |
) ELSE IF "%1" == "-h" ( GOTO :HELP | |
) ELSE ( GOTO :HELP | |
) | |
:HELP | |
ECHO Usage : $ build [--debug^|--release^|-h^|--help] | |
ECHO Example: $ build ^| build --debug | |
ECHO $ build --release | |
ECHO $ build -h ^| build --help | |
EXIT /B 0 | |
:MAIN | |
SET CC=cl.exe | |
SET C_FLAGS=/std:c17 /nologo /utf-8 /GR- /permissive- /W4 /D_CRT_SECURE_NO_WARNINGS ^ | |
/I"lib\raylib\include" ^ | |
/I"lib\stb" | |
IF %MODE%==D SET C_FLAGS=%C_FLAGS% /GS /Od /RTCs /D"_DEBUG" | |
IF %MODE%==R SET C_FLAGS=%C_FLAGS% /WX /GS- /O2 /Oi /Ot /D"NDEBUG" | |
SET LINK_FLAGS=/INCREMENTAL:NO /NOLOGO /LIBPATH:"lib\raylib\lib" /NODEFAULTLIB:libcmt | |
IF %MODE%==D SET LINK_FLAGS=%LINK_FLAGS% /DEBUG:FULL | |
IF %MODE%==R SET LINK_FLAGS=%LINK_FLAGS% | |
%CC% %C_FLAGS% /MP /Fe:"%NAME%.exe" "src\*.c" ^ | |
/link %LINK_FLAGS% raylib.lib gdi32.lib winmm.lib shell32.lib user32.lib | |
EXIT /B %ERRORLEVEL% | |
REM vim:set fenc=cp932 ff=dos |
This file contains 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 | |
if "%1" == "" ( | |
echo Usage : %0 FILE | |
exit /b 1 | |
) | |
set RAYLIB=C:\libs\raylib-5.0_win64_msvc16 | |
set CFLAGS=/nologo /std:c++20 /Zc:__cplusplus /permissive- /W4 /utf-8 /GF /D_HAS_EXCEPTIONS=0 /GR- ^ | |
/I %RAYLIB%\include | |
REM Release build | |
REM set FLAGS=/nologo /std:c++20 /Zc:__cplusplus /permissive- /W4 /utf-8 /GF /D_HAS_EXCEPTIONS=0 /GR- /O2 /DNDEBUG ^ | |
REM /I C:\libs\raylib-5.0_win64_msvc16\include | |
set LIBFLAGS=/LIBPATH:%RAYLIB%\lib ^ | |
raylib.lib winmm.lib shell32.lib gdi32.lib user32.lib ^ | |
/NODEFAULTLIB:libcmt | |
set EXE=%~n1%.exe | |
cl %CFLAGS% %1 /link /OUT:%EXE% %LIBFLAGS% && %EXE% | |
REM vim: ft=dosbatch fenc=cp932 ff=dos |
This file contains 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 | |
if "%1" == "" ( | |
echo Usage : %0 FILE | |
exit /b 1 | |
) | |
set CFLAGS=/nologo /std:c++20 /Zc:__cplusplus /permissive- /W4 /utf-8 /GF /D_HAS_EXCEPTIONS=0 /GR- | |
REM set FLAGS=/nologo /std:c++20 /Zc:__cplusplus /permissive- /W4 /utf-8 /GF /D_HAS_EXCEPTIONS=0 /GR- /O2 /DNDEBUG | |
set EXE=%~n1%.exe | |
cl %CFLAGS% %1 /link /OUT:%EXE% && %EXE% | |
REM vim: ft=dosbatch fenc=cp932 ff=dos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment