From: Hiroshi Inoue Date: Fri, 19 Oct 2018 01:15:58 +0000 (+0900) Subject: Make it possible to separate object trees x86_ANSI_Release, x86_Unicode_Release,... X-Git-Tag: REL-11_00_0000~14 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=827667d513b6bdd745e55918030d437d94c92724;p=psqlodbc.git Make it possible to separate object trees x86_ANSI_Release, x86_Unicode_Release, x64_ANSI_Release, x64_Unicode_Release, winbuild/test_x86, winbuild/test_x64, installer/x86, installer/x64, installer/psqlodbc-setup/obj and installer/psqlodbc-setup/bin from source tree on Windows. --- diff --git a/installer/buildInstallers.ps1 b/installer/buildInstallers.ps1 index ea60ea6..528f701 100644 --- a/installer/buildInstallers.ps1 +++ b/installer/buildInstallers.ps1 @@ -72,7 +72,7 @@ function runtimeversion_to_toolset_no([int]$runtime_version) { [int]$toolset_no = $runtime_version * 10 if ($runtime_version -eq 14) { # possibly be v141 - [int]$vc_ver = 15; + [int]$vc_ver = 15 if ((env_vcversion_no) -eq $vc_ver) { # v141 $toolseto++ } elseif (Find-VSDir $vc_ver -ne "") { # v141 @@ -259,32 +259,34 @@ function buildInstaller([string]$CPUTYPE) pushd "$scriptPath" Write-Host ".`nBuilding psqlODBC/$SUBLOC merge module..." - candle -nologo $libpqRelArgs "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dLIBPQBINDIR=$LIBPQBINDIR" "-dLIBPQMSVCDLL=$LIBPQMSVCDLL" "-dLIBPQMSVCSYS=$LIBPQMSVCSYS" "-dPODBCMSVCDLL=$PODBCMSVCDLL" "-dPODBCMSVPDLL=$PODBCMSVPDLL" "-dPODBCMSVCSYS=$PODBCMSVCSYS" "-dPODBCMSVPSYS=$PODBCMSVPSYS" "-dNoPDB=$NoPDB" -o $CPUTYPE\psqlodbcm.wixobj psqlodbcm_cpu.wxs + $BINBASE = GetObjbase ".." + $INSTBASE = GetObjbase ".\$CPUTYPE" "installer\$CPUTYPE" + candle -nologo $libpqRelArgs "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dLIBPQBINDIR=$LIBPQBINDIR" "-dLIBPQMSVCDLL=$LIBPQMSVCDLL" "-dLIBPQMSVCSYS=$LIBPQMSVCSYS" "-dPODBCMSVCDLL=$PODBCMSVCDLL" "-dPODBCMSVPDLL=$PODBCMSVPDLL" "-dPODBCMSVCSYS=$PODBCMSVCSYS" "-dPODBCMSVPSYS=$PODBCMSVPSYS" "-dNoPDB=$NoPDB" "-dBINBASE=$BINBASE" -o $INSTBASE\psqlodbcm.wixobj psqlodbcm_cpu.wxs if ($LASTEXITCODE -ne 0) { throw "Failed to build merge module" } Write-Host ".`nLinking psqlODBC merge module..." - light -nologo -o $CPUTYPE\psqlodbc_$CPUTYPE.msm $CPUTYPE\psqlodbcm.wixobj + light -nologo -o $INSTBASE\psqlodbc_$CPUTYPE.msm $INSTBASE\psqlodbcm.wixobj if ($LASTEXITCODE -ne 0) { throw "Failed to link merge module" } Write-Host ".`nBuilding psqlODBC installer database..." - candle -nologo "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dPRODUCTCODE=$PRODUCTCODE" -o $CPUTYPE\psqlodbc.wixobj psqlodbc_cpu.wxs + candle -nologo "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dPRODUCTCODE=$PRODUCTCODE" "-dINSTBASE=$INSTBASE" -o $INSTBASE\psqlodbc.wixobj psqlodbc_cpu.wxs if ($LASTEXITCODE -ne 0) { throw "Failed to build installer database" } Write-Host ".`nLinking psqlODBC installer database..." - light -nologo -ext WixUIExtension -cultures:en-us -o $CPUTYPE\psqlodbc_$CPUTYPE.msi $CPUTYPE\psqlodbc.wixobj + light -nologo -ext WixUIExtension -cultures:en-us -o $INSTBASE\psqlodbc_$CPUTYPE.msi $INSTBASE\psqlodbc.wixobj if ($LASTEXITCODE -ne 0) { throw "Failed to link installer database" } Write-Host ".`nModifying psqlODBC installer database..." - cscript modify_msi.vbs $CPUTYPE\psqlodbc_$CPUTYPE.msi + cscript modify_msi.vbs $INSTBASE\psqlodbc_$CPUTYPE.msi if ($LASTEXITCODE -ne 0) { throw "Failed to modify installer database" } @@ -303,6 +305,7 @@ function buildInstaller([string]$CPUTYPE) $scriptPath = (Split-Path $MyInvocation.MyCommand.Path) $modulePath="${scriptPath}\..\winbuild" Import-Module ${modulePath}\Psqlodbc-config.psm1 + $defaultConfigDir=$modulePath $configInfo = LoadConfiguration $BuildConfigPath $defaultConfigDir @@ -340,6 +343,7 @@ try { buildInstaller "x86" buildInstaller "x64" Write-Host "wRedist=$wRedist" + Remove-Module Psqlodbc-config try { pushd "$scriptPath" psqlodbc-setup\buildBootstrapper.ps1 -version $VERSION -withRedist:$wRedist @@ -354,6 +358,7 @@ try { } else { buildInstaller $cpu + Remove-Module Psqlodbc-config } } catch [Exception] { if ("$_.Exception.Message" -ne "") { @@ -364,5 +369,7 @@ try { return } finally { Remove-Module MSProgram-Get - Remove-Module Psqlodbc-config + if (Get-Module Psqlodbc-config) { + Remove-Module Psqlodbc-config + } } diff --git a/installer/psqlodbc-setup/Bundle.wxs b/installer/psqlodbc-setup/Bundle.wxs index 04bf7e9..4396999 100755 --- a/installer/psqlodbc-setup/Bundle.wxs +++ b/installer/psqlodbc-setup/Bundle.wxs @@ -23,9 +23,12 @@ - + + + - diff --git a/installer/psqlodbc-setup/buildBootstrapper.ps1 b/installer/psqlodbc-setup/buildBootstrapper.ps1 index 710d25d..3771faa 100644 --- a/installer/psqlodbc-setup/buildBootstrapper.ps1 +++ b/installer/psqlodbc-setup/buildBootstrapper.ps1 @@ -35,17 +35,21 @@ Param( write-host "Building bootstrapper program`n" $scriptPath = (Split-Path $MyInvocation.MyCommand.Path) +$modulePath="${scriptPath}\..\..\winbuild" +Import-Module ${modulePath}\Psqlodbc-config.psm1 if ("$version" -eq "") { # $configInfo = & "$scriptPath\..\..\winbuild\configuration.ps1" "$BuildConfigPath" - $scriptPath = (Split-Path $MyInvocation.MyCommand.Path) - $modulePath="${scriptPath}\..\..\winbuild" - Import-Module ${modulePath}\Psqlodbc-config.psm1 $defaultConfigDir=$modulePath $configInfo = LoadConfiguration $BuildConfigPath $defaultConfigDir $version = GetPackageVersion $configInfo "$scriptPath/../.." - Remove-Module Psqlodbc-config } +$STUPBASE = GetObjbase "." "installer\psqlodbc-setup" +$INSTBASE = GetObjbase ".." "installer" +write-host INSTBASE=$INSTBASE + +Remove-Module Psqlodbc-config + if ("$env:WIX" -eq "") { throw "Please install WIX" } @@ -53,8 +57,9 @@ if ("$env:WIX" -eq "") { $wix_dir="${env:WIX}bin" $pgmname="psqlodbc-setup" $build_config="Release" -$objdir="obj\${build_config}" -$bindir="bin\${build_config}" + +$objdir="$STUPBASE\obj\${build_config}" +$bindir="$STUPBASE\bin\${build_config}" $modules=@("Bundle.wxs") $wRedist="no" @@ -73,7 +78,7 @@ if ($UI) { try { pushd "$scriptPath" - & ${wix_dir}\candle.exe -v "-dVERSION=$version" "-dwithRedist=$wRedist" "-dwithUI=$wUI" "-dConfiguration=${build_config}" "-dOutDir=${bindir}\" -dPlatform=x86 "-dProjectDir=.\" "-dProjectExt=.wixproj" "-dProjectFileName=${pgmname}.wixproj" "-dProjectName=${pgmname}" "-dProjectPath=${pgmname}.wixproj" "-dTargetDir=${bindir}\" "-dTargetExt=.exe" "-dTargetFileName=${pgmname}.exe" "-dTargetName=${pgmname}" "-dTargetPath=${bindir}\${pgmname}.exe" -out "${objdir}\" -arch x86 -ext ${wix_dir}\WixUtilExtension.dll -ext ${wix_dir}\WixBalExtension.dll $modules + & ${wix_dir}\candle.exe -v "-dVERSION=$version" "-dwithRedist=$wRedist" "-dINSTBASE=$INSTBASE" "-dwithUI=$wUI" "-dConfiguration=${build_config}" "-dOutDir=${bindir}\" -dPlatform=x86 "-dProjectDir=.\" "-dProjectExt=.wixproj" "-dProjectFileName=${pgmname}.wixproj" "-dProjectName=${pgmname}" "-dProjectPath=${pgmname}.wixproj" "-dTargetDir=${bindir}\" "-dTargetExt=.exe" "-dTargetFileName=${pgmname}.exe" "-dTargetName=${pgmname}" "-dTargetPath=${bindir}\${pgmname}.exe" -out "${objdir}\" -arch x86 -ext ${wix_dir}\WixUtilExtension.dll -ext ${wix_dir}\WixBalExtension.dll $modules # $candle_cmd = "& `"${wix_dir}\candle.exe`" -v `"-dVERSION=$version`" -dwithRedist=$wRedist -dwithUI=$wUI -dConfiguration=${build_config} `"-dOutDir=${bindir}\`" -dPlatform=x86 `"-dProjectDir=.\`" `"-dProjectExt=.wixproj`" `"-dProjectFileName=${pgmname}.wixproj`" -dProjectName=${pgmname} `"-dProjectPath=${pgmname}.wixproj`" -dTargetDir=${bindir}\ `"-dTargetExt=.exe`" `"-dTargetFileName=${pgmname}.exe`" -dTargetName=${pgmname} `"-dTargetPath=${bindir}\${pgmname}.exe`" -out `"${objdir}\`" -arch x86 -ext `"${wix_dir}\WixUtilExtension.dll`" -ext `"${wix_dir}\WixBalExtension.dll`" $modules" #write-debug "candle_cmd = ${candle_cmd}" # compile diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index f17e061..0486a5f 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -10,6 +10,10 @@ + + + + @@ -32,7 +36,7 @@ - + diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index d8f5d47..96f45f7 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -10,6 +10,10 @@ + + + + @@ -60,21 +64,21 @@ - + - + - + - + - + - + - + - + @@ -172,7 +176,7 @@ - + diff --git a/winbuild/Psqlodbc-config.psm1 b/winbuild/Psqlodbc-config.psm1 index 2d96cba..0819cc7 100755 --- a/winbuild/Psqlodbc-config.psm1 +++ b/winbuild/Psqlodbc-config.psm1 @@ -39,7 +39,11 @@ function LoadConfiguration([string]$configPath, [string]$configDir) Write-Debug "configPath=$configPath" set-variable -name configurationTemplatePath -scope 1 -value "$configDir\configuration_template.xml" if ("$configPath" -eq "") { - $configPath = "$configDir\configuration.xml" + if ("$env:PSQLODBC_WCONFIG" -eq "") { + $configPath = "$configDir\configuration.xml" + } else { + $configPath = $env:PSQLODBC_WCONFIG + } } set-variable -name configurationXmlPath -scope 1 -value $configPath if (!(Test-Path -path $configPath)) @@ -78,7 +82,7 @@ function unifyNodes($node1, $node2) } } if (!$node2.get_HasChildNodes()) { - return; + return } foreach ($child2 in $node2.get_ChildNodes()) { @@ -175,4 +179,17 @@ function GetPackageVersion([xml]$configInfo, [string]$srcpath) return $version_no } -Export-ModuleMember -function LoadConfiguration, SaveConfiguration, unifyNodes, getPGDir, getPackageVersion -variable LIBPQ_VERSION +function GetObjbase([string] $stdDir, [string] $addPath = "") +{ + if ("$env:PSQLODBC_OBJBASE" -eq "") { + return $stdDir + } else { + if ("$addPath" -eq "") { + return $env:PSQLODBC_OBJBASE + } else { + return $env:PSQLODBC_OBJBASE + "\" + $addPath + } + } +} + +Export-ModuleMember -function LoadConfiguration, SaveConfiguration, unifyNodes, getPGDir, getPackageVersion, GetObjbase -variable LIBPQ_VERSION diff --git a/winbuild/pgenlist.vcxproj b/winbuild/pgenlist.vcxproj index b95c209..8561c5b 100755 --- a/winbuild/pgenlist.vcxproj +++ b/winbuild/pgenlist.vcxproj @@ -91,9 +91,11 @@ x64 + - $(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\pgenlist\ - $(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ + $(srcPath) + $(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\pgenlist\ + $(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ @@ -109,7 +111,7 @@ false - + diff --git a/winbuild/pguser.Cpp.props b/winbuild/pguser.Cpp.props index 21992fc..6e2824c 100644 --- a/winbuild/pguser.Cpp.props +++ b/winbuild/pguser.Cpp.props @@ -16,6 +16,7 @@ pguser.Cpp.props to the ExecutablePath property unless $(ExecutablePath) contains them. Added library legacy_stdio_definitions.lib for vc14 or later. + Added ObjbaseDir property. *********************************************************************************************** --> @@ -26,6 +27,9 @@ pguser.Cpp.props $(VSInstallDir)Common7\ide $(VSIdePath);$(VSInstallDir)Common7\Tools;$(ExecutablePath) + + $(PSQLODBC_OBJBASE)\ + legacy_stdio_definitions.lib;%(AdditionalDependencies) diff --git a/winbuild/pgxalib.vcxproj b/winbuild/pgxalib.vcxproj index 4322b9b..e59e571 100755 --- a/winbuild/pgxalib.vcxproj +++ b/winbuild/pgxalib.vcxproj @@ -83,9 +83,11 @@ x64 + - $(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\pgxalib\ - $(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ + $(srcPath) + $(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\pgxalib\ + $(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ @@ -101,7 +103,7 @@ false - + diff --git a/winbuild/psqlodbc.vcxproj b/winbuild/psqlodbc.vcxproj index cf7537f..b1770a3 100755 --- a/winbuild/psqlodbc.vcxproj +++ b/winbuild/psqlodbc.vcxproj @@ -110,9 +110,11 @@ x64 + - $(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ - $(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ + $(srcPath) + $(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ + $(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ @@ -143,7 +145,7 @@ false - + diff --git a/winbuild/psqlsetup.vcxproj b/winbuild/psqlsetup.vcxproj index 95a8a4a..bfdcc2b 100644 --- a/winbuild/psqlsetup.vcxproj +++ b/winbuild/psqlsetup.vcxproj @@ -107,9 +107,11 @@ false + - $(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\psqlsetup\ - $(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ + $(srcPath) + $(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\psqlsetup\ + $(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\ @@ -125,7 +127,7 @@ false - + $(ADD_DEFINES);PG_BIN="$(PG_BIN.Replace('\','\\'))" diff --git a/winbuild/regress.ps1 b/winbuild/regress.ps1 index 49209db..d9d5360 100644 --- a/winbuild/regress.ps1 +++ b/winbuild/regress.ps1 @@ -146,12 +146,15 @@ function vcxfile_make($testnames, $dirnames, $vcxfile) This file is automatically generated by regress.ps1 and used by MSBuild. --> + + . + Release - ..\test\src\ + $(scriptPath)\..\test\src\ - '@ > $vcxfile @@ -162,28 +165,28 @@ function vcxfile_make($testnames, $dirnames, $vcxfile) $testname+="-test" # here-string @" - "@ >> $vcxfile } # here-string @' - - - - - @@ -200,10 +203,8 @@ function RunTest($scriptPath, $Platform, $testexes) } else { $targetdir="test_x86" } - $revsdir="..\" - $origdir="${revsdir}..\test" - - pushd $scriptPath\$targetdir + $revsdir=$scriptPath + $origdir="${revsdir}\..\test" try { $regdiff="regression.diffs" @@ -224,7 +225,7 @@ function RunTest($scriptPath, $Platform, $testexes) $cnstr += "UseDeclareFetch=1" } } if ($cnstr.length -eq 0) { - $cnstr += $null; + $cnstr += $null } for ($i = 0; $i -lt $cnstr.length; $i++) { @@ -238,7 +239,6 @@ function RunTest($scriptPath, $Platform, $testexes) } catch [Exception] { throw $error[0] } finally { - popd $env:COMMON_CONNECTION_STRING_FOR_REGRESSION_TEST = $null } } @@ -294,7 +294,6 @@ $scriptPath = (Split-Path $MyInvocation.MyCommand.Path) $usingExe=$true $testsf="$scriptPath\..\test\tests" Write-Debug testsf=$testsf -$vcxfile="$scriptPath\generated_regress.vcxproj" $arrays=testlist_make $testsf if ($null -eq $TestList) { @@ -323,16 +322,22 @@ if ($null -eq $TestList) { return } } -vcxfile_make $TESTNAMES $DIRNAMES $vcxfile Import-Module "$scriptPath\Psqlodbc-config.psm1" $configInfo = LoadConfiguration $BuildConfigPath $scriptPath +$objbase = GetObjbase "$scriptPath\.." +$pushdir = GetObjbase "$scriptPath" + Import-Module ${scriptPath}\MSProgram-Get.psm1 $msbuildexe=Find-MSBuild ([ref]$VCVersion) ([ref]$MSToolsVersion) ([ref]$Toolset) $configInfo write-host "vcversion=$VCVersion toolset=$Toolset" + Remove-Module MSProgram-Get Remove-Module Psqlodbc-config +$vcxfile="$objbase\generated_regress.vcxproj" +vcxfile_make $TESTNAMES $DIRNAMES $vcxfile + if ($Platform -ieq "both") { $pary = @("Win32", "x64") } else { @@ -364,7 +369,7 @@ if ("$SpecificDsn" -ne "") { } foreach ($pl in $pary) { cd $scriptPath - & ${msbuildexe} ${vcxfile} /tv:$MSToolsVersion "/p:Platform=$pl;Configuration=$Configuration;PlatformToolset=${Toolset}" /t:$vcx_target /p:VisualStudioVersion=${VCVersion} /Verbosity:minimal + & ${msbuildexe} ${vcxfile} /tv:$MSToolsVersion "/p:Platform=$pl;Configuration=$Configuration;PlatformToolset=${Toolset}" /t:$vcx_target /p:VisualStudioVersion=${VCVersion} /p:scriptPath=${scriptPath} /Verbosity:minimal if ($LASTEXITCODE -ne 0) { throw "`nCompile error" } @@ -377,15 +382,15 @@ foreach ($pl in $pary) { "Win32" { $targetdir="test_x86" $bit="32-bit" - $dlldir="$scriptPath\..\x86_${ansi_dir_part}_Release" + $dlldir="$objbase\x86_${ansi_dir_part}_Release" } default { $targetdir="test_x64" $bit="64-bit" - $dlldir="$scriptPath\..\x64_${ansi_dir_part}_Release" + $dlldir="$objbase\x64_${ansi_dir_part}_Release" } } - pushd $scriptPath\$targetdir + pushd $pushdir\$targetdir $env:PSQLODBC_TEST_DSN = $testdsn try { diff --git a/winbuild/regress_one.vcxproj b/winbuild/regress_one.vcxproj index 8aade7d..4660f40 100755 --- a/winbuild/regress_one.vcxproj +++ b/winbuild/regress_one.vcxproj @@ -76,13 +76,16 @@ x64 - + + + + .\ $(TestName) - test_$(TARGET_CPU)\obj\ - test_$(TARGET_CPU)\$(SubDir) + $(ObjbaseDir)test_$(TARGET_CPU)\obj\ + $(ObjbaseDir)test_$(TARGET_CPU)\$(SubDir) - + true