HandmadeHero/scripts/update_deps.ps1

71 lines
2.9 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
$path_data = Join-Path $path_root "data"
$path_project = Join-Path $path_root "project"
$path_deps = Join-Path $path_project "dependencies"
2023-09-26 22:16:41 -07:00
$path_binaries = Join-Path $path_data "binaries"
$path_deps_windows = Join-Path $path_deps "windows"
$path_temp = Join-Path $path_deps "temp"
$path_platform = Join-Path $path_project "platform"
2023-09-08 09:42:24 -07:00
# Clear out the current content first
if (Test-Path $path_deps) {
Remove-Item $path_deps -Recurse -Force
New-Item -ItemType Directory -Path $path_deps
2023-09-08 09:42:24 -07:00
}
New-Item -ItemType Directory -Path $path_temp
2023-09-26 22:16:41 -07:00
if ( -not (Test-Path $path_binaries) ) {
New-Item -ItemType Directory -Path $path_binaries
}
$url_gencpp = "https://github.com/Ed94/gencpp/releases/download/latest/gencpp_singleheader.zip"
$path_gencpp_zip = Join-Path $path_temp "gencpp_singleheader.zip"
2023-09-08 09:42:24 -07:00
2023-09-08 15:54:16 -07:00
#region gencpp
Invoke-WebRequest -Uri $url_gencpp -OutFile $path_gencpp_zip
Expand-Archive -Path $path_gencpp_zip -DestinationPath $path_temp
Move-Item -Path (Join-Path $path_temp "gen.hpp") -Destination $path_deps -Force
2023-09-08 15:54:16 -07:00
#endregion gencpp
2023-09-08 09:42:24 -07:00
#region JoyShockLibrary
$url_jsl_repo = "https://github.com/JibbSmart/JoyShockLibrary.git"
# $url_jsl_zip = "https://github.com/JibbSmart/JoyShockLibrary/releases/download/v3.0/JSL_3_0.zip"
2023-09-09 17:30:45 -07:00
$url_jsl_zip = "https://github.com/Ed94/JoyShockLibrary/releases/download/quick_fix/JSL.zip"
$path_jsl_repo = Join-Path $path_temp "JoyShockLibraryRepo"
$path_jsl_repo_code = Join-Path $path_jsl_repo "JoyShockLibrary"
$path_jsl_lib_zip = Join-Path $path_temp "JSL_3_0.zip"
$path_jsl = Join-Path $path_deps "JoyShockLibrary"
$path_jsl_hidapi = Join-Path $path_jsl "hidapi"
$path_jsl_lib = Join-Path $path_jsl "x64"
# Grab code from repo
& git clone $url_jsl_repo $path_jsl_repo
Move-Item -Path $path_jsl_repo_code -Destination $path_deps -Force
# Clean up the junk
@( $path_jsl, $path_jsl_hidapi ) | ForEach-Object {
Get-ChildItem -Path $path_jsl -Recurse -File | Where-Object {
($_.Extension -ne ".h" -and $_.Extension -ne ".cpp")
} | Remove-Item -Force
}
Remove-Item (join-path $path_jsl_hidapi 'objs') -Recurse -Force
# Get precompiled binaries
Invoke-WebRequest -Uri $url_jsl_zip -OutFile $path_jsl_lib_zip
Expand-Archive -Path $path_jsl_lib_zip -DestinationPath $path_temp
if (-not (Test-Path $path_jsl_lib)) {
New-Item -ItemType Directory -Path $path_jsl_lib
}
$jsl_lib_files = (Get-ChildItem (Join-Path $path_temp "JSL\x64") -Recurse -Include *.dll, *.lib)
Move-Item $jsl_lib_files -Destination $path_jsl_lib -Force
$path_jsl_dll = Join-Path $path_jsl_lib "JoyShockLibrary.dll"
2023-09-26 22:16:41 -07:00
Copy-Item $path_jsl_dll $path_binaries -Force
#endregion JoyShockLibrary
2023-09-08 14:57:17 -07:00
Remove-Item $path_temp -Recurse -Force