Skip to content

Commit a54ba7d

Browse files
committed
Update for >= 2171 to use Cmake to be forward compatible with 2272.
The changes were written using Cmake 3.2.1. Former-commit-id: 1a522f3d935c23742f08b1ac3b3ffa9a9e4bdd95
1 parent 3448b69 commit a54ba7d

File tree

1 file changed

+34
-26
lines changed

1 file changed

+34
-26
lines changed

build.ps1

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ $WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition
1111
$Cef = Join-Path $WorkingDir 'cef'
1212
$CefInclude = Join-Path $Cef 'include'
1313
$Cef32 = Join-Path $WorkingDir 'cef_binary_3.y.z_windows32'
14-
$Cef32vcx =Join-Path $Cef32 'libcef_dll_wrapper.vcxproj'
14+
$Cef32vcx = Join-Path (Join-Path $Cef32 'libcef_dll') 'libcef_dll_wrapper.vcxproj'
1515
$Cef64 = Join-Path $WorkingDir 'cef_binary_3.y.z_windows64'
16-
$Cef64vcx =Join-Path $Cef64 'libcef_dll_wrapper.vcxproj'
16+
$Cef64vcx = Join-Path (Join-Path $Cef64 'libcef_dll') 'libcef_dll_wrapper.vcxproj'
1717

18-
$CefVersion = "3.2171.1979"
19-
$CefPackageVersion = "3.2171.1979"
18+
$CefVersion = "3.2171.2069"
19+
$CefPackageVersion = "3.2171.2069"
2020

2121
# https://github.com/jbake/Powershell_scripts/blob/master/Invoke-BatchFile.ps1
2222
function Invoke-BatchFile
@@ -38,7 +38,6 @@ function Invoke-BatchFile
3838
Set-Content "env:\$($matches[1])" $matches[2]
3939
}
4040
}
41-
4241
Remove-Item $tempFile
4342
}
4443

@@ -62,8 +61,8 @@ function Die
6261
)
6362

6463
Write-Host
65-
Write-Error $Message
66-
exit 1
64+
Write-Error $Message
65+
exit 1
6766

6867
}
6968

@@ -75,8 +74,8 @@ function Warn
7574
)
7675

7776
Write-Host
78-
Write-Host $Message -ForegroundColor Yellow
79-
Write-Host
77+
Write-Host $Message -ForegroundColor Yellow
78+
Write-Host
8079

8180
}
8281

@@ -159,6 +158,7 @@ function Msvs
159158
$PlatformTarget = $null
160159
$VisualStudioVersion = $null
161160
$VXXCommonTools = $null
161+
$CmakeGenerator = $null
162162

163163
switch -Exact ($Toolchain) {
164164
'v100' {
@@ -170,11 +170,13 @@ function Msvs
170170
$PlatformTarget = '4.0'
171171
$VisualStudioVersion = '11.0'
172172
$VXXCommonTools = Join-Path $env:VS110COMNTOOLS '..\..\vc'
173+
$CmakeGenerator = 'Visual Studio 11 2012'
173174
}
174175
'v120' {
175176
$PlatformTarget = '12.0'
176177
$VisualStudioVersion = '12.0'
177178
$VXXCommonTools = Join-Path $env:VS120COMNTOOLS '..\..\vc'
179+
$CmakeGenerator = 'Visual Studio 12 2013'
178180
}
179181
}
180182

@@ -183,7 +185,8 @@ function Msvs
183185
}
184186

185187
$CefProject = TernaryReturn ($Platform -eq 'x86') $Cef32vcx $Cef64vcx
186-
188+
$CefDir = TernaryReturn ($Platform -eq 'x86') $Cef32 $Cef64
189+
187190
#Manually change project file to compile using /MDd and /MD
188191
(Get-Content $CefProject) | Foreach-Object {$_ -replace "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>", '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>'} | Set-Content $CefProject
189192
(Get-Content $CefProject) | Foreach-Object {$_ -replace "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>", '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>'} | Set-Content $CefProject
@@ -198,14 +201,20 @@ function Msvs
198201
$VCXProj = $Cef64vcx
199202
}
200203

