From 9d33ffcfb9a29d30e8675457871562ff21d154be Mon Sep 17 00:00:00 2001 From: Kevin Dick Date: Thu, 18 Aug 2022 07:58:58 +0200 Subject: [PATCH] buildwin.ps1 script error building the x64 version of Poco (#3749) buildwin.ps1 failed to build x64 #3740 If build x64 the scripts looks for the _x64.vcproj Files which no longer exists. By removing this the Build is possible. If only the Build Tools for Visual Studio are available the script does not run because those are not recognized by the Select-VSSetupInstance Script. Adding the parameter `-product *` also recognizes the Build Tools. * Removed unused Parameter `platformName` * Added New CI targets for building poco with the buildwin.ps1 script Co-authored-by: Jan Kevin Dick Co-authored-by: Aleksandar Fabijanic --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ buildwin.ps1 | 37 +++++++++++++++++-------------------- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8182d1edf..85c3578ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,6 +158,38 @@ jobs: - run: >- cd cmake-build; ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(Redis)|(MongoDB)" -C Release + + windows-2019-msvc-buildwin-x64: + runs-on: windows-2019 + env: + CPPUNIT_IGNORE: class CppUnit::TestCaller.testFind,class CppUnit::TestCaller.testSendToReceiveFrom,class CppUnit::TestCaller.testPing,class CppUnit::TestCaller.testBigPing,class CppUnit::TestCaller.testMTU,class CppUnit::TestCaller.testProxy,class CppUnit::TestCaller.testProxy + steps: + - uses: actions/checkout@v2 + - run: .\buildwin.ps1 -poco_base . -vs 160 -action build -linkmode all -config release -platform x64 -samples -tests -omit "Crypto,NetSSL_OpenSSL,Data/MySQL,Data/PostgreSQL,JWT" + + windows-2019-msvc-buildwin-win32: + runs-on: windows-2019 + env: + CPPUNIT_IGNORE: class CppUnit::TestCaller.testFind,class CppUnit::TestCaller.testSendToReceiveFrom,class CppUnit::TestCaller.testPing,class CppUnit::TestCaller.testBigPing,class CppUnit::TestCaller.testMTU,class CppUnit::TestCaller.testProxy,class CppUnit::TestCaller.testProxy + steps: + - uses: actions/checkout@v2 + - run: .\buildwin.ps1 -poco_base . -vs 160 -action build -linkmode all -config release -platform Win32 -samples -tests -omit "Crypto,NetSSL_OpenSSL,Data/MySQL,Data/PostgreSQL,JWT" + + windows-2022-msvc-buildwin-x64: + runs-on: windows-2022 + env: + CPPUNIT_IGNORE: class CppUnit::TestCaller.testFind,class CppUnit::TestCaller.testSendToReceiveFrom,class CppUnit::TestCaller.testPing,class CppUnit::TestCaller.testBigPing,class CppUnit::TestCaller.testMTU,class CppUnit::TestCaller.testProxy,class CppUnit::TestCaller.testProxy + steps: + - uses: actions/checkout@v2 + - run: .\buildwin.ps1 -poco_base . -vs 170 -action build -linkmode all -config release -platform x64 -samples -tests -omit "Crypto,NetSSL_OpenSSL,Data/MySQL,Data/PostgreSQL,JWT" + +# windows-2022-msvc-buildwin-win32: +# runs-on: windows-2022 +# env: +# CPPUNIT_IGNORE: class CppUnit::TestCaller.testFind,class CppUnit::TestCaller.testSendToReceiveFrom,class CppUnit::TestCaller.testPing,class CppUnit::TestCaller.testBigPing,class CppUnit::TestCaller.testMTU,class CppUnit::TestCaller.testProxy,class CppUnit::TestCaller.testProxy +# steps: +# - uses: actions/checkout@v2 +# - run: .\buildwin.ps1 -poco_base . -vs 170 -action build -linkmode all -config release -platform Win32 -samples -tests -omit "Crypto,NetSSL_OpenSSL,Data/MySQL,Data/PostgreSQL,JWT" windows-2022-msvc-cmake-2022: runs-on: windows-2022 diff --git a/buildwin.ps1 b/buildwin.ps1 index c57150b77..2942daf15 100644 --- a/buildwin.ps1 +++ b/buildwin.ps1 @@ -11,7 +11,7 @@ # [-platform Win32 | x64 | WinCE | WEC2013] # [-samples] # [-tests] -# [-omit "Lib1X;LibY;LibZ;..."] +# [-omit "Lib1X,LibY,LibZ,..."] # [-tool msbuild | devenv] # [-useenv env | noenv] # [-verbosity m[inimal] | q[uiet] | n[ormal] | d[etailed] | diag[nostic]] @@ -94,7 +94,7 @@ function Add-VSCOMNTOOLS([int] $vsver) $range='[17.0,18.0)' } - $installationPath = Get-VSSetupInstance | Select-VSSetupInstance -Version $range -Latest -Require Microsoft.VisualStudio.Component.VC.Tools.x86.x64 | select InstallationPath + $installationPath = Get-VSSetupInstance | Select-VSSetupInstance -Version $range -product * -Latest -Require Microsoft.VisualStudio.Component.VC.Tools.x86.x64 | select InstallationPath $vscomntools = $installationPath.psobject.properties.Value; if ($vsver -eq 150) { @@ -216,7 +216,7 @@ function Process-Input Write-Host ' [-platform Win32 | x64 | WinCE | WEC2013]' Write-Host ' [-samples]' Write-Host ' [-tests]' - Write-Host ' [-omit "Lib1X;LibY;LibZ;..."]' + Write-Host ' [-omit "Lib1X,LibY,LibZ,..."]' Write-Host ' [-tool msbuild | devenv]' Write-Host ' [-useenv env | noenv]' Write-Host ' [-verbosity minimal | quiet | normal | detailed | diagnostic' @@ -408,9 +408,8 @@ function Build-Exec([string] $tool, [string] $vsProject, [switch] $skipStatic) } -function Build-Components([string] $extension, [string] $platformName, [string] $type) -{ - +function Build-Components([string] $extension, [string] $type) +{ Get-Content "$poco_base\components" | Foreach-Object { $component = $_ @@ -420,17 +419,17 @@ function Build-Components([string] $extension, [string] $platformName, [string] $suffix = "_vs$vs" $omitArray = @() - $omit.Split(',;') | ForEach { + $omit.Split(',') | ForEach { $omitArray += $_.Trim() } - + if ($omitArray -NotContains $component) { - $vsProject = "$poco_base\$componentDir\$componentName$($platformName)$($suffix).$($extension)" + $vsProject = "$poco_base\$componentDir\$componentName$($suffix).$($extension)" if (!(Test-Path -Path $vsProject)) # when VS project name is not same as directory name { - $vsProject = "$poco_base\$componentDir$($platformName)$($suffix).$($extension)" + $vsProject = "$poco_base\$componentDir$($suffix).$($extension)" if (!(Test-Path -Path $vsProject)) # not found { Write-Host "+------------------------------------------------------------------" @@ -450,7 +449,7 @@ function Build-Components([string] $extension, [string] $platformName, [string] } ElseIf ($tests -and ($type -eq "test")) { - $vsTestProject = "$poco_base\$componentDir\testsuite\TestSuite$($platformName)$($suffix).$($extension)" + $vsTestProject = "$poco_base\$componentDir\testsuite\TestSuite$($suffix).$($extension)" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" Write-Host "| Building $vsTestProject" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" @@ -458,13 +457,13 @@ function Build-Components([string] $extension, [string] $platformName, [string] if ($component -eq "Foundation") # special case for Foundation, which needs test app and dll { - $vsTestProject = "$poco_base\$componentDir\testsuite\TestApp$($platformName)$($suffix).$($extension)" + $vsTestProject = "$poco_base\$componentDir\testsuite\TestApp$($suffix).$($extension)" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" Write-Host "| Building $vsTestProject" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" Build-Exec $tool $vsTestProject - $vsTestProject = "$poco_base\$componentDir\testsuite\TestLibrary$($platformName)$($suffix).$($extension)" + $vsTestProject = "$poco_base\$componentDir\testsuite\TestLibrary$($suffix).$($extension)" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" Write-Host "| Building $vsTestProject" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" @@ -476,7 +475,7 @@ function Build-Components([string] $extension, [string] $platformName, [string] if ($platform -eq 'x64') { Get-Childitem "$poco_base\$($componentDir)" -Recurse |` - Where {$_.Extension -Match $extension -And $_.DirectoryName -Like "*samples*" -And $_.BaseName -Like "*$platformName$($suffix)" } ` + Where {$_.Extension -Match $extension -And $_.DirectoryName -Like "*samples*" -And $_.BaseName -Like "*$($suffix)" } ` | Build-samples "$_" } else @@ -504,13 +503,11 @@ function Build if ($vs -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" + Build-Components $extension "lib" + Build-Components $extension "test" + Build-Components $extension "sample" }