-
Notifications
You must be signed in to change notification settings - Fork 1
/
archive.bat
53 lines (41 loc) · 1.52 KB
/
archive.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
@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set DATETIME_STRING=%dt:~0,8%_%dt:~8,6%
rem echo %DATETIME_STRING%
where /q cmake
IF ERRORLEVEL 1 (
echo CMake not found. Please install CMake and make sure to add its location to the system path.
pause
exit /b 1
)
rem verify all submodules are up to date
echo Updating Git submodules..
git submodule update
echo ..Done!
set chibi_bin="chibi-build/chibi/Debug/chibi.exe"
rem build chibi binary
mkdir "chibi-build\chibi"
cd chibi-build/chibi && cmake -DCMAKE_BUILD_TYPE=Release ../../chibi && cmake --build . || cd %~dp0 && exit /b 1
cd %~dp0 || exit /b 1
rem use command line argument for selecting build target
:build_loop
IF [%1]==[] (
goto build_end
)
rem generate cmake files using chibi
mkdir "chibi-build\cmake-files-for-archive"
%chibi_bin% -g . chibi-build/cmake-files-for-archive -target %1 || cd %~dp0 && exit /b 1
cd %~dp0 || exit /b 1
rem build the selected target
mkdir "chibi-build\archive"
cd chibi-build/archive && cmake -DCMAKE_BUILD_TYPE=Distribution -A Win32 ../cmake-files-for-archive && cmake --build . --config Distribution || cd %~dp0 && exit /b 1
cd %~dp0 || exit /b 1
rem zip the target folder
call zip-folder.bat chibi-build\archive\%1 chibi-build\archive\%1-%DATETIME_STRING%-windows.zip
rem open explorer with the generated archive selected
%SystemRoot%\explorer.exe /select,.\chibi-build\archive\%1-%DATETIME_STRING%-windows.zip
shift /1
goto build_loop
:build_end
rem echo build loop done
rem pause