Skip to content

Commit 7885c8a

Browse files
committed
Fix script
1 parent 8481789 commit 7885c8a

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

scripts/build-sentry-native.ps1

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
11
Push-Location modules\sentry-native
22

3-
$buildDir = "build"
4-
$installDir = "install"
5-
$installLibDir = Join-Path -Path $installDir -ChildPath "lib"
6-
7-
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
3+
$curDir = Get-Location
4+
$buildDir = Join-Path -Path $curDir -ChildPath "build"
5+
$installDir = Join-Path -Path $curDir -ChildPath "install"
6+
$pdbBuildDir = Join-Path -Path $buildDir -ChildPath "pdb"
7+
$pdbSourceDir = Join-Path -Path $pdbBuildDir -ChildPath "RelWithDebInfo"
8+
$libInstallDir = Join-Path -Path $installDir -ChildPath "lib"
9+
10+
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"
811
cmake --build $buildDir --target sentry --parallel --config RelWithDebInfo
912
cmake --build $buildDir --target crashpad_handler --parallel --config RelWithDebInfo
1013
cmake --install $buildDir --prefix $installDir --config RelWithDebInfo
1114

12-
# *** Install pbd files
15+
# *** Install PDB files
1316

1417
Write-Host "Installing PDB files"
1518

16-
17-
if (!(Test-Path -Path $installLibDir)) {
18-
Throw "Directory $installLibDir does not exist."
19+
if (!(Test-Path -Path $libInstallDir)) {
20+
Throw "Directory $libInstallDir does not exist."
1921
exit
2022
}
2123
if (!(Test-Path -Path $buildDir)) {
2224
Throw "Directory $buildDir does not exist."
2325
exit
2426
}
2527

26-
Get-ChildItem -Path $buildDir -Filter "*.pdb" -Recurse | ForEach-Object {
28+
Get-ChildItem -Path $pdbSourceDir -Filter "*.pdb" -Recurse | ForEach-Object {
2729
$pdbFile = $_.Name
2830
$pdbSource = $_.FullName
29-
$pdbDestination = Join-Path -Path $installLibDir -ChildPath $pdbFile
30-
$pdbBase = [System.IO.Path]::GetFileNameWithoutExtension($pdbFile)
31-
$libPath = Join-Path -Path $installLibDir -ChildPath "$pdbBase.lib"
31+
$pdbTarget = Join-Path -Path $libInstallDir -ChildPath $pdbFile
32+
$libBase = [System.IO.Path]::GetFileNameWithoutExtension($pdbFile)
33+
$libPath = Join-Path -Path $libInstallDir -ChildPath "$libBase.lib"
3234

3335
if (Test-Path -Path $libPath) {
34-
if (Test-Path -Path $pdbDestination && (Get-FileHash -Path $pdbSource -Algorithm SHA256).Hash -eq (Get-FileHash -Path $pdbDestination -Algorithm SHA256).Hash) {
35-
Write-Host "-- Up-to-date: $pdbFile."
36-
} else {
37-
Write-Host "-- Installing: $pdbFile to $installLibDir"
38-
Copy-Item -Path $pdbSource -Destination $pdbDestination -Force
36+
if (Test-Path -Path $pdbTarget) {
37+
$sourceHash = Get-FileHash -Path $pdbSource -Algorithm SHA256
38+
$targetHash = Get-FileHash -Path $pdbTarget -Algorithm SHA256
39+
if ($sourceHash.Hash -eq $targetHash.Hash) {
40+
Write-Host "-- Up-to-date: $pdbTarget."
41+
return
42+
}
3943
}
44+
Write-Host "-- Installing: $pdbFile to $libInstallDir"
45+
Copy-Item -Path $pdbSource -Destination $pdbTarget -Force
4046
}
4147
}
4248

0 commit comments

Comments
 (0)