Skip to content

Commit eb895e1

Browse files
committed
Don't modify the project until it exists.
Former-commit-id: 62fc6493c3433ce4c957eaa71aaa08f9ffc8f2d3
1 parent 16c3bb3 commit eb895e1

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

build.ps1

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,19 @@ function Invoke-BatchFile
2828
[string]$Parameters
2929
)
3030

31-
$tempFile = [IO.Path]::GetTempFileName()
31+
$tempFile = [IO.Path]::GetTempFileName()
32+
$batFile = [IO.Path]::GetTempFileName() + '.cmd'
3233

33-
cmd.exe /c " `"$Path`" $Parameters && set > `"$tempFile`" "
34+
Set-Content -Path $batFile -Value "`"$Path`" $Parameters && set > `"$tempFile`""
35+
36+
$batFile
3437

3538
Get-Content $tempFile | Foreach-Object {
3639
if ($_ -match "^(.*?)=(.*)$")
3740
{
3841
Set-Content "env:\$($matches[1])" $matches[2]
3942
}
40-
}
43+
}
4144
Remove-Item $tempFile
4245
}
4346

@@ -187,9 +190,8 @@ function Msvs
187190
$CefProject = TernaryReturn ($Platform -eq 'x86') $Cef32vcx $Cef64vcx
188191
$CefDir = TernaryReturn ($Platform -eq 'x86') $Cef32 $Cef64
189192

190-
#Manually change project file to compile using /MDd and /MD
191-
(Get-Content $CefProject) | Foreach-Object {$_ -replace "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>", '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>'} | Set-Content $CefProject
192-
(Get-Content $CefProject) | Foreach-Object {$_ -replace "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>", '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>'} | Set-Content $CefProject
193+
$Arch = TernaryReturn ($Platform -eq 'x64') 'x64' 'win32'
194+
$CmakeArch = TernaryReturn ($Platform -eq 'x64') ' Win64' ''
193195

194196
$VCVarsAll = Join-Path $VXXCommonTools vcvarsall.bat
195197
if (-not (Test-Path $VCVarsAll)) {
@@ -201,20 +203,21 @@ function Msvs
201203
$VCXProj = $Cef64vcx
202204
}
203205

204-
$Arch = TernaryReturn ($Platform -eq 'x64') 'x64' 'win32'
205-
$CmakeArch = TernaryReturn ($Platform -eq 'x64') ' Win64' ''
206-
207206
# Only configure build environment once
208207
if ($env:CEFSHARP_BUILD_IS_BOOTSTRAPPED -ne "$Toolchain$Platform") {
209208
Invoke-BatchFile $VCVarsAll $Platform
210209
pushd $CefDir
211-
rm CMakeCache.txt
212-
rm -r CMakeFiles
210+
rm CMakeCache.txt -ErrorAction:Ignore
211+
rm -r CMakeFiles -ErrorAction:Ignore
213212
cmake -G "$CmakeGenerator$CmakeArch"
214213
popd
215214
$env:CEFSHARP_BUILD_IS_BOOTSTRAPPED = "$Toolchain$Platform"
216215
}
217216

217+
#Manually change project file to compile using /MDd and /MD
218+
(Get-Content $CefProject) | Foreach-Object {$_ -replace "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>", '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>'} | Set-Content $CefProject
219+
(Get-Content $CefProject) | Foreach-Object {$_ -replace "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>", '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>'} | Set-Content $CefProject
220+
218221
$Arguments = @(
219222
"$CefProject",
220223
"/t:rebuild",

0 commit comments

Comments
 (0)