diff options
| author | Ted Ross <tross@apache.org> | 2010-08-30 19:38:31 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2010-08-30 19:38:31 +0000 |
| commit | 5c8fccfe7be795566e4fa1d7616acdcc6c1997a1 (patch) | |
| tree | 098eefff7ef94593a08288bb99481f5ffe0287af /qpid/cpp/bld-winsdk.ps1 | |
| parent | df4c2e62f52fe49cb7473a8ab3107facffb4cda5 (diff) | |
| download | qpid-python-5c8fccfe7be795566e4fa1d7616acdcc6c1997a1.tar.gz | |
QPID-2827 - QPID Cpp WinSDK does not contain 64-bit libraries
Patch from Chuck Rolke
* Adds the x64 platform to the cpp\example solution and six example projects.
* Adds the x64 platform to the qpid messaging .NET binding dlls and examples.
* Adds QPID_BUILD_ROOT environment variable to .NET binding projects for locating C++ libraries and headers, and for storing generated output. This is required to compensate for the varying location of cmake-generated directories. For a given build QPID_BUILD_ROOT must be set to the directory in which cmake was run.
* Reorganize the bld-winsdk.ps1 script to build x86 (Win32) and x64 platforms.
* Update Readme-winsdk.txt content. Also switch this file to DOS line endings to improve its usability on a Windows system.
* Add a shadow solution file and shadow project files for the C# examples. The new build process copies the development example source tree to get the example sources organized into a hierarchy and then overlays the copied tree with the shadow .sln and .csproj files. Users then build the examples directly using the customized solution.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@990917 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bld-winsdk.ps1')
| -rw-r--r-- | qpid/cpp/bld-winsdk.ps1 | 362 |
1 files changed, 241 insertions, 121 deletions
diff --git a/qpid/cpp/bld-winsdk.ps1 b/qpid/cpp/bld-winsdk.ps1 index 0bf7c4c20f..f6790013bb 100644 --- a/qpid/cpp/bld-winsdk.ps1 +++ b/qpid/cpp/bld-winsdk.ps1 @@ -17,19 +17,225 @@ # under the License. # -# This script requires cmake, and 7z to be already on the path devenv should be on the path as -# a result of installing Visual Studio +# This script builds a WinSDK from a raw Qpid source checkout. +# +# On entry: +# 1. Args[0] holds the relative path to Qpid/trunk. +# Directory ".\$args[0]" holds the "cpp" directory and +# file QPID_VERSION.txt. +# 2. Args[1] holds the x86 32-bit BOOST_ROOT. "c:\boost" +# 3. Args[2] holds the x64 64-bit BOOST_ROOT. "c:\boost_x64" +# 4. Args[1] holds the version number. "0.7.946106-99" +# 5. The current directory will receive x86 and x64 subdirs. +# 6. The x86 an x64 dirs are where cmake will run. +# 7. Two Boost installations, 32- and 64-bit, are available. +# 9. No Boost directory must be on the path. +# 9. cmake, 7z, and devenv are already on the path. +# 10. devenv is Visual Studio 2008 +# +# This script creates separate zip kits for 32- and +# for 64-bit variants. +# +Set-PSDebug -Trace 1 Set-PSDebug -strict $ErrorActionPreference='Stop' -if ($args.length -lt 1) { - Write-Host 'Need to specify location of qpid src tree' - exit +# +# Global variables +# +# Define boost +[string] $global:bldwinsdkDirectory = Split-Path -parent $MyInvocation.MyCommand.Definition +[string] $global:sourceDirectory = Split-Path -parent $global:bldwinsdkDirectory +[string] $global:currentDirectory = Split-Path -parent $global:sourceDirectory + + +################################ +# +# BuildAPlatform +# Build a platform, x86 or x64. +# Compiles and packages Debug and RelWithDebInfo configurations. +# +function BuildAPlatform +{ + param + ( + [string] $qpid_cpp_dir, + [string] $platform, + [string] $cmakeGenerator, + [string] $vsTargetDebug, + [string] $vsTargetRelease, + [string] $boostRoot, + [string] $randomness + ) + + [string] $install_dir = "install_$randomness" + [string] $preserve_dir = "preserve_$randomness" + [string] $zipfile = "qpid-cpp-$platform-$ver.zip" + [string] $platform_dir = "$global:currentDirectory/$platform" + [string] $qpid_cpp_src = "$global:currentDirectory/$qpid_cpp_dir" + + # + # Create the platform directory if necessary + # + if (!(Test-Path -path $platform_dir)) + { + New-Item $platform_dir -type Directory | Out-Null + } + + # + # Descend into platform directory + # + Set-Location $platform_dir + + # + # Set environment for this build + # + $env:BOOST_ROOT = "$boostRoot" + $env:QPID_BUILD_ROOT = Get-Location + + # + # Run cmake + # + cmake -G "$cmakeGenerator" "-DCMAKE_INSTALL_PREFIX=$install_dir" $qpid_cpp_src + + # Need to build doxygen api docs separately as nothing depends on them. + # Build for both x86 and x64 or cmake_install fails. + if ("x86" -eq $platform) { + devenv qpid-cpp.sln /build "Release|Win32" /project docs-user-api + } else { + devenv qpid-cpp.sln /build "Release|$platform" /project docs-user-api + } + + # Build both Debug and Release builds so we can ship both sets of libs: + # Make RelWithDebInfo for debuggable release code. + # (Do Release after Debug so that the release executables overwrite the + # debug executables. Don't skip Debug as it creates some needed content.) + devenv qpid-cpp.sln /build "$vsTargetDebug" /project INSTALL + devenv qpid-cpp.sln /build "$vsTargetRelease" /project INSTALL + + # Build the .NET binding + devenv $qpid_cpp_src\bindings\qpid\dotnet\org.apache.qpid.messaging.sln ` + /build "Debug|$platform" /project org.apache.qpid.messaging.sessionreceiver + + # This would be kludgy if we have only one entry as the array declaration syntax + # can't cope with just one nested array + # Target must be a directory + $move=( + ('bin/*.lib','lib'), + ('bin/boost/*.dll','bin') + ) + + $preserve=( + 'include/qpid/agent', + 'include/qpid/amqp_0_10', + 'include/qpid/management', + 'include/qpid/messaging', + 'include/qpid/sys/IntegerTypes.h', + 'include/qpid/sys/windows/IntegerTypes.h', + 'include/qpid/sys/posix/IntegerTypes.h', + 'include/qpid/types', + 'include/qpid/CommonImportExport.h') + $remove=( + 'bin/qpidd.exe', 'bin/qpidbroker*.*', + 'bin/*PDB/qpidd.exe', 'bin/*PDB/qpidbroker*.*', + 'bin/qmfengine*.*', 'bin/qpidxarm*.*', + 'bin/*PDB/qmfengine*.*', 'bin/*PDB/qpidxarm*.*', + 'bin/boost_regex*.*', + 'bin/boost', + 'conf', + 'examples/direct', + 'examples/failover', + 'examples/fanout', + 'examples/pub-sub', + 'examples/qmf-console', + 'examples/request-response', + 'examples/tradedemo', + 'examples/old-examples.sln', + 'examples/README.*', + 'examples/verify*', + 'include', + 'plugins') + + # Move some files around in the install tree + foreach ($pattern in $move) { + $target = Join-Path $install_dir $pattern[1] + New-Item -force -type directory $target + Move-Item -force -path "$install_dir/$($pattern[0])" -destination "$install_dir/$($pattern[1])" + } + + # Copy aside the files to preserve + New-Item -path $preserve_dir -type directory + foreach ($pattern in $preserve) { + $target = Join-Path $preserve_dir $pattern + $tparent = Split-Path -parent $target + New-Item -force -type directory $tparent + Move-Item -force -path "$install_dir/$pattern" -destination "$preserve_dir/$pattern" + } + + # Remove everything to remove + foreach ($pattern in $remove) { + Remove-Item -recurse "$install_dir/$pattern" + } + + # Copy back the preserved things + foreach ($pattern in $preserve) { + $target = Join-Path $install_dir $pattern + $tparent = Split-Path -parent $target + New-Item -force -type directory $tparent + Move-Item -force -path "$preserve_dir/$pattern" -destination "$install_dir/$pattern" + } + Remove-Item -recurse $preserve_dir + + # Install the README + Copy-Item -force -path "$qpid_cpp_src/README-winsdk.txt" -destination "$install_dir/README-winsdk.txt" + + # Install the .NET binding + Copy-Item -force -path "./src/Debug/org.apache.qpid.messaging*.dll" -destination "$install_dir/bin" + Copy-Item -force -path "./src/Debug/org.apache.qpid.messaging*.pdb" -destination "$install_dir/bin/DebugPDB" + + # Install the .NET binding examples + New-Item -path $(Join-Path $(Get-Location) $install_dir) -name dotnet_examples -type directory + New-Item -path $(Join-Path $(Get-Location) $install_dir/dotnet_examples) -name examples -type directory + + $src = Resolve-Path "$qpid_cpp_src/bindings/qpid/dotnet/examples" + $dst = Resolve-Path "$install_dir/dotnet_examples" + Copy-Item "$src\" -destination "$dst\" -recurse -force + + $src = Resolve-Path "$qpid_cpp_src/bindings/qpid/dotnet/winsdk_sources" + $dst = Resolve-Path "$install_dir/dotnet_examples" + Copy-Item "$src\*" -destination "$dst\" -recurse -force + + # Zip the /bin PDB files into two zip files. + # we previously arranged that the Debug pdbs go in the DebugPDB subdirectory + # and the Release pdbs go in the ReleasePDB subdirectory + &'7z' a -mx9 ".\$install_dir\bin\symbols-debug.zip" ".\$install_dir\bin\DebugPDB\*.pdb" + &'7z' a -mx9 ".\$install_dir\bin\symbols-release.zip" ".\$install_dir\bin\ReleasePDB\*.pdb" + + Remove-Item -recurse ".\$install_dir\bin\DebugPDB" + Remove-Item -recurse ".\$install_dir\bin\ReleasePDB" + + # Create a new zip for the whole kit. + # Exclude *.pdb so as not include the debug symbols twice + if (Test-Path $zipfile) {Remove-Item $zipfile} + &'7z' a $zipfile ".\$install_dir\*" -xr!*pdb +} + +################################ +# +# Main() +# +# Process the args +# +if ($args.length -lt 3) { + Write-Host 'Usage: bld-winsdk.ps1 qpid_src_dir boost32_dir boost64_dir [version]' + exit } -$qpid_src=$args[0] -$ver=$args[1] +$qpid_src = $args[0] +$boostRoot32 = $args[1] +$boostRoot64 = $args[2] +$ver = $args[3] if ($ver -eq $null) { $qpid_version_file="$qpid_src\QPID_VERSION.txt" @@ -40,122 +246,36 @@ if ($ver -eq $null) { $ver=Get-Content $qpid_version_file } -$randomness=[System.IO.Path]::GetRandomFileName() - -$qpid_cpp_src="$qpid_src\cpp" -$install_dir="install_$randomness" -$preserve_dir="preserve_$randomness" -$zipfile="qpid-cpp-$ver.zip" - -# This assumes Visual Studio 2008 -cmake -G "Visual Studio 9 2008" "-DCMAKE_INSTALL_PREFIX=$install_dir" $qpid_cpp_src - -# Need to build doxygen api docs separately as nothing depends on them -devenv qpid-cpp.sln /build "Release|Win32" /project docs-user-api - -# Build both Debug and Release builds so we can ship both sets of libs: -# Make RelWithDebInfo for debuggable release code. -# (Do Release after Debug so that the release executables overwrite the -# debug executables. Don't skip Debug as it creates some needed content.) -devenv qpid-cpp.sln /build "Debug|Win32" /project INSTALL -devenv qpid-cpp.sln /build "RelWithDebInfo|Win32" /project INSTALL - -# Build the .NET binding -devenv $qpid_cpp_src\bindings\qpid\dotnet\bld\bld-org.apache.qpid.messaging.sln /build "Debug|x86" /project bld-org.apache.qpid.messaging -devenv $qpid_cpp_src\bindings\qpid\dotnet\bld\bld-org.apache.qpid.messaging.sln /build "Debug|x86" /project bld-org.apache.qpid.messaging.sessionreceiver - -# This would be kludgy if we have only one entry as the array declaration syntax -# can't cope with just one nested array -# Target must be a directory -$move=( - ('bin/*.lib','lib'), - ('bin/boost/*.dll','bin') -) - -$preserve=( - 'include/qpid/agent', - 'include/qpid/amqp_0_10', - 'include/qpid/management', - 'include/qpid/messaging', - 'include/qpid/sys/IntegerTypes.h', - 'include/qpid/sys/windows/IntegerTypes.h', 'include/qpid/sys/posix/IntegerTypes.h', - 'include/qpid/types', - 'include/qpid/CommonImportExport.h') -$remove=( - 'bin/qpidd.exe', 'bin/qpidbroker*.*', - 'bin/*PDB/qpidd.exe', 'bin/*PDB/qpidbroker*.*', - 'bin/qmfengine*.*', 'bin/qpidxarm*.*', - 'bin/*PDB/qmfengine*.*', 'bin/*PDB/qpidxarm*.*', - 'bin/boost_regex*.*', - 'bin/boost', - 'conf', - 'examples/direct', - 'examples/failover', - 'examples/fanout', - 'examples/pub-sub', - 'examples/qmf-console', - 'examples/request-response', - 'examples/tradedemo', - 'examples/old-examples.sln', - 'examples/README.*', - 'examples/verify*', - 'include', - 'plugins') - -# Move some files around in the install tree -foreach ($pattern in $move) { - $target = Join-Path $install_dir $pattern[1] - New-Item -force -type directory $target - Move-Item -force -path "$install_dir/$($pattern[0])" -destination "$install_dir/$($pattern[1])" -} - -# Copy aside the files to preserve -New-Item -path $preserve_dir -type directory -foreach ($pattern in $preserve) { - $target = Join-Path $preserve_dir $pattern - $tparent = Split-Path -parent $target - New-Item -force -type directory $tparent - Move-Item -force -path "$install_dir/$pattern" -destination "$preserve_dir/$pattern" -} -# Remove everything to remove -foreach ($pattern in $remove) { - Remove-Item -recurse "$install_dir/$pattern" -} -# Copy back the preserved things -foreach ($pattern in $preserve) { - $target = Join-Path $install_dir $pattern - $tparent = Split-Path -parent $target - New-Item -force -type directory $tparent - Move-Item -force -path "$preserve_dir/$pattern" -destination "$install_dir/$pattern" +# +# Verify that Boost is not in PATH +# +[string] $oldPath = $env:PATH +$oldPath = $oldPath.ToLower() +if ($oldPath.Contains("boost")) +{ + Write-Host "This script will not work with BOOST defined in the path environment variable." + Exit } -Remove-Item -recurse $preserve_dir - -# Install the README -Copy-Item -force -path "$qpid_cpp_src/README-winsdk.txt" -destination "$install_dir/README-winsdk.txt" - -# Install the .NET binding -Copy-Item -force -path "./src/Debug/org.apache.qpid.messaging*.dll" -destination "$install_dir/bin" -Copy-Item -force -path "./src/Debug/org.apache.qpid.messaging*.pdb" -destination "$install_dir/bin/DebugPDB" -New-Item -path $(Join-Path $(Get-Location) $install_dir) -name dotnet_examples -type directory -Dir -recurse $qpid_cpp_src/bindings/qpid/dotnet/examples csharp*.cs | Copy -destination $install_dir/dotnet_examples -Dir -recurse $qpid_cpp_src/bindings/qpid/dotnet/examples visualbasic*.vb | Copy -destination $install_dir/dotnet_examples -Dir -recurse $qpid_cpp_src/bindings/qpid/dotnet/examples *.ps1 | Copy -destination $install_dir/dotnet_examples - -# Zip the /bin PDB files into two zip files. -# we previously arranged that the Debug pdbs go in the DebugPDB subdirectory -# and the Release pdbs go in the ReleasePDB subdirectory -&'7z' a -mx9 ".\$install_dir\bin\symbols-debug.zip" ".\$install_dir\bin\DebugPDB\*.pdb" -&'7z' a -mx9 ".\$install_dir\bin\symbols-release.zip" ".\$install_dir\bin\ReleasePDB\*.pdb" - -# It would be very good to cut down on the shipped boost include files too, ideally by -# starting with the qpid files and recursively noting all boost headers actually needed +$randomness=[System.IO.Path]::GetRandomFileName() +$qpid_cpp_src="$qpid_src\cpp" -# Create a new zip for the whole kit. -# Exclude *.pdb so as not include the debug symbols twice -if (Test-Path $zipfile) {Remove-Item $zipfile} -&'7z' a $zipfile ".\$install_dir\*" -xr!*pdb +# +# buid +# +BuildAPlatform $qpid_cpp_src ` + "x64" ` + "Visual Studio 9 2008 Win64" ` + "Debug|x64" ` + "RelWithDebInfo|x64" ` + $boostRoot64 ` + $randomness -# Remove temporary install area -# Remove-Item -recurse $install_dir +BuildAPlatform $qpid_cpp_src ` + "x86" ` + "Visual Studio 9 2008" ` + "Debug|Win32" ` + "RelWithDebInfo|Win32" ` + $boostRoot32 ` + $randomness |
