fix(build): fix build with openssl 3.1.0 on vs2022 (#3969)

* fix log verbosity in windows powershell build script

* stop paths being added multiple times to environment variables

* pass useenv property to msbuild

* linking issue: include crypto.h prior to config.h so POCO_EXTERNAL_OPENSSL is initialised

* resolve poco_base path in powershell script

* build against any available windows sdk
This commit is contained in:
chrisbednarski 2023-03-18 09:45:56 +11:00 committed by GitHub
parent f6c3017b3e
commit e0e628ac7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View File

@ -20,8 +20,8 @@
#define NetSSL_NetSSL_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Crypto/Crypto.h"
#include "Poco/Net/Net.h"
//

View File

@ -135,12 +135,12 @@ if not defined VCINSTALLDIR (
) else (
if %VS_VERSION%==vs170 (
if %PLATFORM%==x64 (
call "%VS170COMNTOOLS%%VS_VARSALL%" x86_amd64 8.1
call "%VS170COMNTOOLS%%VS_VARSALL%" x86_amd64
) else (
if %PLATFORM%==arm64 (
call "%VS170COMNTOOLS%%VS_VARSALL%" x86_arm64
) else (
call "%VS170COMNTOOLS%%VS_VARSALL%" x86 8.1
call "%VS170COMNTOOLS%%VS_VARSALL%" x86
)
)
)

View File

@ -14,7 +14,7 @@
# [-omit "Lib1X,LibY,LibZ,..."]
# [-tool msbuild | devenv]
# [-useenv env | noenv]
# [-verbosity m[inimal] | q[uiet] | n[ormal] | d[etailed] | diag[nostic]]
# [-verbosity minimal | quiet | normal | detailed | diagnostic]
# [-openssl_base dir]
# [-mysql_base dir]
@ -57,7 +57,7 @@ Param
[string] $useenv = 'env',
[Parameter()]
[ValidateSet('quiet', 'm[inimal]', 'n[ormal]', 'd[etailed]', 'diag[nostic]')]
[ValidateSet('quiet', 'minimal', 'normal', 'detailed', 'diagnostic')]
[string] $verbosity = 'minimal',
[Parameter()]
@ -116,12 +116,13 @@ function Add-VSCOMNTOOLS([int] $vsver)
function Add-Env-Var([string] $lib, [string] $var)
{
if ((${Env:$var} -eq $null) -or (-not ${Env:$var}.Contains(${Env:$lib_$var"})))
$envvar = if (Test-Path "Env:$var") { Get-Content "Env:$var" } Else { "" }
$libvar = Get-Content "Env:${lib}_$var"
if (-not $envvar.Contains($libvar))
{
$libvar = "$lib" + "_" + "$var"
$envvar = [Environment]::GetEnvironmentVariable($var, "Process")
$envvar = $envvar + ';' + [Environment]::GetEnvironmentVariable($libvar, "Process")
[Environment]::SetEnvironmentVariable($var, $envvar, "Process")
$envvar = $envvar + ";$libvar"
Set-Content "Env:${var}" $envvar
}
}
@ -141,7 +142,7 @@ function Set-Environment
if ($openssl_base -eq '')
{
$script:openssl_base = '$poco_base\openssl'
$script:openssl_base = "$poco_base\openssl"
}
$Env:OPENSSL_DIR = "$openssl_base"
@ -270,7 +271,7 @@ function Exec-MSBuild([string] $vsProject, [string] $projectConfig)
return
}
$cmd = "&`"$script:msbuild_exe`" $vsProject /nologo /m /t:$action /p:Configuration=$projectConfig /p:BuildProjectReferences=false /p:Platform=$platform /p:useenv=$useenv /v:$verbosity"
$cmd = "&`"$script:msbuild_exe`" $vsProject /nologo /m /t:$action /p:Configuration=$projectConfig /p:BuildProjectReferences=false /p:Platform=$platform /p:useenv=$($useenv -eq 'env') /v:$verbosity"
Write-Host $cmd
Invoke-Expression $cmd
if ($LastExitCode -ne 0) { Exit $LastExitCode }