Make it possible to separate object trees x86_ANSI_Release, x86_Unicode_Release,...
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Fri, 19 Oct 2018 01:15:58 +0000 (10:15 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Fri, 19 Oct 2018 01:15:58 +0000 (10:15 +0900)
13 files changed:
installer/buildInstallers.ps1
installer/psqlodbc-setup/Bundle.wxs
installer/psqlodbc-setup/buildBootstrapper.ps1
installer/psqlodbc_cpu.wxs
installer/psqlodbcm_cpu.wxs
winbuild/Psqlodbc-config.psm1
winbuild/pgenlist.vcxproj
winbuild/pguser.Cpp.props
winbuild/pgxalib.vcxproj
winbuild/psqlodbc.vcxproj
winbuild/psqlsetup.vcxproj
winbuild/regress.ps1
winbuild/regress_one.vcxproj

index ea60ea6b2e716ec66f221a575827175abce5558a..528f7012bde604457b21b3bc95980a371b253c06 100644 (file)
@@ -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
+   }
 }
index 04bf7e9b9a7571018ce0022c727293bc873607a3..43969997c3e20e87b4026042a70a733a6ae0baf5 100755 (executable)
 <?if $(var.withRedist) = yes ?>\r
        <PackageGroupRef Id="vcredist"/>\r
 <?endif ?>\r
-       <MsiPackage SourceFile="..\x86\psqlodbc_x86.msi"\r
+<?ifndef var.INSTBASE ?>\r
+<?define INSTBASE = ".."?>\r
+<?endif ?>\r
+       <MsiPackage SourceFile="$(var.INSTBASE)\x86\psqlodbc_x86.msi"\r
            DisplayInternalUI="$(var.withUI)" />\r
-       <MsiPackage SourceFile="..\x64\psqlodbc_x64.msi"\r
+       <MsiPackage SourceFile="$(var.INSTBASE)\x64\psqlodbc_x64.msi"\r
            DisplayInternalUI="$(var.withUI)"\r
            InstallCondition="VersionNT64" />\r
        </Chain>\r
index 710d25dfddb28bfe68c8c4a6a775a2de8a0e8cc7..3771faaaa7bd4fec30e50c149edbe7813e87e4ef 100644 (file)
@@ -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
index f17e061f530821b6cd9860d68ec118b333147745..0486a5f9f1687367482b30e311bb0c14b6690ac1 100644 (file)
   <?endif?>
 <?endif?>
 
+<?ifndef var.INSTBASE ?>
+  <?define INSTBASE = $(var.Platform) ?>
+<?endif?>
+
 <?if $(var.Platform) = x64 ?>
   <?define PKGNAME = "psqlODBC_x64" ?>
   <?define BIT64 = "yes" ?>
@@ -32,7 +36,7 @@
   <?define ALLUSERS = "1" ?>
 <?endif?>
 
-<?define MERGEM = "$(var.Platform)\psqlodbc_$(var.Platform).msm" ?>
+<?define MERGEM = "$(var.INSTBASE)\psqlodbc_$(var.Platform).msm" ?>
 
 <!-- Product details -->
 
index d8f5d47d26c6c886dc8c30567b7eb8f310a91239..96f45f7dfafac25a170359fd29f01f7dcc4e39bb 100644 (file)
   <?endif?>
 <?endif?>
 
+<?ifndef var.BINBASE ?>
+  <?define BINBASE = ".." ?>
+<?endif?>
+
 <?if $(var.Platform) = x64 ?>
   <?define ModuleName = "psqlODBC_$(var.Platform)" ?>
   <?define BIT64 = "yes" ?>
         <Component Id="psqlodbc.files" Guid="$(var.CIDPFILES)" Win64="$(var.BIT64)">
 
           <!-- PostgreSQL -->
-          <File Id="psqlodbc30a.dll" Name="psqlodbc30a.dll" Source="../$(var.ANSIFOLDER)/psqlodbc30a.dll" />
+          <File Id="psqlodbc30a.dll" Name="psqlodbc30a.dll" Source="$(var.BINBASE)/$(var.ANSIFOLDER)/psqlodbc30a.dll" />
 <?if $(var.NoPDB) != True ?>
-          <File Id="psqlodbc30a.pdb" Name="psqlodbc30a.pdb" Source="../$(var.ANSIFOLDER)/psqlodbc30a.pdb" />
+          <File Id="psqlodbc30a.pdb" Name="psqlodbc30a.pdb" Source="$(var.BINBASE)/$(var.ANSIFOLDER)/psqlodbc30a.pdb" />
 <?endif?>
