-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeps_build.bat
105 lines (82 loc) · 2.07 KB
/
deps_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
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
103
104
105
@echo off
echo *********************************************
echo ***** QUICLY-GO DEPENDENCIES BUILD *****
echo *********************************************
echo.
set BASEDIR=%~dp0
echo %BASEDIR%
set /A BUILD="Release"
if "%1" EQU "--quic" (
goto quic
)
if "%1" EQU "--clean" (
goto reset
)
if "%2" EQU "--clean" (
goto reset
)
if "%1" EQU "--debug" (
set /A BUILD="Debug"
)
if "%1" EQU "--help" (
echo "Usage: build.bat [--debug][--clean]"
exit /B 1
)
ECHO [Prerequisites check: GO]
go version
if %ERRORLEVEL% GEQ 1 goto fail
ECHO [Prerequisites check: cmake]
cmake --version
if %ERRORLEVEL% GEQ 1 goto fail
ECHO [Prerequisites check: git]
git version
if %ERRORLEVEL% GEQ 1 goto fail
echo [Init submodules]
git submodule init deps/openssl
git submodule init deps/quicly
git submodule init deps/c-for-go
echo [Update submodules]
git submodule update --init --recursive
echo [Create gen directories]
mkdir gen_openssl
mkdir gen_quicly
echo [Build OpenSSL]
pushd gen_openssl
cmake ../deps/openssl -G"MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%BASEDIR%/internal/deps -DCMAKE_BUILD_TYPE=%BUILD%
if %ERRORLEVEL% NEQ 0 goto fail
cmake --build .
if %ERRORLEVEL% NEQ 0 goto fail
cmake --build . --target install
if %ERRORLEVEL% NEQ 0 goto fail
popd
:quic
echo [Build Quicly]
pushd gen_quicly
cmake ../deps/quicly -G"MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%BASEDIR%/internal/deps -DOPENSSL_ROOT_DIR=%BASEDIR%/internal/deps/include ^
-DCMAKE_BUILD_TYPE=%BUILD% -DWITH_EXAMPLE=OFF -DCMAKE_VERBOSE_MAKEFILE=ON
if %ERRORLEVEL% NEQ 0 goto fail
cmake --build .
if %ERRORLEVEL% NEQ 0 goto fail
cmake --build . --target install
if %ERRORLEVEL% NEQ 0 goto fail
popd
:ok
echo.
echo ********************************
echo **** RESULT: SUCCESS ****
echo ********************************
cd %BASEDIR%
exit /B 0
:fail
echo.
echo ********************************
echo **** RESULT: FAILURE ****
echo ********************************
cd %BASEDIR%
exit /B 1
:reset
cd %BASEDIR%
go clean -cache -x
git reset --hard
git clean -f -d
exit /B 0