HandmadeHero/scripts/update_deps.ps1

42 lines
1.5 KiB
PowerShell
Raw Normal View History

2023-09-08 09:42:24 -07:00
clear-host
2023-09-08 14:57:17 -07:00
$path_root = & git rev-parse --show-toplevel
2023-09-08 09:42:24 -07:00
2023-09-08 14:57:17 -07:00
$path_project = Join-Path $path_root "project"
$path_dependencies = Join-Path $path_project "dependencies"
$path_temp = Join-Path $path_dependencies "temp"
$path_platform_windows = Join-Path $path_project "windows"
2023-09-08 09:42:24 -07:00
# Define the URL of the zip file and the destination directory
$url = "https://github.com/Ed94/gencpp/releases/download/latest/gencpp_singleheader.zip"
2023-09-08 14:57:17 -07:00
$destinationZip = Join-Path $path_temp "gencpp_singleheader.zip"
2023-09-08 09:42:24 -07:00
2023-09-08 14:57:17 -07:00
# Create directories if they don't exist
if (-not (Test-Path $path_dependencies)) {
2023-09-08 09:42:24 -07:00
New-Item -ItemType Directory -Path $path_dependencies
}
2023-09-08 14:57:17 -07:00
if (-not (Test-Path $path_temp)) {
2023-09-08 09:42:24 -07:00
New-Item -ItemType Directory -Path $path_temp
}
2023-09-08 14:57:17 -07:00
#pragma region gencpp
2023-09-08 09:42:24 -07:00
Invoke-WebRequest -Uri $url -OutFile $destinationZip
2023-09-08 14:57:17 -07:00
Expand-Archive -Path $destinationZip -DestinationPath $path_temp
Move-Item -Path (Join-Path $path_temp "gen.hpp") -Destination $path_dependencies -Force
#pragma endregion gencpp
2023-09-08 09:42:24 -07:00
2023-09-08 14:57:17 -07:00
#pragma region windows modular headers
2023-09-08 14:50:22 -07:00
Push-Location $path_temp
2023-09-08 14:57:17 -07:00
& git clone --no-checkout https://github.com/Leandros/WindowsHModular.git
2023-09-08 14:50:22 -07:00
2023-09-08 14:57:17 -07:00
Push-Location WindowsHModular
& git sparse-checkout init --cone
& git sparse-checkout set include/win32
Pop-Location
2023-09-08 14:50:22 -07:00
2023-09-08 14:57:17 -07:00
# Copy the win32 directory contents to the project/windows directory
Copy-Item -Recurse .\WindowsHModular\include\win32\* $path_platform_windows
Pop-Location
#pragma endregion windows modular headers
2023-09-08 14:50:22 -07:00
2023-09-08 14:57:17 -07:00
Remove-Item $path_temp -Recurse -Force