-          <File Id="psqlodbc35w.dll" Name="psqlodbc35w.dll" Source="../$(var.UNICODEFOLDER)/psqlodbc35w.dll" />
+          <File Id="psqlodbc35w.dll" Name="psqlodbc35w.dll" Source="$(var.BINBASE)/$(var.UNICODEFOLDER)/psqlodbc35w.dll" />
 <?if $(var.NoPDB) != True ?>
-          <File Id="psqlodbc35w.pdb" Name="psqlodbc35w.pdb" Source="../$(var.UNICODEFOLDER)/psqlodbc35w.pdb" />
+          <File Id="psqlodbc35w.pdb" Name="psqlodbc35w.pdb" Source="$(var.BINBASE)/$(var.UNICODEFOLDER)/psqlodbc35w.pdb" />
 <?endif?>
-          <File Id="pgenlist.dll" Name="pgenlist.dll" Source="../$(var.UNICODEFOLDER)/pgenlist.dll" />
+          <File Id="pgenlist.dll" Name="pgenlist.dll" Source="$(var.BINBASE)/$(var.UNICODEFOLDER)/pgenlist.dll" />
 <?if $(var.NoPDB) != True ?>
-          <File Id="pgenlist.pdb" Name="pgenlist.pdb" Source="../$(var.UNICODEFOLDER)/pgenlist.pdb" />
+          <File Id="pgenlist.pdb" Name="pgenlist.pdb" Source="$(var.BINBASE)/$(var.UNICODEFOLDER)/pgenlist.pdb" />
 <?endif?>
-          <File Id="pgenlista.dll" Name="pgenlista.dll" Source="../$(var.ANSIFOLDER)/pgenlista.dll" />
+          <File Id="pgenlista.dll" Name="pgenlista.dll" Source="$(var.BINBASE)/$(var.ANSIFOLDER)/pgenlista.dll" />
 <?if $(var.NoPDB) != True ?>
-          <File Id="pgenlista.pdb" Name="pgenlista.pdb" Source="../$(var.ANSIFOLDER)/pgenlista.pdb" />
+          <File Id="pgenlista.pdb" Name="pgenlista.pdb" Source="$(var.BINBASE)/$(var.ANSIFOLDER)/pgenlista.pdb" />
 <?endif?>
    <!-- MSVC Runtime -->
 <?if "$(var.PODBCMSVCDLL)" != "" ?>
        <![CDATA[NOT VersionNT64]]>
      </Condition>
 <?endif?>
-          <File Id="pgxalib.dll" Name="pgxalib.dll" Source="../$(var.UNICODEFOLDER)/pgxalib.dll" />
+          <File Id="pgxalib.dll" Name="pgxalib.dll" Source="$(var.BINBASE)/$(var.UNICODEFOLDER)/pgxalib.dll" />
           <RegistryValue Id="pgxalib.reg.1" Root="HKLM" Key="SOFTWARE\Microsoft\MSDTC\XADLL" Name="pgxalib.dll" Type="string" Value="[#pgxalib.dll]" />
    </Component>
       </Directory>
index 2d96cba23572ca4bd76e2ba508f92185755307c6..0819cc7d7f73e2451bfb794cc6342957f7a5a1ec 100755 (executable)
@@ -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
index b95c2090ab88c4e76214f73ba762a4650b394a0c..8561c5b42bdc41d3d430f4e35db7b50447a86519 100755 (executable)
     <TARGET_CPU>x64</TARGET_CPU>\r
   </PropertyGroup>\r
 \r
+  <Import Project="psqlodbc.Cpp.props" />\r
   <PropertyGroup>\r
