-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bat
62 lines (46 loc) · 1.16 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
::
:: Run:
:: > .\build.bat
:: > .\build.bat release
:: > .\build.bat publish
::
@echo off
:: Setup
set project_root=%~dp0%
set exe_name=myspace.exe
set publish_path=%project_root%..\nickav.github.io
set build_hash=0
FOR /F "tokens=*" %%g IN ('more %project_root%\.git\refs\heads\master') do (set build_hash=%%g)
set commit_message=0
FOR /F "tokens=*" %%g IN ('more %project_root%\.git\COMMIT_EDITMSG') do (set commit_message=%%g)
:: Args
set release=0
set publish=0
for %%a in (%*) do set "%%a=1"
if %publish%==1 set release=1
echo ---
echo release=%release%
echo publish=%publish%
echo ---
pushd %project_root%
if not exist build (mkdir build)
pushd build
cl /MD -DDEBUG=1 /Od -nologo -Zo -Z7 ..\src\main.cpp /link -subsystem:console -incremental:no -opt:ref -OUT:%exe_name%
IF %errorlevel% NEQ 0 (popd && goto end)
rmdir /s /q bin
if %release%==0 (
.\%exe_name% ..\data bin --serve
)
if %release%==1 (
.\%exe_name% ..\data bin --open
)
popd
if %publish%==1 (
xcopy /s /i /y %project_root%\build\bin %publish_path%
git add .
git commit -m "%commit_message%"
git push
)
popd
:end
exit /B %errorlevel%