-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.bat
102 lines (92 loc) · 3.26 KB
/
test.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
@REM Copyright 2020 Suhail Alhegry
@REM
@REM Permission is hereby granted, free of charge, to any person or organization
@REM obtaining a copy of the software and accompanying documentation covered by
@REM this license (the "Software") to use, reproduce, display, distribute,
@REM execute, and transmit the Software, and to prepare derivative works of the
@REM Software, and to permit third-parties to whom the Software is furnished to
@REM do so, all subject to the following:
@REM The copyright notices in the Software and this entire statement, including
@REM the above license grant, this restriction and the following disclaimer,
@REM must be included in all copies of the Software, in whole or in part, and
@REM all derivative works of the Software, unless such copies or derivative
@REM works are solely in the form of machine-executable object code generated by
@REM a source language processor.
@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@REM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@REM FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
@REM SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
@REM FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
@REM ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@REM DEALINGS IN THE SOFTWARE.
@echo off
@REM PREBARING BUILD
IF NOT EXIST build mkdir build
pushd build
IF NOT EXIST win32 mkdir win32
IF NOT EXIST win32_release mkdir win32_release
@REM BUILD SETTINGS
set CommonFlags=/W3 /MD /nologo /std:c++14 /wd"4200" /Zc:__cplusplus /EHa
set CommonIncludes=/I../inc /I../src /I../test
set CommonSourceFiles=../test/test.cpp
set CommonLinks=/link /incremental:NO /libpath:../lib shlwapi.lib
set BuildDir=win32
set Release=false
set Debug=false
set UseClang=false
@REM BUILDING
@REM find a better way to parse arguments
IF [%~1] == [-r] (
set BuildDir=win32_release
set Release=true
IF [%~2] == [-d] (
set Debug=true
IF [%~3] == [-c] (
set UseClang=true
)
)
IF [%~2] == [-c] (
set UseClang=true
)
)
IF [%~1] == [-d] (
set Debug=true
IF [%~2] == [-c] (
set UseClang=true
)
)
IF [%~1] == [-c] (
set UseClang=true
)
IF [%UseClang%] == [true] (
IF [%Release%] == [true] (
@echo on
clang-cl %CommonFlags% %CommonIncludes% /Fe%BuildDir%/ /Fo%BuildDir%/ /O2 /Ot %CommonSourceFiles% %CommonLinks%
@echo off
) ELSE (
@echo on
clang-cl %CommonFlags% %CommonIncludes% /Zi /Fe%BuildDir%/ /Fo%BuildDir%/ /Fd%BuildDir%/ /Fa%BuildDir%/ %CommonSourceFiles% %CommonLinks%
@echo off
)
) ELSE (
IF [%Release%] == [true] (
@echo on
cl %CommonFlags% %CommonIncludes% /Fe%BuildDir%/ /Fo%BuildDir%/ /O2 /Ot %CommonSourceFiles% %CommonLinks%
@echo off
) ELSE (
@echo on
cl %CommonFlags% %CommonIncludes% /DEBUG:FULL /Zi /Fe%BuildDir%/ /Fo%BuildDir%/ /Fd%BuildDir%/ /Fa%BuildDir%/ /Fm%BuildDir%/ /Fp%BuildDir%/ /FR%BuildDir%/ %CommonSourceFiles% %CommonLinks%
@echo off
)
)
@echo off
pushd %BuildDir%
set Release=
set BuildDir=
IF [%Debug%] == [true] (
devenv test.exe
) ELSE (
test.exe
)
popd
popd