-    <IntDir>$(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\pgenlist\</IntDir>\r
-    <OutDir>$(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</OutDir>\r
+     <ObjbaseDir Condition="'$(ObjbaseDir)'==''">$(srcPath)</ObjbaseDir>\r
+     <IntDir>$(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\pgenlist\</IntDir>\r
+     <OutDir>$(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</OutDir>\r
   </PropertyGroup>\r
 \r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <LinkIncremental>false</LinkIncremental>\r
   </PropertyGroup>\r
 \r
-  <Import Project="psqlodbc.Cpp.props" />\r
+  <!-- Import Project="psqlodbc.Cpp.props" / -->\r
 \r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <ClCompile>\r
index 21992fcd0a16c0bf94ae1dd760aef22abc27e8d9..6e2824ce2532463afc5de5adb2f17037c50d7fc9 100644 (file)
@@ -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
     <VSIdePath>$(VSInstallDir)Common7\ide</VSIdePath>
     <ExecutablePath Condition="!$(ExecutablePath.ToLower().Contains($(VSIdePath.ToLower())))">$(VSIdePath);$(VSInstallDir)Common7\Tools;$(ExecutablePath)</ExecutablePath>
   </PropertyGroup>
+  <PropertyGroup>
+    <ObjbaseDir Condition="'$(PSQLODBC_OBJBASE)'!=''">$(PSQLODBC_OBJBASE)\</ObjbaseDir>
+  </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(PlatformToolset.Substring(1,1))'=='1'AND($(PlatformToolset.Substring(2,1).CompareTo('3'))>0)">
     <Link>
       <AdditionalDependencies>legacy_stdio_definitions.lib;%(AdditionalDependencies)</AdditionalDependencies>
index 4322b9b98b46cb1bb4e61e50dffe47c455440c60..e59e5714a64769bf681b61721b024a0c4f887c0a 100755 (executable)
     <TARGET_CPU>x64</TARGET_CPU>
   </PropertyGroup>
 
+  <Import Project="psqlodbc.Cpp.props" />
   <PropertyGroup>
-    <IntDir>$(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\pgxalib\</IntDir>
-    <OutDir>$(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</OutDir>
+    <ObjbaseDir Condition="'$(ObjbaseDir)'==''">$(srcPath)</ObjbaseDir>
+    <IntDir>$(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\pgxalib\</IntDir>
+    <OutDir>$(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</OutDir>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
 
-  <Import Project="psqlodbc.Cpp.props" />
+  <!-- Import Project="psqlodbc.Cpp.props" / -->
 
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
index cf7537f22a911bc6c2f09835999c19e12914f18a..b1770a3da9f7881eac8d0dd73dc323c9c73fe1a2 100755 (executable)
     <TARGET_CPU>x64</TARGET_CPU>\r
   </PropertyGroup>\r
 \r
+  <Import Project="psqlodbc.Cpp.props" />\r
   <PropertyGroup>\r
-    <IntDir>$(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</IntDir>\r
-    <OutDir>$(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</OutDir>\r
+    <ObjbaseDir Condition="'$(ObjbaseDir)'==''">$(srcPath)</ObjbaseDir>\r
+    <IntDir>$(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</IntDir>\r
+    <OutDir>$(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</OutDir>\r
   </PropertyGroup>\r
 \r
   <!-- Import Project="std_dbmsname.Cpp.props" /-->\r
     <LinkIncremental>false</LinkIncremental>\r
   </PropertyGroup>\r
 \r
-  <Import Project="psqlodbc.Cpp.props" />\r
+  <!-- Import Project="psqlodbc.Cpp.props" / -->\r
 \r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <ClCompile>\r
index 95a8a4a2df39b693e359c03d86789c46263d1395..bfdcc2b4704e1a8662c4c1bc7c5bc1fabd216959 100644 (file)
     <GenerateImportLib>false</GenerateImportLib>\r
   </PropertyGroup>\r
 \r
+  <Import Project="psqlodbc.Cpp.props" />\r
   <PropertyGroup>\r
-    <IntDir>$(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\psqlsetup\</IntDir>\r
-    <OutDir>$(srcPath)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</OutDir>\r
+    <ObjbaseDir Condition="'$(ObjbaseDir)'==''">$(srcPath)</ObjbaseDir>\r
+    <IntDir>$(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\psqlsetup\</IntDir>\r
+    <OutDir>$(ObjbaseDir)$(TARGET_CPU)_$(TargetType)_$(Configuration)\</OutDir>\r
   </PropertyGroup>\r
 \r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <LinkIncremental>false</LinkIncremental>\r
   </PropertyGroup>\r
 \r
-  <Import Project="psqlodbc.Cpp.props" />\r
+  <!-- Import Project="psqlodbc.Cpp.props" / -->\r
 \r
   <PropertyGroup Condition="'$(PG_BIN)'!=''">\r
     <ADD_DEFINES>$(ADD_DEFINES);PG_BIN="$(PG_BIN.Replace('\','\\'))"</ADD_DEFINES>\r
index 49209db62ea19118d63844543c6c0742e251bfb5..d9d5360f217620ffe053ef44f2560bff18501238 100644 (file)
@@ -146,12 +146,15 @@ function vcxfile_make($testnames, $dirnames, $vcxfile)
     This file is automatically generated by regress.ps1
     and used by MSBuild.
     -->
+    <PropertyGroup>
+   <scriptPath>.</scriptPath>
+    </PropertyGroup>
     <PropertyGroup>
    <Configuration>Release</Configuration>
-   <srcPath>..\test\src\</srcPath>
+   <srcPath>$(scriptPath)\..\test\src\</srcPath>
     </PropertyGroup>
     <Target Name="Build">
-        <MSBuild Projects="regress_one.vcxproj"
+        <MSBuild Projects="$(scriptPath)\regress_one.vcxproj"
      Targets="ClCompile"
      Properties="TestName=common;Configuration=$(Configuration);srcPath=$(srcPath)"/>
 '@ > $vcxfile
@@ -162,28 +165,28 @@ function vcxfile_make($testnames, $dirnames, $vcxfile)
        $testname+="-test"
 # here-string
        @"
-        <MSBuild Projects="regress_one.vcxproj"
+        <MSBuild Projects="${scriptPath}\regress_one.vcxproj"
      Targets="Build"
      Properties="TestName=$testname;Configuration=`$(Configuration);srcPath=`$(srcPath);SubDir=$dirname"/>
 "@ >> $vcxfile
    }
 # here-string
    @'
-        <MSBuild Projects="regress_one.vcxproj"
+        <MSBuild Projects="$(scriptPath)\regress_one.vcxproj"
      Targets="Build"
      Properties="TestName=runsuite;Configuration=$(Configuration);srcPath=$(srcPath)..\"/>
-        <MSBuild Projects="regress_one.vcxproj"
+        <MSBuild Projects="$(scriptPath)\regress_one.vcxproj"
      Targets="Build"
      Properties="TestName=RegisterRegdsn;Configuration=$(Configuration);srcPath=$(srcPath)..\"/>
-        <!-- MSBuild Projects="regress_one.vcxproj"
+        <!-- MSBuild Projects="$(scriptPath)\regress_one.vcxproj"
      Targets="Build"
      Properties="TestName=ConfigDsn;Configuration=$(Configuration);srcPath=$(srcPath)..\"/-->
-        <MSBuild Projects="regress_one.vcxproj"
+        <MSBuild Projects="$(scriptPath)\regress_one.vcxproj"
      Targets="Build"
      Properties="TestName=reset-db;Configuration=$(Configuration);srcPath=$(srcPath)..\"/>
     </Target>
     <Target Name="Clean">
-        <MSBuild Projects="regress_one.vcxproj"
+        <MSBuild Projects="$(scriptPath)\regress_one.vcxproj"
      Targets="Clean"
      Properties="Configuration=$(Configuration);srcPath=$(srcPath)"/>
     </Target>
@@ -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 {
index 8aade7d05efb3eaff4b67e8026a9bcd2cef8a084..4660f402f025b5b0e2c9249c17251eb558d1282e 100755 (executable)
   <PropertyGroup Condition="'$(Platform)'!='Win32'">\r
     <TARGET_CPU>x64</TARGET_CPU>\r
   </PropertyGroup>\r
-  <PropertyGroup Label="UserMacros">\r
+\r
+  <Import Project="pguser.Cpp.props" />\r
+  <PropertyGroup>\r
+    <ObjbaseDir Condition="'$(ObjbaseDir)'==''">.\</ObjbaseDir>\r
     <TargetName>$(TestName)</TargetName>\r
-    <IntDir>test_$(TARGET_CPU)\obj\</IntDir>\r
-    <OutDir>test_$(TARGET_CPU)\$(SubDir)</OutDir>\r
+    <IntDir>$(ObjbaseDir)test_$(TARGET_CPU)\obj\</IntDir>\r
+    <OutDir>$(ObjbaseDir)test_$(TARGET_CPU)\$(SubDir)</OutDir>\r
   </PropertyGroup>\r
 \r
-  <Import Project="pguser.Cpp.props" />\r
+  <!-- Import Project="pguser.Cpp.props" / -->\r
 \r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <LinkIncremental>true</LinkIncremental>\r