2014-02-01 09:21:01 +01:00
|
|
|
#
|
|
|
|
# POCO build script
|
2018-05-28 12:19:50 +02:00
|
|
|
#
|
2014-02-01 09:21:01 +01:00
|
|
|
# Usage:
|
|
|
|
# ------
|
2014-02-01 09:27:31 +01:00
|
|
|
# buildwin.ps1 [-poco_base dir]
|
2018-05-28 12:19:50 +02:00
|
|
|
# [-vs_version 150 | 140]
|
|
|
|
# [-vs_flavor Community | Professional | Enterprise]
|
2014-02-01 09:21:01 +01:00
|
|
|
# [-action build | rebuild | clean]
|
|
|
|
# [-linkmode shared | static_mt | static_md | all]
|
|
|
|
# [-config release | debug | both]
|
2014-04-19 19:59:50 +02:00
|
|
|
# [-platform Win32 | x64 | WinCE | WEC2013]
|
2014-02-01 09:21:01 +01:00
|
|
|
# [-samples]
|
|
|
|
# [-tests]
|
|
|
|
# [-omit "Lib1X;LibY;LibZ;..."]
|
2018-01-29 16:22:45 +01:00
|
|
|
# [-tool msbuild | devenv]
|
2014-02-01 09:21:01 +01:00
|
|
|
# [-openssl_base dir]
|
|
|
|
# [-mysql_base dir]
|
|
|
|
|
|
|
|
[CmdletBinding()]
|
|
|
|
Param
|
|
|
|
(
|
|
|
|
[Parameter()]
|
|
|
|
[string] $poco_base,
|
|
|
|
|
|
|
|
[Parameter()]
|
2018-05-28 12:19:50 +02:00
|
|
|
[ValidateSet(140, 150)]
|
2014-02-01 09:21:01 +01:00
|
|
|
[int] $vs_version,
|
|
|
|
|
2018-05-28 12:19:50 +02:00
|
|
|
[Parameter()]
|
|
|
|
[ValidateSet('Community' , 'Professional' , 'Enterprise')]
|
|
|
|
[string] $vs_flavor = 'Community',
|
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
[Parameter()]
|
|
|
|
[ValidateSet('build', 'rebuild', 'clean')]
|
|
|
|
[string] $action = 'build',
|
|
|
|
|
|
|
|
[Parameter()]
|
|
|
|
[ValidateSet('shared', 'static_mt', 'static_md', 'all')]
|
|
|
|
[string] $linkmode = 'shared',
|
|
|
|
|
|
|
|
[Parameter()]
|
|
|
|
[ValidateSet('release', 'debug', 'both')]
|
|
|
|
[string] $config = 'release',
|
|
|
|
|
|
|
|
[Parameter()]
|
2014-04-19 19:59:50 +02:00
|
|
|
[ValidateSet('Win32', 'x64', 'WinCE', 'WEC2013')]
|
2014-02-01 09:21:01 +01:00
|
|
|
[string] $platform = 'x64',
|
2018-01-29 16:22:45 +01:00
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
[switch] $tests = $false,
|
|
|
|
[switch] $samples = $false,
|
|
|
|
[string] $omit,
|
2018-01-29 16:22:45 +01:00
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
[Parameter()]
|
2018-01-29 16:22:45 +01:00
|
|
|
[ValidateSet('msbuild', 'devenv')]
|
2014-02-01 09:21:01 +01:00
|
|
|
[string] $tool = 'msbuild',
|
|
|
|
|
|
|
|
[Parameter()]
|
|
|
|
[string] $openssl_base,
|
|
|
|
|
|
|
|
[Parameter()]
|
|
|
|
[string] $mysql_base,
|
|
|
|
|
|
|
|
[switch] $help
|
|
|
|
)
|
|
|
|
|
2014-02-01 09:23:48 +01:00
|
|
|
|
2014-04-25 04:15:54 +02:00
|
|
|
function Add-Env-Var([string] $lib, [string] $var)
|
|
|
|
{
|
|
|
|
if ((${Env:$var} -eq $null) -or (-not ${Env:$var}.Contains(${Env:$lib_$var"})))
|
|
|
|
{
|
2014-04-26 06:22:54 +02:00
|
|
|
$libvar = "$lib" + "_" + "$var"
|
2018-05-30 19:11:08 +02:00
|
|
|
$envvar = [Environment]::GetEnvironmentVariable($var, "Process")
|
|
|
|
$envvar = $envvar + ';' + [Environment]::GetEnvironmentVariable($libvar, "Process")
|
2014-04-26 06:22:54 +02:00
|
|
|
[Environment]::SetEnvironmentVariable($var, $envvar, "Process")
|
2014-04-25 04:15:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
function Set-Environment
|
|
|
|
{
|
|
|
|
if ($poco_base -eq '') { $script:poco_base = Get-Location }
|
|
|
|
|
|
|
|
if ($vs_version -eq 0)
|
|
|
|
{
|
2017-02-20 16:35:22 +01:00
|
|
|
if ($Env:VS150COMNTOOLS -ne '') { $script:vs_version = 150 }
|
|
|
|
elseif ($Env:VS140COMNTOOLS -ne '') { $script:vs_version = 140 }
|
2014-02-01 09:21:01 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Write-Host 'Visual Studio not found, exiting.'
|
2018-05-28 12:19:50 +02:00
|
|
|
Exit 1
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-28 12:19:50 +02:00
|
|
|
if (-Not $Env:PATH.Contains("$Env:POCO_BASE\bin64;$Env:POCO_BASE\bin;"))
|
2014-04-26 06:22:54 +02:00
|
|
|
{ $Env:PATH = "$Env:POCO_BASE\bin64;$Env:POCO_BASE\bin;$Env:PATH" }
|
|
|
|
|
2014-04-25 04:15:54 +02:00
|
|
|
if ($openssl_base -eq '')
|
2014-02-01 09:21:01 +01:00
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
$script:openssl_base = '$poco_base\openssl'
|
2014-04-25 04:15:54 +02:00
|
|
|
}
|
2018-05-28 12:19:50 +02:00
|
|
|
|
2014-04-25 04:15:54 +02:00
|
|
|
$Env:OPENSSL_DIR = "$openssl_base"
|
|
|
|
$Env:OPENSSL_INCLUDE = "$Env:OPENSSL_DIR\include"
|
|
|
|
$Env:OPENSSL_LIB = "$Env:OPENSSL_DIR\lib;$Env:OPENSSL_DIR\lib\VC"
|
2014-04-26 06:22:54 +02:00
|
|
|
Add-Env-Var "OPENSSL" "INCLUDE"
|
|
|
|
Add-Env-Var "OPENSSL" "LIB"
|
2014-02-01 09:21:01 +01:00
|
|
|
|
2014-04-25 04:15:54 +02:00
|
|
|
if ($mysql_base -ne '')
|
|
|
|
{
|
2014-02-01 09:21:01 +01:00
|
|
|
$Env:MYSQL_DIR = "$mysql_base"
|
|
|
|
$Env:MYSQL_INCLUDE = "$Env:MYSQL_DIR\include"
|
|
|
|
$Env:MYSQL_LIB = "$Env:MYSQL_DIR\lib"
|
2014-05-12 09:41:48 +02:00
|
|
|
Add-Env-Var "MYSQL" "INCLUDE"
|
|
|
|
Add-Env-Var "MYSQL" "LIB"
|
2014-04-25 04:15:54 +02:00
|
|
|
}
|
2014-02-01 09:21:01 +01:00
|
|
|
|
2014-04-25 04:15:54 +02:00
|
|
|
$vsct = "VS$($vs_version)COMNTOOLS"
|
2018-05-28 12:19:50 +02:00
|
|
|
$vsdir = ''
|
|
|
|
if ($vs_version -eq 150)
|
|
|
|
{
|
|
|
|
if (-not (Test-Path Env:$vsct)) { Set-Item -path Env:$vsct -value "C:\Program Files (x86)\Microsoft Visual Studio\2017\$($vs_flavor)\Common7\Tools" }
|
|
|
|
}
|
2014-04-25 04:15:54 +02:00
|
|
|
$vsdir = (Get-Item Env:$vsct).Value
|
|
|
|
$Command = ''
|
2017-02-20 16:35:22 +01:00
|
|
|
$CommandArg = ''
|
2018-01-29 16:22:45 +01:00
|
|
|
if ($platform -eq 'x64') { $CommandArg = "amd64" }
|
|
|
|
else { $CommandArg = "x86" }
|
2017-02-20 16:35:22 +01:00
|
|
|
if ($vs_version -ge 150)
|
|
|
|
{
|
2018-05-28 12:19:50 +02:00
|
|
|
$Command = Resolve-Path "$($vsdir)\..\..\VC\Auxiliary\Build\vcvarsall.bat"
|
|
|
|
$script:msbuild_exe = Resolve-Path "$($vsdir)\..\..\MSBuild\15.0\Bin\MSBuild.exe"
|
2017-02-20 16:35:22 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-28 12:19:50 +02:00
|
|
|
$Command = Resolve-Path "$($vsdir)\..\..\VC\vcvarsall.bat"
|
2018-01-29 16:22:45 +01:00
|
|
|
$script:msbuild_exe = "MSBuild.exe"
|
2014-04-25 04:15:54 +02:00
|
|
|
}
|
2018-05-28 12:19:50 +02:00
|
|
|
|
2014-04-25 04:15:54 +02:00
|
|
|
$tempFile = [IO.Path]::GetTempFileName()
|
2017-02-20 16:35:22 +01:00
|
|
|
cmd /c " `"$Command`" $CommandArg && set > `"$tempFile`" "
|
2014-04-25 04:15:54 +02:00
|
|
|
Get-Content $tempFile | Foreach-Object {
|
|
|
|
if($_ -match "^(.*?)=(.*)$")
|
|
|
|
{
|
|
|
|
Set-Content "Env:$($matches[1])" $matches[2]
|
|
|
|
}
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
2014-04-25 04:15:54 +02:00
|
|
|
Remove-Item $tempFile
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function Process-Input
|
|
|
|
{
|
|
|
|
if ($help -eq $true)
|
|
|
|
{
|
|
|
|
Write-Host 'Usage:'
|
|
|
|
Write-Host '------'
|
2014-02-01 09:27:31 +01:00
|
|
|
Write-Host 'buildwin.ps1 [-poco_base dir]'
|
2018-05-28 12:19:50 +02:00
|
|
|
Write-Host ' [-vs_version 150 | 140]'
|
|
|
|
Write-Host ' [-vs_flavor Community | Professional | Enterprise]'
|
2014-02-01 09:21:01 +01:00
|
|
|
Write-Host ' [-action build | rebuild | clean]'
|
|
|
|
Write-Host ' [-linkmode shared | static_mt | static_md | all]'
|
|
|
|
Write-Host ' [-config release | debug | both]'
|
2014-04-19 19:59:50 +02:00
|
|
|
Write-Host ' [-platform Win32 | x64 | WinCE | WEC2013]'
|
2014-02-01 09:21:01 +01:00
|
|
|
Write-Host ' [-samples]'
|
|
|
|
Write-Host ' [-tests]'
|
|
|
|
Write-Host ' [-omit "Lib1X;LibY;LibZ;..."]'
|
2018-01-29 16:22:45 +01:00
|
|
|
Write-Host ' [-tool msbuild | devenv]'
|
2014-02-01 09:21:01 +01:00
|
|
|
Write-Host ' [-openssl_base dir]'
|
|
|
|
Write-Host ' [-mysql_base dir]'
|
|
|
|
|
|
|
|
Exit
|
|
|
|
}
|
|
|
|
else
|
2018-01-29 16:22:45 +01:00
|
|
|
{
|
2014-02-01 09:21:01 +01:00
|
|
|
Set-Environment
|
|
|
|
|
2014-04-25 04:15:54 +02:00
|
|
|
Write-Host "Build configuration:"
|
|
|
|
Write-Host "--------------------"
|
2014-02-01 09:21:01 +01:00
|
|
|
Write-Host "Poco Base: $poco_base"
|
|
|
|
Write-Host "Version: $vs_version"
|
|
|
|
Write-Host "Action: $action"
|
|
|
|
Write-Host "Link Mode: $linkmode"
|
|
|
|
Write-Host "Configuration: $config"
|
|
|
|
Write-Host "Platform: $platform"
|
|
|
|
Write-Host "Tests: $tests"
|
|
|
|
Write-Host "Samples: $samples"
|
|
|
|
Write-Host "Build Tool: $tool"
|
|
|
|
|
2018-05-28 12:19:50 +02:00
|
|
|
if ($vs_version -eq 150)
|
|
|
|
{
|
|
|
|
Write-Host "VS flavor: $vs_flavor"
|
|
|
|
}
|
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
if ($omit -ne '')
|
|
|
|
{
|
|
|
|
Write-Host "Omit: $omit"
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($openssl_base -ne '')
|
|
|
|
{
|
|
|
|
Write-Host "OpenSSL: $openssl_base"
|
|
|
|
}
|
2018-05-28 12:19:50 +02:00
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
if ($mysql_base -ne '')
|
|
|
|
{
|
|
|
|
Write-Host "MySQL: $mysql_base"
|
|
|
|
}
|
|
|
|
|
2014-04-25 04:15:54 +02:00
|
|
|
# NB: this won't work in PowerShell ISE
|
2018-05-28 12:19:50 +02:00
|
|
|
#Write-Host "Press Ctrl-C to exit or any other key to continue ..."
|
|
|
|
#$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp")
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-29 16:22:45 +01:00
|
|
|
function Exec-MSBuild([string] $vsProject, [string] $projectConfig)
|
|
|
|
{
|
|
|
|
if (!(Test-Path -Path $vsProject -PathType leaf)) {
|
|
|
|
Write-Host "Project $vsProject not found, skipping."
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-05-28 12:19:50 +02:00
|
|
|
$cmd = "&`"$script:msbuild_exe`" $vsProject /m /t:$action /p:Configuration=$projectConfig /p:BuildProjectReferences=false /p:Platform=$platform /p:useenv=true"
|
2018-01-29 16:22:45 +01:00
|
|
|
Write-Host $cmd
|
|
|
|
Invoke-Expression $cmd
|
|
|
|
if ($LastExitCode -ne 0) { Exit $LastExitCode }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-31 21:21:50 +02:00
|
|
|
function Build-MSBuild([string] $vsProject, [switch] $skipStatic)
|
2014-02-01 09:21:01 +01:00
|
|
|
{
|
2018-05-31 21:21:50 +02:00
|
|
|
if ($linkmode -contains "static" -and $skipStatic) { Return }
|
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
if ($linkmode -eq 'all')
|
|
|
|
{
|
2018-05-31 21:21:50 +02:00
|
|
|
$linkModeArr = @('shared')
|
|
|
|
if (-not $skipStatic)
|
|
|
|
{
|
|
|
|
$linkModeArr += 'static_mt', 'static_md'
|
|
|
|
}
|
2014-02-01 09:21:01 +01:00
|
|
|
|
|
|
|
foreach ($mode in $linkModeArr)
|
|
|
|
{
|
|
|
|
if ($config -eq 'both')
|
|
|
|
{
|
|
|
|
$configArr = 'release', 'debug'
|
|
|
|
foreach ($cfg in $configArr)
|
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
Exec-MSBuild $vsProject "$($cfg)_$($mode)"
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else #config
|
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
Exec-MSBuild $vsProject "$($config)_$($mode)"
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else #linkmode
|
|
|
|
{
|
|
|
|
if ($config -eq 'both')
|
|
|
|
{
|
|
|
|
$configArr = 'release', 'debug'
|
|
|
|
foreach ($cfg in $configArr)
|
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
Exec-MSBuild $vsProject "$($cfg)_$($linkmode)"
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else #config
|
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
Exec-MSBuild $vsProject "$($config)_$($linkmode)"
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-29 16:22:45 +01:00
|
|
|
function Exec-Devenv([string] $projectConfig, [string] $vsProject)
|
|
|
|
{
|
|
|
|
$cmd = "devenv /useenv /$action $projectConfig $vsProject"
|
|
|
|
Write-Host $cmd
|
|
|
|
Invoke-Expression $cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-31 21:21:50 +02:00
|
|
|
function Build-Devenv([string] $vsProject, [switch] $skipStatic)
|
2014-02-01 09:21:01 +01:00
|
|
|
{
|
2018-05-31 21:21:50 +02:00
|
|
|
if ($linkmode -contains "static" -and $skipStatic) { Return }
|
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
if ($linkmode -eq 'all')
|
|
|
|
{
|
2018-05-31 21:21:50 +02:00
|
|
|
$linkModeArr = @('shared')
|
|
|
|
if (-not $skipStatic)
|
|
|
|
{
|
|
|
|
$linkModeArr += 'static_mt', 'static_md'
|
|
|
|
}
|
2014-02-01 09:21:01 +01:00
|
|
|
|
|
|
|
foreach ($mode in $linkModeArr)
|
|
|
|
{
|
|
|
|
if ($config -eq 'both')
|
|
|
|
{
|
|
|
|
$configArr = 'release', 'debug'
|
|
|
|
foreach ($cfg in $configArr)
|
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
Exec-Devenv "$($cfg)_$($mode)" $vsProject
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else #config
|
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
Exec-Devenv "$($config)_$($mode)" $vsProject
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else #linkmode
|
|
|
|
{
|
|
|
|
if ($config -eq 'both')
|
|
|
|
{
|
|
|
|
$configArr = 'release', 'debug'
|
|
|
|
foreach ($cfg in $configArr)
|
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
Exec-Devenv "$($cfg)_$($linkmode)" $vsProject
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else #config
|
|
|
|
{
|
2018-01-29 16:22:45 +01:00
|
|
|
Exec-Devenv "$($config)_$($linkmode)" $vsProject
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function Build-samples
|
|
|
|
{
|
2018-05-28 12:19:50 +02:00
|
|
|
process {
|
2014-02-01 09:21:01 +01:00
|
|
|
$sampleName = $_.BaseName.split("_")[0]
|
|
|
|
$sampleProjName = "$($poco_base)\$($componentDir)\samples\$($sampleName)\$($_)"
|
|
|
|
if ($tool -eq 'devenv') { Build-Devenv $sampleProjName }
|
|
|
|
elseif ($tool -eq 'msbuild') { Build-MSBuild $sampleProjName }
|
|
|
|
else{ Write-Host "Tool not supported: $tool" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-31 21:21:50 +02:00
|
|
|
function Build-Exec([string] $tool, [string] $vsProject, [switch] $skipStatic)
|
|
|
|
{
|
|
|
|
if (!(Test-Path -Path $vsProject)) # not found
|
|
|
|
{
|
|
|
|
Write-Host "+------------------------------------------------------------------"
|
|
|
|
Write-Host "| VS project $vsProject not found, skipping."
|
|
|
|
Write-Host "+------------------------------------------------------------------"
|
|
|
|
Return
|
|
|
|
}
|
|
|
|
if ($tool -eq 'devenv') { Build-Devenv $vsProject -skipStatic:$skipStatic }
|
|
|
|
elseif ($tool -eq 'msbuild') { Build-MSBuild $vsProject -skipStatic:$skipStatic }
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Write-Host "Build tool $tool not supported. Exiting."
|
|
|
|
Exit -1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-28 12:19:50 +02:00
|
|
|
function Build-Components([string] $extension, [string] $platformName, [string] $type)
|
2014-02-01 09:21:01 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
Get-Content "$poco_base\components" | Foreach-Object {
|
|
|
|
|
|
|
|
$component = $_
|
|
|
|
$componentDir = $_.Replace("/", "\")
|
|
|
|
$componentArr = $_.split('/')
|
|
|
|
$componentName = $componentArr[$componentArr.Length - 1]
|
|
|
|
$suffix = "_vs$vs_version"
|
2018-05-28 12:19:50 +02:00
|
|
|
|
2014-04-19 04:32:30 +02:00
|
|
|
$omitArray = @()
|
|
|
|
$omit.Split(',;') | ForEach {
|
2018-05-31 21:21:50 +02:00
|
|
|
$omitArray += $_.Trim()
|
2014-04-19 04:32:30 +02:00
|
|
|
}
|
2014-02-01 09:21:01 +01:00
|
|
|
|
|
|
|
if ($omitArray -NotContains $component)
|
|
|
|
{
|
|
|
|
$vsProject = "$poco_base\$componentDir\$componentName$($platformName)$($suffix).$($extension)"
|
2018-05-28 12:19:50 +02:00
|
|
|
|
2014-08-22 23:11:43 +02:00
|
|
|
if (!(Test-Path -Path $vsProject)) # when VS project name is not same as directory name
|
|
|
|
{
|
|
|
|
$vsProject = "$poco_base\$componentDir$($platformName)$($suffix).$($extension)"
|
|
|
|
if (!(Test-Path -Path $vsProject)) # not found
|
|
|
|
{
|
|
|
|
Write-Host "+------------------------------------------------------------------"
|
|
|
|
Write-Host "| VS project $vsProject not found, skipping."
|
|
|
|
Write-Host "+------------------------------------------------------------------"
|
|
|
|
Return # since Foreach-Object is a function, this is actually loop "continue"
|
|
|
|
}
|
|
|
|
}
|
2018-05-28 12:19:50 +02:00
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Write-Host "| Building $vsProject"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
|
2018-05-28 12:19:50 +02:00
|
|
|
if ($type -eq "lib")
|
2014-02-01 09:36:14 +01:00
|
|
|
{
|
2018-05-31 21:21:50 +02:00
|
|
|
Build-Exec $tool $vsProject
|
2018-05-28 12:19:50 +02:00
|
|
|
}
|
|
|
|
ElseIf ($tests -and ($type -eq "test"))
|
2014-02-01 09:21:01 +01:00
|
|
|
{
|
|
|
|
$vsTestProject = "$poco_base\$componentDir\testsuite\TestSuite$($platformName)$($suffix).$($extension)"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Write-Host "| Building $vsTestProject"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
2018-05-31 21:21:50 +02:00
|
|
|
Build-Exec $tool $vsTestProject
|
2014-02-01 09:21:01 +01:00
|
|
|
|
2018-05-31 21:21:50 +02:00
|
|
|
if ($component -eq "Foundation") # special case for Foundation, which needs test app and dll
|
|
|
|
{
|
|
|
|
$vsTestProject = "$poco_base\$componentDir\testsuite\TestApp$($platformName)$($suffix).$($extension)"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Write-Host "| Building $vsTestProject"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Build-Exec $tool $vsTestProject
|
|
|
|
|
|
|
|
$vsTestProject = "$poco_base\$componentDir\testsuite\TestLibrary$($platformName)$($suffix).$($extension)"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Write-Host "| Building $vsTestProject"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Build-Exec $tool $vsTestProject -skipStatic
|
|
|
|
}
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
2018-05-28 12:19:50 +02:00
|
|
|
ElseIf ($samples -and ($type -eq "sample"))
|
2014-02-01 09:21:01 +01:00
|
|
|
{
|
2018-05-31 17:53:43 +02:00
|
|
|
if ($platform -eq 'x64')
|
|
|
|
{
|
|
|
|
Get-Childitem "$poco_base\$($componentDir)" -Recurse |`
|
|
|
|
Where {$_.Extension -Match $extension -And $_.DirectoryName -Like "*samples*" -And $_.BaseName -Like "*$platformName$($suffix)" } `
|
|
|
|
| Build-samples "$_"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Get-Childitem "$poco_base\$($componentDir)" -Recurse |`
|
|
|
|
Where {$_.Extension -Match $extension -And $_.DirectoryName -Like "*samples*" -And $_.BaseName -Like "*$($suffix)" -And $_.BaseName -NotLike "*_x64_*" } `
|
|
|
|
| Build-samples "$_"
|
|
|
|
}
|
2014-02-01 09:21:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Write-Host "-------------------------------"
|
|
|
|
Write-Host "# Skipping $componentDir"
|
|
|
|
Write-Host "-------------------------------"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-28 12:19:50 +02:00
|
|
|
function Build
|
|
|
|
{
|
|
|
|
Process-Input
|
|
|
|
|
|
|
|
if ($vs_version -lt 100) { $extension = 'vcproj' }
|
|
|
|
else { $extension = 'vcxproj' }
|
|
|
|
|
|
|
|
$platformName = ''
|
|
|
|
if ($platform -eq 'x64') { $platformName = '_x64' }
|
|
|
|
elseif ($platform -eq 'WinCE') { $platformName = '_CE' }
|
|
|
|
|
|
|
|
Build-Components $extension $platformName "lib"
|
|
|
|
Build-Components $extension $platformName "test"
|
|
|
|
Build-Components $extension $platformName "sample"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-01 09:21:01 +01:00
|
|
|
Build
|