summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-07-12 08:40:57 +0530
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-01-29 18:52:19 +0000
commit732fe02685b72601630207ace977fe4016d2c090 (patch)
treebe6eac4d2aaaec58d5ae909e602809e643ee22a1
parent239cdeec851f8a2767f2bb3fd6bddd122b56fdba (diff)
Support both VS 2019 and 2022
Update the README and the bootstrap script accordingly. Backport of fddd8b4c. Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1238>
-rw-r--r--README.md28
-rw-r--r--tools/bootstrap-windows.ps139
2 files changed, 45 insertions, 22 deletions
diff --git a/README.md b/README.md
index 73179314..40f215a3 100644
--- a/README.md
+++ b/README.md
@@ -29,20 +29,21 @@ use your package manager to install all other required packages during
On macOS you will need to have install the following software:
- * XCode
- * Python 3.7+ https://www.python.org/downloads/
+* XCode
+* Python 3.7+ https://www.python.org/downloads/
Cerbero will build all other required packages during [bootstrap](#Bootstrap).
### Windows Setup
-The initial setup on Windows is automated with the PowerShell script [bootstrap-windows][tools/bootstrap-windows.ps1].
-It installs the following tools:
- * Visual Studio 19 Community Edition
- * MSYS2
- * Git
- * Python 3
- * Wix
+The initial setup on Windows is automated with the PowerShell script
+[bootstrap-windows][tools/bootstrap-windows.ps1]. It installs the following tools:
+
+* Visual Studio 2019 or 2022 Build Tools
+* MSYS2
+* Git
+* Python 3
+* WiX
Start an admin PowerShell and run:
@@ -51,11 +52,12 @@ Start an admin PowerShell and run:
$ Set-ExecutionPolicy -ExecutionPolicy Unrestricted
# Run the bootstrap script
-$ .\tools\bootstrap-windows.ps
+$ .\tools\bootstrap-windows.ps1
```
-**IMPORTANT:** Using cerbero on Windows with the [GCC/MinGW toolchain](docs/toolchains.md#Windows) requires a 64-bit operating system. The toolchain is only available for 64-bit and it can produce 32-bit or 64-bit binaries.
-
+**IMPORTANT:** Using cerbero on Windows with the [GCC/MinGW toolchain](docs/toolchains.md#Windows)
+requires a 64-bit operating system. The toolchain is only available for 64-bit
+and it can produce 32-bit or 64-bit binaries.
# Running Cerbero
@@ -364,7 +366,7 @@ Create a `localconf.cbc` file and add the following:
# Specify Visual Studio install path and version
vs_install_path = 'C:/Path/To/Install'
-# This is the Visual Studio Compiler toolset version, vs16 is for Visual Studio 2019. vs15 is 2017.
+# This is the Visual Studio Compiler toolset version, vs16 is for Visual Studio 2019. vs15 is 2017, and so on
vs_install_version = 'vs16'
```
You can then run Cerbero with e.g.:
diff --git a/tools/bootstrap-windows.ps1 b/tools/bootstrap-windows.ps1
index c122d23b..dba83a88 100644
--- a/tools/bootstrap-windows.ps1
+++ b/tools/bootstrap-windows.ps1
@@ -1,6 +1,11 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
-$msvc_2019_url = 'https://aka.ms/vs/16/release/vs_buildtools.exe'
+# Disable progress bars, which are super slow especially Invoke-WebRequest
+# which updates the progress bar for each byte
+$ProgressPreference = 'SilentlyContinue'
+
+$vs2019_url = 'https://aka.ms/vs/16/release/vs_buildtools.exe'
+$vs2022_url = 'https://aka.ms/vs/17/release/vs_buildtools.exe'
$choco_url = 'https://chocolatey.org/install.ps1'
Get-Date
@@ -33,21 +38,37 @@ C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -S -q --needed winpty perl'
Add-Content C:\msys64\ucrt64.ini "`nMSYS2_PATH_TYPE=inherit"
Copy-Item "data\msys2\profile.d\aliases.sh" -Destination "C:\msys64\etc\profile.d"
-$confirmation = Read-Host "Visual Studio 2019 build tools will be installed, do you want to proceed:[y/n]"
+$confirmation = Read-Host "Do you want to install Visual Studio build tools? [y/N] "
if ($confirmation -eq 'y') {
+ $version = ''
+ $vs_arglist = '--wait --quiet --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended'
+ while (1) {
+ $version = Read-Host "Pick the Visual Studio version: 2019 or 2022? [2019/2022] "
+ if ($version -eq '2022') {
+ $vs_url = $vs2022_url
+ break
+ } elseif ($version -eq '2019') {
+ $vs_url = $vs2019_url
+ break
+ } elseif ($version -eq 'q') {
+ Write-Host "Windows Dependencies Installation Completed"
+ Exit 0
+ } else {
+ Write-Host "Selected invalid version $version, retry or press 'q' to quit"
+ }
+ }
Get-Date
- Write-Host "Downloading Visual Studio 2019 build tools"
- Invoke-WebRequest -Uri $msvc_2019_url -OutFile C:\vs_buildtools.exe
+ Write-Host "Downloading Visual Studio $version build tools"
+ Invoke-WebRequest -Uri $vs_url -OutFile "$env:TEMP\vs_buildtools.exe"
Get-Date
- Write-Host "Installing Visual Studio 2019"
- Start-Process -NoNewWindow -Wait C:\vs_buildtools.exe -ArgumentList '--wait --quiet --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended'
+ Write-Host "Installing Visual Studio $version build tools"
+ Start-Process -NoNewWindow -Wait "$env:TEMP\vs_buildtools.exe" -ArgumentList $vs_arglist
if (!$?) {
- Write-Host "Failed to install Visual Studio tools"
+ Write-Host "Failed to install Visual Studio build tools"
Exit 1
}
- Remove-Item C:\vs_buildtools.exe -Force
+ Remove-Item "$env:TEMP\vs_buildtools.exe" -Force
}
-
Write-Host "Windows Dependencies Installation Completed"