|
1 | 1 | Push-Location modules\sentry-native
|
2 | 2 |
|
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" |
8 | 11 | cmake --build $buildDir --target sentry --parallel --config RelWithDebInfo
|
9 | 12 | cmake --build $buildDir --target crashpad_handler --parallel --config RelWithDebInfo
|
10 | 13 | cmake --install $buildDir --prefix $installDir --config RelWithDebInfo
|
11 | 14 |
|
12 |
| -# *** Install pbd files |
| 15 | +# *** Install PDB files |
13 | 16 |
|
14 | 17 | Write-Host "Installing PDB files"
|
15 | 18 |
|
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." |
19 | 21 | exit
|
20 | 22 | }
|
21 | 23 | if (!(Test-Path -Path $buildDir)) {
|
22 | 24 | Throw "Directory $buildDir does not exist."
|
23 | 25 | exit
|
24 | 26 | }
|
25 | 27 |
|
26 |
| -Get-ChildItem -Path $buildDir -Filter "*.pdb" -Recurse | ForEach-Object { |
| 28 | +Get-ChildItem -Path $pdbSourceDir -Filter "*.pdb" -Recurse | ForEach-Object { |
27 | 29 | $pdbFile = $_.Name
|
28 | 30 | $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" |
32 | 34 |
|
33 | 35 | 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 | + } |
39 | 43 | }
|
| 44 | + Write-Host "-- Installing: $pdbFile to $libInstallDir" |
| 45 | + Copy-Item -Path $pdbSource -Destination $pdbTarget -Force |
40 | 46 | }
|
41 | 47 | }
|
42 | 48 |
|
|
0 commit comments