-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
169 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
param ( | ||
[string] $RepoDirectory = "$PSScriptRoot/../td", | ||
[string] $ArtifactsDirectory = "$PSScriptRoot/../artifacts", | ||
[switch] $GenerateCheckResult | ||
) | ||
|
||
$ErrorActionPreference = 'Stop' | ||
Set-StrictMode -Version Latest | ||
|
||
$resultFile = "$ArtifactsDirectory/artifact.json" | ||
$inputs = [pscustomobject] @{ | ||
$InputCommitHash = (git --git-dir=$RepoDirectory/.git rev-parse HEAD) | ||
} | ||
|
||
if ($GenerateCheckResult) { | ||
$inputs | ConvertTo-Json | Set-Content $resultFile | ||
Write-Host "Result cache file generated: `"$resultFile`"." | ||
return $true | ||
} elseif (Test-Path $resultFile) { | ||
$result = Get-Content $resultFile | ConvertFrom-Json | ||
$upToDate = $result.InputCommitHash -eq $inputs.InputCommitHash | ||
Write-Host "Cache found: cached commit hash is $($result.InputCommitHash), current commit hash is $($inputs.InputCommitHash). Up to date: $upToDate." | ||
return $upToDate | ||
} else { | ||
Write-Host "Last result cache file not found: `"$resultFile`"." | ||
return $false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,62 @@ | ||
param ( | ||
[string] $td = "$PSScriptRoot/../td", | ||
[string] $InstallPrefix = "$PSScriptRoot/../build/install" | ||
[string] $InstallPrefix = "$PSScriptRoot/../build/install", | ||
[string] $CheckUpToDateScript = "$PSScriptRoot/../common/Test-UpToDate.ps1", | ||
[switch] $SkipUpToDateCheck | ||
) | ||
|
||
$ErrorActionPreference = 'Stop' | ||
Set-StrictMode -Version Latest | ||
|
||
if (-not (Test-Path $td/build)) { | ||
New-Item -Type Directory $td/build | ||
} | ||
|
||
Push-Location $td/build | ||
try { | ||
$cmakeArguments = @( | ||
'-DCMAKE_BUILD_TYPE=Release' | ||
"-DCMAKE_INSTALL_PREFIX:PATH=$InstallPrefix" | ||
'..' | ||
) | ||
$cmakePrepareCrossCompilingArguments = @( | ||
'--build' | ||
'.' | ||
'--target', 'prepare_cross_compiling' | ||
) | ||
$cmakeBuildArguments = @( | ||
'--build' | ||
'.' | ||
'--target', 'install' | ||
) | ||
|
||
cmake @cmakeArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake' | ||
if ($SkipUpToDateCheck -or !$(& $CheckUpToDateScript)) { | ||
if (-not (Test-Path $td/build)) { | ||
New-Item -Type Directory $td/build | ||
} | ||
|
||
cmake @cmakePrepareCrossCompilingArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake --build --target prepare_cross_compiling' | ||
} | ||
Push-Location $td/build | ||
try { | ||
$cmakeArguments = @( | ||
'-DCMAKE_BUILD_TYPE=Release' | ||
"-DCMAKE_INSTALL_PREFIX:PATH=$InstallPrefix" | ||
'..' | ||
) | ||
$cmakePrepareCrossCompilingArguments = @( | ||
'--build' | ||
'.' | ||
'--target', 'prepare_cross_compiling' | ||
) | ||
$cmakeBuildArguments = @( | ||
'--build' | ||
'.' | ||
'--target', 'install' | ||
) | ||
|
||
Set-Location .. | ||
php SplitSource.php | ||
if (!$?) { | ||
throw 'Cannot execute php SplitSource.php' | ||
} | ||
cmake @cmakeArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake' | ||
} | ||
|
||
cmake @cmakePrepareCrossCompilingArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake --build --target prepare_cross_compiling' | ||
} | ||
|
||
Set-Location .. | ||
php SplitSource.php | ||
if (!$?) { | ||
throw 'Cannot execute php SplitSource.php' | ||
} | ||
|
||
Set-Location build | ||
cmake @cmakeBuildArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake --build --target install' | ||
} | ||
|
||
Set-Location build | ||
cmake @cmakeBuildArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake --build --target install' | ||
& $CheckUpToDateScript -GenerateCheckResult | ||
} finally { | ||
Pop-Location | ||
} | ||
} finally { | ||
Pop-Location | ||
} else { | ||
Write-Host 'The build result is up to date.' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
param ( | ||
[string] $td = "$PSScriptRoot/../td" | ||
[string] $td = "$PSScriptRoot/../td", | ||
[string] $CheckUpToDateScript = "$PSScriptRoot/../common/Test-UpToDate.ps1", | ||
[switch] $SkipUpToDateCheck | ||
) | ||
|
||
$ErrorActionPreference = 'Stop' | ||
Set-StrictMode -Version Latest | ||
|
||
if (-not (Test-Path $td/build)) { | ||
New-Item -Type Directory $td/build | ||
} | ||
if ($SkipUpToDateCheck -or !$(& $CheckUpToDateScript)) { | ||
if (-not (Test-Path $td/build)) { | ||
New-Item -Type Directory $td/build | ||
} | ||
|
||
Push-Location $td/build | ||
try { | ||
$cmakeArguments = @( | ||
'-DCMAKE_BUILD_TYPE=Release' | ||
'-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/' | ||
'..' | ||
) | ||
$cmakeBuildArguments = @( | ||
'--build' | ||
'.' | ||
) | ||
Push-Location $td/build | ||
try { | ||
$cmakeArguments = @( | ||
'-DCMAKE_BUILD_TYPE=Release' | ||
'-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/' | ||
'..' | ||
) | ||
$cmakeBuildArguments = @( | ||
'--build' | ||
'.' | ||
) | ||
|
||
cmake @cmakeArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake' | ||
} | ||
cmake @cmakeArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake' | ||
} | ||
|
||
cmake @cmakeBuildArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake --build' | ||
cmake @cmakeBuildArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake --build' | ||
} | ||
} finally { | ||
Pop-Location | ||
} | ||
} finally { | ||
Pop-Location | ||
} else { | ||
Write-Host 'The build result is up to date.' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,60 @@ | ||
param ( | ||
[string] $td = "$PSScriptRoot/../td", | ||
[string] $Platform = 'x64-windows', | ||
[Parameter(Mandatory = $true)] [string] $VcpkgToolchain | ||
[Parameter(Mandatory = $true)] [string] $VcpkgToolchain, | ||
[string] $CheckUpToDateScript = "$PSScriptRoot/../common/Test-UpToDate.ps1", | ||
[switch] $SkipUpToDateCheck | ||
) | ||
|
||
$ErrorActionPreference = 'Stop' | ||
Set-StrictMode -Version Latest | ||
|
||
if (-not (Test-Path $td/build)) { | ||
New-Item -Type Directory $td/build | ||
} | ||
if ($SkipUpToDateCheck -or !$(& $CheckUpToDateScript)) { | ||
if (-not (Test-Path $td/build)) { | ||
New-Item -Type Directory $td/build | ||
} | ||
|
||
Push-Location $td/build | ||
try { | ||
$vcpkgArguments = @( | ||
'install' | ||
"gperf:$platform" | ||
"openssl:$platform" | ||
"zlib:$platform" | ||
) | ||
$cmakeArguments = @( | ||
"-DCMAKE_TOOLCHAIN_FILE=$VcpkgToolchain" | ||
'-DCMAKE_DISABLE_FIND_PACKAGE_Readline=TRUE' # workaround for #76 | ||
'..' | ||
) | ||
$cmakeBuildArguments = @( | ||
'--build' | ||
'.' | ||
'--config' | ||
'Release' | ||
) | ||
Push-Location $td/build | ||
try { | ||
$vcpkgArguments = @( | ||
'install' | ||
"gperf:$platform" | ||
"openssl:$platform" | ||
"zlib:$platform" | ||
) | ||
$cmakeArguments = @( | ||
"-DCMAKE_TOOLCHAIN_FILE=$VcpkgToolchain" | ||
'-DCMAKE_DISABLE_FIND_PACKAGE_Readline=TRUE' # workaround for #76 | ||
'..' | ||
) | ||
$cmakeBuildArguments = @( | ||
'--build' | ||
'.' | ||
'--config' | ||
'Release' | ||
) | ||
|
||
if ($Platform -eq 'x64-windows') { | ||
$cmakeArguments += @('-A', 'X64') | ||
} | ||
if ($Platform -eq 'x64-windows') { | ||
$cmakeArguments += @('-A', 'X64') | ||
} | ||
|
||
vcpkg @vcpkgArguments | ||
if (!$?) { | ||
throw 'Cannot execute vcpkg' | ||
} | ||
vcpkg @vcpkgArguments | ||
if (!$?) { | ||
throw 'Cannot execute vcpkg' | ||
} | ||
|
||
cmake @cmakeArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake' | ||
} | ||
cmake @cmakeArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake' | ||
} | ||
|
||
cmake @cmakeBuildArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake --build' | ||
cmake @cmakeBuildArguments | ||
if (!$?) { | ||
throw 'Cannot execute cmake --build' | ||
} | ||
} finally { | ||
Pop-Location | ||
} | ||
} finally { | ||
Pop-Location | ||
} else { | ||
Write-Host 'The build result is up to date.' | ||
} |