-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathct.bat
More file actions
58 lines (45 loc) · 1.71 KB
/
Copy pathct.bat
File metadata and controls
58 lines (45 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@echo off
setlocal enableextensions enabledelayedexpansion
@REM Usage:
@REM ct list // test `src/list.cpp`
@REM ct list test-1 // test `src/list.cpp` `test-1`
@REM ct // test all test files under `src/*`
@REM ct algo-data\*
@REM ct algo-data\linked_list
@REM Troubleshoot:
@REM build catch first if needed
@REM cl /std:c++20 /EHsc /c catch/catch_amalgamated.cpp /Fobuild\catch.obj
:: Check if %1 is empty
if "%~1"=="" (set "TEST_FILES=src\*.cpp") else (set "TEST_FILES=src\%1.cpp")
@REM for cl : c++latest (for c++23)
@REM for clang++: c++23
set CPP_VERSION=c++23
echo .
echo -------------------------
echo Compilation
echo -------------------------
echo -- Using cpp version: %CPP_VERSION%
@REM Print clang version and date
for /f "tokens=3" %%v in ('clang++ --version ^| find "clang version"') do (
echo -- clang++ version: %%v
curl -s "https://api.github.com/repos/llvm/llvm-project/releases/tags/llvmorg-%%v" | find "published_at"
)
echo -- build Catch first if needed, see ct.bat
echo -- building TEST_FILES: %TEST_FILES%
set CMD=clang++ -std=%CPP_VERSION% -fexceptions -Wall -Wextra -Wpedantic -fcolor-diagnostics -g -O0 -Icatch %TEST_FILES% build\catch.obj -o build\tests.exe -luser32
echo -- cmd:
echo %CMD%
echo -- building, this can take a couple of minutes ...
%CMD%
echo .
@REM other working cmds:
@REM clang++ -std=%CPP_VERSION% -fcolor-diagnostics main.cpp -o build/main.exe
@REM cl /std:%CPP_VERSION% /EHsc /Icatch %TEST_FILES% build\catch.obj /Fobuild\ /Febuild\tests.exe /link user32.lib
if %ERRORLEVEL% neq 0 (
echo . & echo -- Compilation failed! Exiting...
exit /b %ERRORLEVEL%
)
echo -- Compilation succeeded...
echo .
echo -- Running tests:
build\tests.exe -s %2