Dqn/build.bat

54 lines
2.6 KiB
Batchfile

@echo OFF
setlocal EnableDelayedExpansion
set script_dir_backslash=%~dp0
set script_dir=%script_dir_backslash:~0,-1%
if not exist Build mkdir Build
pushd Build
REM Flags ======================================================================================
REM MT Static CRT
REM EHa- Disable exception handling
REM GR- Disable C RTTI
REM O2 Optimisation Level 2
REM Oi Use CPU Intrinsics
REM Z7 Combine multi-debug files to one debug file
set common_flags=-D DQN_TEST_WITH_MAIN -I %script_dir% %script_dir%\Misc\dqn_unit_tests.cpp
set msvc_driver_flags=%common_flags% -MT -EHa -GR- -Od -Oi -Z7 -wd4201 -W4 -WX -nologo
set msvc_compile_flags=%msvc_driver_flags% -fsanitize=address -analyze /Fe:dqn_unit_tests_msvc
set clang_compile_flags=%msvc_driver_flags% -fsanitize=address -fsanitize=undefined /Fe:dqn_unit_tests_clang
set zig_compile_flags=%common_flags% -fsanitize=address -fsanitize=undefined -o dqn_unit_tests_zig
set msvc_link_flags=-link
set clang_link_flags=%msvc_link_flags%
REM msvc =======================================================================================
REM set has_msvc=1
REM where /q cl || set has_msvc=0
REM if %has_msvc% == 1 (
REM echo [BUILD] MSVC's cl detected, compiling ...
REM set msvc_cmd=cl %msvc_compile_flags% %msvc_link_flags%
REM powershell -Command "$time = Measure-Command { !msvc_cmd! | Out-Default }; Write-Host '[BUILD] msvc:'$time.TotalSeconds's'; exit $LASTEXITCODE" || exit /b 1
REM )
REM REM clang-cl ===================================================================================
REM set has_clang_cl=1
REM where /q clang-cl || set has_clang_cl=0
REM if %has_clang_cl% == 1 (
REM echo [BUILD] clang-cl detected, compiling ...
REM set clang_cmd=clang-cl %clang_compile_flags% %clang_link_flags%
REM powershell -Command "$time = Measure-Command { !clang_cmd! | Out-Default }; Write-Host '[BUILD] clang-cl:'$time.TotalSeconds's'; exit $LASTEXITCODE" || exit /b 1
REM )
REM zig ========================================================================================
REM TODO(doyle):Can't build "Misc\dqn_unit_tests.cpp|1 col 1| error: unable to build C object: FileNotFound"
REM set has_zig=1
REM where /q zig || set has_zig=0
REM if %has_zig% == 1 (
REM echo [BUILD] zig detected, compiling ...
REM set zig_cmd=zig c++ %zig_compile_flags%
REM powershell -Command "$time = Measure-Command { !zig_cmd! | Out-Default }; Write-Host '[BUILD] zig:'$time.TotalSeconds's'; exit $LASTEXITCODE" || exit /b 1
REM )
popd