This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_tools.ps1
156 lines (139 loc) · 5.11 KB
/
install_tools.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
$ErrorActionPreference = 'Stop'
$BUILD_DIR = Join-Path (Resolve-Path ".").Path "_build"
$INSTALL_DIR = Join-Path (Resolve-Path ".").Path "_install"
$SORA_VERSION_FILE = Join-Path (Resolve-Path ".").Path "VERSIONS"
Get-Content $SORA_VERSION_FILE | Foreach-Object{
if (!$_) {
continue
}
$var = $_.Split('=')
New-Variable -Name $var[0] -Value $var[1]
}
mkdir $BUILD_DIR -Force
mkdir $INSTALL_DIR -Force
# Boost
$BOOST_VERSION_FILE = "$INSTALL_DIR\boost.version"
$BOOST_CHANGED = $FALSE
if (!(Test-Path $BOOST_VERSION_FILE) -Or ("$BOOST_VERSION" -ne (Get-Content $BOOST_VERSION_FILE))) {
$BOOST_CHANGED = $TRUE
}
if ($BOOST_CHANGED -Or !(Test-Path "$INSTALL_DIR\boost\include\boost\version.hpp")) {
$_BOOST_UNDERSCORE_VERSION = $BOOST_VERSION.Replace(".", "_")
$_URL = "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${_BOOST_UNDERSCORE_VERSION}.zip"
$_FILE = "boost_${_BOOST_UNDERSCORE_VERSION}.zip"
# ダウンロードと展開
Push-Location $BUILD_DIR
if (!(Test-Path $_FILE)) {
Invoke-WebRequest -Uri $_URL -OutFile $_FILE
}
if (Test-Path "boost_${_BOOST_UNDERSCORE_VERSION}") {
Remove-Item boost_${_BOOST_UNDERSCORE_VERSION} -Force -Recurse
}
# Expand-Archive -Path $_FILE -DestinationPath .
7z x $_FILE
Pop-Location
# ビルドとインストール
Push-Location $BUILD_DIR\boost_${_BOOST_UNDERSCORE_VERSION}
& .\bootstrap.bat
& .\b2.exe install `
-j8 `
--prefix=$INSTALL_DIR\boost `
--with-filesystem `
--with-date_time `
--with-regex `
--layout=system `
address-model=64 `
link=static `
threading=multi `
variant=release `
runtime-link=static
Pop-Location
}
Set-Content "$BOOST_VERSION_FILE" -Value "$BOOST_VERSION"
# JSON
$JSON_VERSION_FILE = "$INSTALL_DIR\json.version"
$JSON_CHANGED = $FALSE
if (!(Test-Path $JSON_VERSION_FILE) -Or ("$JSON_VERSION" -ne (Get-Content $JSON_VERSION_FILE))) {
$JSON_CHANGED = $TRUE
}
if ($JSON_CHANGED -Or !(Test-Path "$INSTALL_DIR\json\include\nlohmann\json.hpp")) {
$_URL = "https://github.com/nlohmann/json/releases/download/v${JSON_VERSION}/include.zip"
$_FILE = "$BUILD_DIR\json.zip"
# ダウンロード
Push-Location $BUILD_DIR
if (!(Test-Path $_FILE)) {
Invoke-WebRequest -Uri $_URL -OutFile $_FILE
}
Pop-Location
# 展開(=インストール)
mkdir "$INSTALL_DIR\json" -Force
# Expand-Archive -Path $_FILE -DestinationPath "$INSTALL_DIR\json"
Push-Location $INSTALL_DIR\json
7z x $_FILE
Pop-Location
}
Set-Content "$JSON_VERSION_FILE" -Value "$JSON_VERSION"
# WebRTC
$WEBRTC_VERSION_FILE = "$INSTALL_DIR\webrtc.version"
$WEBRTC_CHANGED = $FALSE
if (!(Test-Path $WEBRTC_VERSION_FILE) -Or ("$WEBRTC_BUILD_VERSION" -ne (Get-Content $WEBRTC_VERSION_FILE))) {
$WEBRTC_CHANGED = $TRUE
}
if ($WEBRTC_CHANGED -Or !(Test-Path "$INSTALL_DIR\webrtc\release\webrtc.lib")) {
# shiguredo-webrtc-windows のバイナリをダウンロードする
$_URL = "https://github.com/shiguredo-webrtc-build/webrtc-build/releases/download/m$WEBRTC_BUILD_VERSION/webrtc.windows.zip"
$_FILE = "$BUILD_DIR\webrtc-m$WEBRTC_BUILD_VERSION.zip"
Push-Location $BUILD_DIR
if (!(Test-Path $_FILE)) {
Invoke-WebRequest -Uri $_URL -OutFile $_FILE
}
Pop-Location
# 展開
if (Test-Path "$BUILD_DIR\webrtc") {
Remove-Item $BUILD_DIR\webrtc -Recurse -Force
}
# Expand-Archive -Path $_FILE -DestinationPath "$BUILD_DIR\webrtc"
Push-Location $BUILD_DIR
7z x $_FILE
Pop-Location
# インストール
if (Test-Path "$INSTALL_DIR\webrtc") {
Remove-Item $INSTALL_DIR\webrtc -Recurse -Force
}
Move-Item $BUILD_DIR\webrtc $INSTALL_DIR\webrtc
}
Set-Content "$WEBRTC_VERSION_FILE" -Value "$WEBRTC_BUILD_VERSION"
# CUDA
$CUDA_VERSION_FILE = "$INSTALL_DIR\cuda.version"
$CUDA_CHANGED = $FALSE
if (!(Test-Path $CUDA_VERSION_FILE) -Or ("$CUDA_VERSION" -ne (Get-Content $CUDA_VERSION_FILE))) {
$CUDA_CHANGED = $TRUE
}
if ($CUDA_CHANGED -Or !(Test-Path "$INSTALL_DIR\cuda\nvcc")) {
if ("$CUDA_VERSION" -eq "10.2") {
$_URL = "http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_441.22_win10.exe"
$_FILE = "$BUILD_DIR\cuda_10.2.89_441.22_win10.exe"
} else {
# バージョンが増えたらこの分岐を増やしていく
throw "CUDA-$CUDA_VERSION URL not specified"
}
Push-Location $BUILD_DIR
if (!(Test-Path $_FILE)) {
Invoke-WebRequest -Uri $_URL -OutFile $_FILE
}
Pop-Location
if (Test-Path "$BUILD_DIR\cuda") {
Remove-Item "$BUILD_DIR\cuda" -Recurse -Force
}
mkdir $BUILD_DIR\cuda -Force
Push-Location $BUILD_DIR\cuda
# サイレントインストールとかせずに、単に展開だけして nvcc を利用する
7z x $_FILE
if (Test-Path "$INSTALL_DIR\cuda") {
Remove-Item $INSTALL_DIR\cuda -Recurse -Force
}
mkdir $INSTALL_DIR\cuda
Move-Item nvcc $INSTALL_DIR\cuda\nvcc
Pop-Location
}
Set-Content "$CUDA_VERSION_FILE" -Value "$CUDA_VERSION"