Created
November 8, 2019 14:05
-
-
Save ZenToad/865a76c218ed63babe28c68508f0cc4b to your computer and use it in GitHub Desktop.
build and test batch files
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 enableextensions enabledelayedexpansion | |
set target=stretch_buffer_test | |
set target_c=%target% | |
set target_exe=%target% | |
set compiler=cl | |
set configuration=debug | |
set target_src=..\src\async.c | |
set target_include=-I..\include | |
set target_lib= | |
if not exist bin mkdir bin | |
if exist import.bat ( | |
call "import" | |
) | |
for %%a in (%*) do ( | |
set target=%%a | |
) | |
set target_c=%target%.c | |
echo ------------------------------------------------- | |
echo - Compiler: %compiler% | |
echo - Configuration: %configuration% | |
echo - Target C: %target% | |
echo - Output: bin\%target%.exe | |
echo ------------------------------------------------- | |
rem MT for statically linked CRT, MD for dynamically linked CRT | |
set win_runtime_lib=MT | |
set common_c=..\!target_c! !target_src! /Fe!target!.exe -nologo -TC -FC -EHa- !target_include! | |
set common_l=/incremental /debug:fastlink /SUBSYSTEM:CONSOLE /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD !target_lib! | |
echo. | |
echo Compiling... | |
pushd bin | |
cl !common_c! -!win_runtime_lib!d -Od -Z7 /link !common_l! | |
popd | |
goto :end | |
:failed | |
echo. | |
echo Build failed. | |
:end | |
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 enableextensions enabledelayedexpansion | |
set target=test | |
set target_c=%target% | |
set target_exe=%target% | |
set compiler=cl | |
set configuration=debug | |
set target_src= | |
set target_include=-I..\vendor\greatest | |
set target_lib= | |
if not exist bin mkdir bin | |
for %%a in (%*) do ( | |
set target=%%a | |
) | |
set target_c=..\test\%target%.c | |
echo ------------------------------------------------- | |
echo - Compiler: %compiler% | |
echo - Configuration: %configuration% | |
echo - Target C: %target% | |
echo - Output: bin\%target%.exe | |
echo ------------------------------------------------- | |
rem MT for statically linked CRT, MD for dynamically linked CRT | |
set win_runtime_lib=MT | |
set common_c=!target_c! !target_src! /Fe!target!.exe -nologo -TC -FC -EHa- !target_include! | |
set common_l=/incremental /debug:fastlink /SUBSYSTEM:CONSOLE /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD !target_lib! | |
echo. | |
echo Compiling... | |
pushd bin | |
cl !common_c! -!win_runtime_lib!d -Od -Z7 /link !common_l! | |
if %ERRORLEVEL% EQU 0 ( | |
goto success | |
) | |
if %ERRORLEVEL% NEQ 0 ( | |
goto failed | |
) | |
goto :end | |
:success | |
echo. | |
echo Build succeeded. | |
echo. | |
!target!.exe | |
goto end | |
:failed | |
echo. | |
echo Build failed. | |
:end | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment