-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
73 lines (60 loc) · 1.42 KB
/
build.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
@echo off
set solution_name=""
if /i [%1] == [run] goto :run
echo [94m[ Premake ][0m - [90mGenerating vs2022 files[0m
premake5 vs2022
for %%i in ("*.sln") do set solution_name=%%i
where /q cl
if [%errorlevel%]==[1] (
echo [ Environment Setup ]
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
set errorlevel=0
)
set build_type=Debug
set pcolor=93
if /i [%1]==[] (
goto :build
)
if /i [%1] == [release] (
set pcolor=92
set build_type=Release
) else if /i %1 == dist (
set build_type=Dist
set pcolor=92
) else if /i %1 == debug (
set build_type=Debug
set pcolor=93
) else if /i %1 == clean (
set pcolor=92
set build_type=%2
goto :clean
) else (
echo [91mInvalid Build Argument[0m
goto :eof
)
goto :build
:build
echo [%pcolor%m[ %build_type% Build ][0m
MsBuild %solution_name% /p:configuration=%build_type%
goto :run
:clean
if [%build_type%] == [] set build_type=Debug
echo [%pcolor%m[ Clean %build_type% Build ][0m
MsBuild %solution_name% /p:Configuration=%build_type% /t:Rebuild
goto :run
:run
if %errorlevel% == 1 (
echo [91m[ Build Failed ][0m
set /a errorlevel=0;
goto :eof
)
set exe_path=
for %%i in ("bin\*.exe") do set exe_path=%%i
if [%exe_path%]==[] (
echo [91m[ Error ][0m --- [90mNo Executable Found![0m
exit /b 1
)
echo [96m[ Running Executable ][0m
echo ----------------------------------------------------
%exe_path%
goto :eof