-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cmd
78 lines (69 loc) · 1.74 KB
/
build.cmd
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
@echo off
setlocal enableextensions
set basedir=%~dp0
set srcdir=%basedir%
set builddir=%basedir%
set clargs=%builddir%\clargs
if defined VCToolsInstallDir (
rem Ok
) else (
echo Visual Studio tools ^(%%VCToolsInstallDir%%^) not found.
goto fail
)
if NOT "%VSCMD_ARG_TGT_ARCH%"=="x64" (
echo Target architecture is %VSCMD_ARG_TGT_ARCH% not x64'.
goto fail
)
if not exist %builddir%\ mkdir %builddir%\
if errorlevel 1 (
echo Failed to create directory: %builddir%
goto fail
)
rem Log important settings
rem echo:basedir = %basedir%
rem echo:srcdir = %srcdir%
rem echo:builddir = %builddir%
rem echo:
echo:> %clargs%
echo /nologo >> %clargs%
rem Debug configuration
echo /Od >> %clargs%
echo /DDEBUG=1 >> %clargs%
echo /DWINDOWS=1 >> %clargs%
echo /DVISUALCPP=1 >> %clargs%
echo /DDEBUG_MEMORY=0 >> %clargs%
echo /D_CRT_SECURE_NO_WARNINGS=1 >> %clargs%
echo /Zi >> %clargs%
echo /Fd:%builddir%\misdeed.pdb >> %clargs%
echo /MD >> %clargs%
rem echo /fsanitize=address >> %clargs%
rem Output configuration
echo /Fo:%builddir%\ >> %clargs%
rem Compile configuration
echo /TC >> %clargs%
echo /W4 >> %clargs%
rem echo /WX >> %clargs% -------------- warnings as errors
rem C4201: nonstandard extension used: nameless struct/union
echo /wd4201 >> %clargs%
rem C4100: unreferenced formal parameter
echo /wd4100 >> %clargs%
echo /utf-8 >> %clargs%
rem Link configuration
echo /link /WX >> %clargs%
rem echo /link gdi32.lib kernel32.lib shell32.lib user32.lib >> %clargs%
echo /link /out:%builddir%\misdeed.exe >> %clargs%
rem Sources
echo %srcdir%\misdeed.c >> %clargs%
rem Compile
cl @%clargs%
if errorlevel 1 goto fail
rem Exit with success
:success
echo:Build ok.
endlocal
exit /b 0
rem Exit with error
:fail
echo:Build failed.
endlocal
exit /b 1