-
Notifications
You must be signed in to change notification settings - Fork 3
/
build_windows.ps1
104 lines (81 loc) · 3.73 KB
/
build_windows.ps1
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
$ROOT=$PWD
$NPROC=(Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
if ($env:PLATFORM -eq "x86") {
$BUILD_PATH="$ROOT/build/windows32"
$OUT_PATH="$ROOT/out/windows32"
} elseif ($env:PLATFORM -eq "x64") {
$BUILD_PATH="$ROOT/build/windows64"
$OUT_PATH="$ROOT/out/windows64"
} else {
"Invalid Platform!"
Exit
}
# Remove previous output files
if (Test-Path $OUT_PATH) {
Remove-Item -Path $OUT_PATH -Recurse | out-null
}
# Build BoringSSL
if (Test-Path "$BUILD_PATH/boringssl") {
Remove-Item -Path "$BUILD_PATH/boringssl" -Recurse | out-null
}
New-Item -Path $BUILD_PATH -Name "boringssl" -ItemType "directory" | out-null
Set-Location -Path "$BUILD_PATH/boringssl" | out-null
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$OUT_PATH" -G Ninja "$ROOT/boringssl"
ninja -j $NPROC
ninja install
ninja clean
# Build nghttp2
if (Test-Path "$BUILD_PATH/nghttp2") {
Remove-Item -Path "$BUILD_PATH/nghttp2" -Recurse | out-null
}
New-Item -Path $BUILD_PATH -Name "nghttp2" -ItemType "directory" | out-null
Set-Location -Path "$BUILD_PATH/nghttp2" | out-null
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$OUT_PATH" -G Ninja -DENABLE_LIB_ONLY=ON -DENABLE_EXAMPLES=OFF `
-DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON "$ROOT/nghttp2"
ninja -j $NPROC
ninja install
ninja clean
# Build ngtcp2
if (Test-Path "$BUILD_PATH/ngtcp2") {
Remove-Item -Path "$BUILD_PATH/ngtcp2" -Recurse | out-null
}
New-Item -Path $BUILD_PATH -Name "ngtcp2" -ItemType "directory" | out-null
Set-Location -Path "$BUILD_PATH/ngtcp2" | out-null
$BORINGSSL_LIB_PATHS = "$OUT_PATH/lib/crypto.lib;$OUT_PATH/lib/ssl.lib" -replace '[\\]','/'
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$OUT_PATH" -G Ninja -DBUILD_TESTING=OFF `
-DCMAKE_TRY_COMPILE_CONFIGURATION=Release `
-DENABLE_BORINGSSL=ON -DBORINGSSL_INCLUDE_DIR="$OUT_PATH/include" -DBORINGSSL_LIBRARIES="$BORINGSSL_LIB_PATHS" `
-DENABLE_SHARED_LIB=OFF -DENABLE_STATIC_LIB=ON "$ROOT/ngtcp2"
ninja -j $NPROC
ninja install
ninja clean
# Build nghttp3
if (Test-Path "$BUILD_PATH/nghttp3") {
Remove-Item -Path "$BUILD_PATH/nghttp3" -Recurse | out-null
}
New-Item -Path $BUILD_PATH -Name "nghttp3" -ItemType "directory" | out-null
Set-Location -Path "$BUILD_PATH/nghttp3" | out-null
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$OUT_PATH" -G Ninja -DENABLE_LIB_ONLY=ON -DENABLE_EXAMPLES=OFF `
-DBUILD_TESTING=OFF -DENABLE_SHARED_LIB=OFF -DENABLE_STATIC_LIB=ON "$ROOT/nghttp3"
ninja -j $NPROC
ninja install
ninja clean
# Build curl
if (Test-Path "$BUILD_PATH/curl") {
Remove-Item -Path "$BUILD_PATH/curl" -Recurse | out-null
}
New-Item -Path $BUILD_PATH -Name "curl" -ItemType "directory" | out-null
Set-Location -Path "$BUILD_PATH/curl" | out-null
$env:CFLAGS="-DNGHTTP2_STATICLIB -DNGTCP2_STATICLIB -DNGHTTP3_STATICLIB"
$env:CXXFLAGS=$env:CFLAGS
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$OUT_PATH" -G Ninja -DBUILD_CURL_EXE=OFF `
-D CURL_DISABLE_LDAP=ON -DCURL_USE_OPENSSL=ON -DOPENSSL_INCLUDE_DIR="$OUT_PATH/include" `
-DOPENSSL_CRYPTO_LIBRARY="$OUT_PATH/lib/crypto.lib" -DOPENSSL_SSL_LIBRARY="$OUT_PATH/lib/ssl.lib" `
-DUSE_NGHTTP2=ON -DNGHTTP2_INCLUDE_DIR="$OUT_PATH/include" -DNGHTTP2_LIBRARY="$OUT_PATH/lib/nghttp2.lib" `
-DUSE_NGTCP2=ON -DNGTCP2_INCLUDE_DIR="$OUT_PATH/include" -DNGTCP2_LIBRARY="$OUT_PATH/lib/ngtcp2.lib" `
-Dngtcp2_crypto_boringssl_LIBRARY="$OUT_PATH/lib/ngtcp2_crypto_boringssl.lib" `
-DNGHTTP3_INCLUDE_DIR="$OUT_PATH/include" -DNGHTTP3_LIBRARY="$OUT_PATH/lib/nghttp3.lib" `
-DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON "$ROOT/curl"
ninja -j $NPROC
ninja install
ninja clean