forked from uucidl/uu.spdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_examples.bat
54 lines (41 loc) · 1.2 KB
/
build_examples.bat
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
@echo off
setlocal
REM This script must be run after vcvarsall.bat has been run,
REM so that cl.exe is in your path.
where cl.exe || goto vsmissing_err
REM HEREPATH is <drive_letter>:<script_directory>
set HEREPATH=%~d0%~p0
set TOP=%HEREPATH%
REM Get canonical path for TOP
pushd .
cd %TOP%
set TOP=%CD%
popd
set SRC=%TOP%\src
IF not defined BUILD set BUILD=%TOP%\output
REM Start with the most strict warning level
set WARNINGS=-W4 -WX
set DEFINES=-DTRACING_ENABLED=1
set CLFLAGS=%CLFLAGS% -nologo -FC -EHsc -Z7 -Oi -GR- -Gm- -O2 -Z7 %DEFINES% %WARNINGS% -DEBUG
echo SRC=%SRC%, BUILD=%BUILD%
echo Building SPDR examples with flags: %CLFLAGS%
mkdir %BUILD%
del /Q %BUILD%\
set EXAMPLES=%TOP%\examples
set SPDR=-I "%TOP%\include" %TOP%\src\spdr_win32_unit.c
cl.exe %CLFLAGS% %SPDR% %EXAMPLES%\test.c -Fe%BUILD%\test.exe
if %errorlevel% neq 0 goto err
echo PROGRAM %BUILD%\test.exe
cl.exe %CLFLAGS% %SPDR% -Tp %EXAMPLES%\test-cxx.cc -Fe%BUILD%\test-cxx.exe
if %errorlevel% neq 0 goto err
echo PROGRAM %BUILD%\test-cxx.exe
echo SUCCESS: Successfully built
endlocal
exit /b 0
:vsmissing_err
echo ERROR: CL.EXE missing. Have you run vcvarsall.bat?
exit /b 1
:err
endlocal
echo ERROR: Failed to build
exit /b %errorlevel%