204+
$Arch = TernaryReturn ($Platform -eq 'x64') 'x64' 'win32'
205+
$CmakeArch = TernaryReturn ($Platform -eq 'x64') ' Win64' ''
206+
201207
# Only configure build environment once
202-
if($env:CEFSHARP_BUILD_IS_BOOTSTRAPPED -eq $null) {
208+
if ($env:CEFSHARP_BUILD_IS_BOOTSTRAPPED -ne "$Toolchain$Platform") {
203209
Invoke-BatchFile $VCVarsAll $Platform
204-
$env:CEFSHARP_BUILD_IS_BOOTSTRAPPED = $true
210+
pushd $CefDir
211+
rm CMakeCache.txt
212+
rm -r CMakeFiles
213+
cmake -G "$CmakeGenerator$CmakeArch"
214+
popd
215+
$env:CEFSHARP_BUILD_IS_BOOTSTRAPPED = "$Toolchain$Platform"
205216
}
206217

207-
$Arch = TernaryReturn ($Platform -eq 'x64') 'x64' 'win32'
208-
209218
$Arguments = @(
210219
"$CefProject",
211220
"/t:rebuild",
@@ -307,11 +316,10 @@ function CreateCefSdk
307316
$CefArchDir = TernaryReturn ($Platform -eq 'x64') $Cef64 $Cef32
308317

309318
# cef_binary_3.y.z_windows32\out\debug\lib -> cef\win32\debug\vs2013
310-
Copy-Item $CefArchDir\out\$Configuration\lib\libcef_dll_wrapper.lib $Cef\$Arch\$Configuration\$VisualStudioVersion | Out-Null
319+
Copy-Item $CefArchDir\libcef_dll\$Configuration\libcef_dll_wrapper.lib $Cef\$Arch\$Configuration\$VisualStudioVersion | Out-Null
311320

312321
# cef_binary_3.y.z_windows32\debug -> cef\win32\debug
313322
Copy-Item $CefArchDir\$Configuration\libcef.lib $Cef\$Arch\$Configuration | Out-Null
314-
315323
}
316324

317325
function Nupkg
@@ -330,20 +338,20 @@ function Nupkg
330338
[xml]$Xml = Get-Content $RedistTargetsFilename
331339
$Xml.Project.Target | Foreach-Object { $_.Name = 'CefRedistCopyDllPak32'}
332340
$Xml.Save($RedistTargetsFilename)
333-
341+
334342
# Build 32bit packages
335343
#. $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Debug;DotConfiguration=.Debug;Platform=x86;CPlatform=windows32;' -OutputDirectory nuget
336344
. $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;DotConfiguration=;Platform=x86;CPlatform=windows32;' -OutputDirectory nuget
337-
345+
338346
# Write 64bit redist target
339347
[xml]$Xml = Get-Content $RedistTargetsFilename
340348
$Xml.Project.Target | Foreach-Object { $_.Name = 'CefRedistCopyDllPak64'}
341349
$Xml.Save($RedistTargetsFilename)
342-
350+
343351
# Build 64bit packages
344352
#. $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Debug;DotConfiguration=.Debug;Platform=x64;CPlatform=windows64;' -OutputDirectory nuget
345353
. $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;DotConfiguration=;Platform=x64;CPlatform=windows64;' -OutputDirectory nuget
346-
354+
347355
# Build sdk
348356
$Filename = Resolve-Path ".\nuget\cef.sdk.props"
349357
$Text = (Get-Content $Filename) -replace '<CefSdkVer>.*<\/CefSdkVer>', "<CefSdkVer>cef.sdk.$CefPackageVersion</CefSdkVer>"
@@ -354,12 +362,12 @@ function Nupkg
354362

355363
function DownloadNuget()
356364
{
357-
$Nuget = Join-Path $env:LOCALAPPDATA .\nuget\NuGet.exe
365+
$Nuget = Join-Path $env:LOCALAPPDATA .\nuget\NuGet.exe
358366
if(-not (Test-Path $Nuget))
359-
{
360-
$Client = New-Object System.Net.WebClient;
361-
$Client.DownloadFile('http://nuget.org/nuget.exe', $Nuget);
362-
}
367+
{
368+
$Client = New-Object System.Net.WebClient;
369+
$Client.DownloadFile('http://nuget.org/nuget.exe', $Nuget);
370+
}
363371
}
364372

365373
DownloadNuget
@@ -373,7 +381,7 @@ switch -Exact ($Target) {
373381
#VSX v100
374382
Nupkg
375383
}
376-
"nupkg-only" {
384+
"nupkg-only" {
377385
Nupkg
378386
}
379387
"vs2013" {

0 commit comments

Comments
 (0)