Skip to content

Commit

Permalink
Fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
limbonaut committed Jan 25, 2025
1 parent 8481789 commit 7885c8a
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions scripts/build-sentry-native.ps1
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
Push-Location modules\sentry-native

$buildDir = "build"
$installDir = "install"
$installLibDir = Join-Path -Path $installDir -ChildPath "lib"

cmake -B $buildDir -DSENTRY_BUILD_SHARED_LIBS=OFF -DSENTRY_BUILD_RUNTIMESTATIC=ON -DSENTRY_BACKEND=crashpad -DSENTRY_SDK_NAME="sentry.native.godot" -DCMAKE_BUILD_TYPE=RelWithDebInfo
$curDir = Get-Location
$buildDir = Join-Path -Path $curDir -ChildPath "build"
$installDir = Join-Path -Path $curDir -ChildPath "install"
$pdbBuildDir = Join-Path -Path $buildDir -ChildPath "pdb"
$pdbSourceDir = Join-Path -Path $pdbBuildDir -ChildPath "RelWithDebInfo"
$libInstallDir = Join-Path -Path $installDir -ChildPath "lib"

cmake -B $buildDir -DSENTRY_BUILD_SHARED_LIBS=OFF -DSENTRY_BUILD_RUNTIMESTATIC=ON -DSENTRY_BACKEND=crashpad -DSENTRY_SDK_NAME="sentry.native.godot" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY="$pdbBuildDir"
cmake --build $buildDir --target sentry --parallel --config RelWithDebInfo
cmake --build $buildDir --target crashpad_handler --parallel --config RelWithDebInfo
cmake --install $buildDir --prefix $installDir --config RelWithDebInfo

# *** Install pbd files
# *** Install PDB files

Write-Host "Installing PDB files"


if (!(Test-Path -Path $installLibDir)) {
Throw "Directory $installLibDir does not exist."
if (!(Test-Path -Path $libInstallDir)) {
Throw "Directory $libInstallDir does not exist."
exit
}
if (!(Test-Path -Path $buildDir)) {
Throw "Directory $buildDir does not exist."
exit
}

Get-ChildItem -Path $buildDir -Filter "*.pdb" -Recurse | ForEach-Object {
Get-ChildItem -Path $pdbSourceDir -Filter "*.pdb" -Recurse | ForEach-Object {
$pdbFile = $_.Name
$pdbSource = $_.FullName
$pdbDestination = Join-Path -Path $installLibDir -ChildPath $pdbFile
$pdbBase = [System.IO.Path]::GetFileNameWithoutExtension($pdbFile)
$libPath = Join-Path -Path $installLibDir -ChildPath "$pdbBase.lib"
$pdbTarget = Join-Path -Path $libInstallDir -ChildPath $pdbFile
$libBase = [System.IO.Path]::GetFileNameWithoutExtension($pdbFile)
$libPath = Join-Path -Path $libInstallDir -ChildPath "$libBase.lib"

if (Test-Path -Path $libPath) {
if (Test-Path -Path $pdbDestination && (Get-FileHash -Path $pdbSource -Algorithm SHA256).Hash -eq (Get-FileHash -Path $pdbDestination -Algorithm SHA256).Hash) {
Write-Host "-- Up-to-date: $pdbFile."
} else {
Write-Host "-- Installing: $pdbFile to $installLibDir"
Copy-Item -Path $pdbSource -Destination $pdbDestination -Force
if (Test-Path -Path $pdbTarget) {
$sourceHash = Get-FileHash -Path $pdbSource -Algorithm SHA256
$targetHash = Get-FileHash -Path $pdbTarget -Algorithm SHA256
if ($sourceHash.Hash -eq $targetHash.Hash) {
Write-Host "-- Up-to-date: $pdbTarget."
return
}
}
Write-Host "-- Installing: $pdbFile to $libInstallDir"
Copy-Item -Path $pdbSource -Destination $pdbTarget -Force
}
}

Expand Down

0 comments on commit 7885c8a

Please sign in to comment.