qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1209240 - in /qpid/trunk/qpid/cpp: bld-winsdk.ps1 examples/winsdk-cmake/CMakeLists.txt
Date Thu, 01 Dec 2011 21:10:19 GMT
Author: chug
Date: Thu Dec  1 21:10:17 2011
New Revision: 1209240

URL: http://svn.apache.org/viewvc?rev=1209240&view=rev
Log:
QPID-2643 Visual Studio 2010

Try to dodge several issues that appear on 64-bit hosts with both VS2008 and
VS2010 installed at the same time. The new bld-winsdk.ps1 script requires
a user to call an environment setup script before it is run. This lets the
script simply refer to 'devenv' and get the right thing. Note that the
script invocation args and the version of boost must match the version
of the kit being built.


Modified:
    qpid/trunk/qpid/cpp/bld-winsdk.ps1
    qpid/trunk/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt

Modified: qpid/trunk/qpid/cpp/bld-winsdk.ps1
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bld-winsdk.ps1?rev=1209240&r1=1209239&r2=1209240&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bld-winsdk.ps1 (original)
+++ qpid/trunk/qpid/cpp/bld-winsdk.ps1 Thu Dec  1 21:10:17 2011
@@ -18,32 +18,36 @@
 #
 
 # This script builds a WinSDK from a Qpid source checkout that
-# has been cleaned of any SVN artifacts.
+# has been cleaned of any SVN artifacts. 
+# It builds a single SDK.zip file.
+# The environment for the build has been set up externally so
+# that 'devenv' runs the right version of Visual Studio (2008
+# or 2010) and the right architecture (x86 or x64), typically:
+# C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat or
+# C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvarsamd64.bat
 #
 # 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[3] holds the optional version number.         "0.7.946106-99"
-#     Defaults to contents of QPID_VERSION.txt
-#  5. Args[4] holds the optional Visual Studio version   "VS2010"
+#  1. Args[0] holds the BOOST_ROOT directory.            "c:\boost"
+#  2. Args[1] holds the version number.                  "2.0.0.1"
+#     This arg/version number is used for output package naming purposes.
+#     The version number embedded in the built executables and libraries
+#     comes from qpid/cpp/src/CMakeWinVersions.cmake.
+#  3. Args[2] holds the Visual Studio version handle     "VS2010"
 #     Defaults to VS2008.
-#  6. The current directory will receive x86 and x64 subdirs.
-#  7. The x86 an x64 dirs are where cmake will run.
-#  8. Two Boost installations, 32- and 64-bit, are available.
-#     Boost was built with the same version of Visual Studio as this build.
-#  9. Boost directories must not be on the path.
-# 10. cmake, 7z, and devenv are already on the path.
-# 11. devenv is Visual Studio 2008 or 2010 as set by Args[4].
-#     The PATH, INCLUDE, LIBPATH, and LIB environment vars are
-#     set by calling vcvarsall.bat and then running "devenv /useenv".
+#  4. Args[3] holds the architecture handle              "x86" or "x64".
+#     Defaults to x86.
+#  5. This file exists in directory kitroot/qpid/cpp.
+#     A new directory (kitroot/x86 or kitroot/x64) will be created.
+#  6. The x86 an x64 dirs are where cmake will run.
+#  7. Boost was built with the same version of Visual Studio 
+#     and the same architecture as this build.
+#  8. Boost directories must not be on the path.
+#  9. cmake, 7z, and devenv are already on the path.
 #
-# This script creates separate zip kits for 32- and
+# This script creates a separate zip kit for 32-bit or
 # for 64-bit variants. Example output files:
-#   qpid-cpp-x86-VS2008-1.3.0.12.zip
-#   qpid-cpp-x64-VS2008-1.3.0.12.zip
+#   qpid-cpp-x86-VS2008-2.0.0.1.zip
+#   qpid-cpp-x64-VS2008-2.0.0.1.zip
 #
 
 # Avoid "The OS handle's position is not what FileStream expected" errors
@@ -58,6 +62,7 @@ $field         = $consoleHost.GetType().
 $field.SetValue( $consoleHost, [Console]::Out)
 $field2        = $consoleHost.GetType().GetField("standardErrorWriter", $flagsFld)
 $field2.SetValue($consoleHost, [Console]::Out)
+
 
 Set-PSDebug -Trace 1
 Set-PSDebug -strict
@@ -71,6 +76,7 @@ $ErrorActionPreference='Stop'
 [string] $global:sourceDirectory    = Split-Path -parent $global:bldwinsdkDirectory
 [string] $global:currentDirectory   = Split-Path -parent $global:sourceDirectory
 [string] $global:vsVersion          = "VS2008"
+[string] $global:vsArch             = "x86"
 
 
 ################################
@@ -92,51 +98,6 @@ function Unix2Dos
 
 ################################
 #
-# SetVS2008
-#   Set environment for VS2008
-#
-function SetVS2008($varsallArg)
-{
-    $vs90comntools = (Get-ChildItem env:VS90COMNTOOLS).Value
-    $batchFile = [System.IO.Path]::Combine($vs90comntools, "..\..\VC\vcvarsall.bat")
-    $batchFile = Resolve-Path $batchFile
-    GetBatchfilesEnvironment "$BatchFile" $varsallArg
-}
-
-
-################################
-#
-# SetVS2010
-#   Set environment for VS2010
-#
-function SetVS2010($varsallArg)
-{
-    $vs100comntools = (Get-ChildItem env:VS100COMNTOOLS).Value
-    $batchFile = [System.IO.Path]::Combine($vs100comntools, "..\..\VC\vcvarsall.bat")
-    $batchFile = Resolve-Path $batchFile
-    GetBatchfilesEnvironment $BatchFile $varsallArg
-}
- 
-################################
-#
-# GetBatchfilesEnvironment
-#   Run a batch file specifically to change environment variables.
-#   Then propagate those variables to this process.
-#
-function GetBatchfilesEnvironment($file, $varsallArg)
-{
-    $exe = "cmd"
-    [Array]$params = "/c", """$file""", $varsallArg, "&", "set";
-    Write-Host "Select Visual Studio command line environment: $exe $params"
-    & $exe $params | Foreach-Object {
-        $p, $v = $_.split('=')
-        Set-Item -path env:$p -value $v
-    }
-}
-
-
-################################
-#
 # BuildAPlatform
 #   Build a platform, x86 or x64.
 #   Compiles and packages Debug and RelWithDebInfo configurations.
@@ -185,7 +146,7 @@ function BuildAPlatform
         if ($vsName -eq "VS2010") {
             $msvcVer = "msvc10"
         } else {
-            Write-Host "illegal vsName parameter: $vsName"
+            Write-Host "illegal vsName parameter: $vsName Choose VS2008 or VS2010"
             exit
         }
     }
@@ -203,26 +164,6 @@ function BuildAPlatform
     #
     Set-Location $platform_dir
 
-    #
-    # Set environment for this build
-    #
-    # set up the vcvarsall arg for a native/cross compiler command line 
-    if ($platform -eq "x86") {
-        $varsallArg = "x86"
-    } else {
-        $os=Get-WMIObject win32_operatingsystem
-        if ($os.OSArchitecture -eq "64-bit") {
-            $varsallArg = "amd64"
-        } else {
-            $varsallArg = "x86_amd64"
-        }
-    }
-    if ($vsName -eq "VS2008") {
-        SetVS2008 $varsallArg
-    } else {
-        SetVS2010 $varsallArg
-    }
-
     $env:BOOST_ROOT      = "$boostRoot"
     $env:QPID_BUILD_ROOT = Get-Location
 
@@ -235,31 +176,31 @@ function BuildAPlatform
     # 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 /useenv qpid-cpp.sln /build "Release|Win32"     /project docs-user-api
+        devenv qpid-cpp.sln /build "Release|Win32"     /project docs-user-api
     } else {
-        devenv /useenv qpid-cpp.sln /build "Release|$platform" /project docs-user-api
+        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 /useenv qpid-cpp.sln /build "$vsTargetDebug"   /project INSTALL
-    devenv /useenv qpid-cpp.sln /build "$vsTargetRelease" /project INSTALL
+    devenv qpid-cpp.sln /build "$vsTargetDebug"   /project INSTALL
+    devenv qpid-cpp.sln /build "$vsTargetRelease" /project INSTALL
 
     $bindingSln = Resolve-Path $qpid_cpp_src\bindings\qpid\dotnet\$msvcVer\org.apache.qpid.messaging.sln
     
     # Build the .NET binding
     if ("x86" -eq $platform) {
-        devenv /useenv $bindingSln /build "Debug|Win32"              /project org.apache.qpid.messaging
-        devenv /useenv $bindingSln /build "Debug|$platform"          /project org.apache.qpid.messaging.sessionreceiver
-        devenv /useenv $bindingSln /build "RelWithDebInfo|Win32"     /project org.apache.qpid.messaging
-        devenv /useenv $bindingSln /build "RelWithDebInfo|$platform" /project org.apache.qpid.messaging.sessionreceiver
+        devenv $bindingSln /build "Debug|Win32"              /project org.apache.qpid.messaging
+        devenv $bindingSln /build "Debug|$platform"          /project org.apache.qpid.messaging.sessionreceiver
+        devenv $bindingSln /build "RelWithDebInfo|Win32"     /project org.apache.qpid.messaging
+        devenv $bindingSln /build "RelWithDebInfo|$platform" /project org.apache.qpid.messaging.sessionreceiver
     } else {
-        devenv /useenv $bindingSln /build "Debug|$platform"          /project org.apache.qpid.messaging
-        devenv /useenv $bindingSln /build "Debug|$platform"          /project org.apache.qpid.messaging.sessionreceiver
-        devenv /useenv $bindingSln /build "RelWithDebInfo|$platform" /project org.apache.qpid.messaging
-        devenv /useenv $bindingSln /build "RelWithDebInfo|$platform" /project org.apache.qpid.messaging.sessionreceiver
+        devenv $bindingSln /build "Debug|$platform"          /project org.apache.qpid.messaging
+        devenv $bindingSln /build "Debug|$platform"          /project org.apache.qpid.messaging.sessionreceiver
+        devenv $bindingSln /build "RelWithDebInfo|$platform" /project org.apache.qpid.messaging
+        devenv $bindingSln /build "RelWithDebInfo|$platform" /project org.apache.qpid.messaging.sessionreceiver
     }
 
     # Create install Debug and Release directories
@@ -310,6 +251,8 @@ function BuildAPlatform
         'examples/qmf-console',
         'examples/request-response',
         'examples/tradedemo',
+        'examples/*.sln',
+        'examples/*.vcproj',
         'include',
         'plugins')
 
@@ -365,9 +308,9 @@ function BuildAPlatform
 
     # Construct the examples' msvc-versioned solution/projects
     New-Item $(Join-Path $install_dir "examples\msvc") -type Directory | Out-Null
-    Push-Location $(Join-Path $install_dir "examples\msvc")
-        cmake -G $cmakeGenerator $(Resolve-Path "$qpid_cpp_src/examples/winsdk-cmake")
-    Pop-Location
+    $src = Resolve-Path "$global:sourceDirectory/cpp/examples/winsdk-cmake"
+    $dst = Join-Path $install_dir "examples\msvc"
+    Copy-Item "$src\*" -destination "$dst\"
     
     # Zip the /bin PDB files
     &'7z' a -mx9 ".\$install_dir\bin\Debug\symbols-debug.zip"     ".\$install_dir\bin\DebugPDB\*.pdb"
@@ -393,29 +336,19 @@ function BuildAPlatform
 # Main()
 #
 # Process the args
-#
-if ($args.length -lt 3) {
-    Write-Host 'Usage: bld-winsdk.ps1 qpid_src_dir boost32_dir boost64_dir [buildVersion
[Visual Studio Version]]'
-    Write-Host '       bld-winsdk.ps1 qpid         d:\boost-32 d:\boost-64  1.2.3.4     
 VS2008'
-    exit
-}
-
-$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"
+#
 
-  if ( !(Test-Path $qpid_version_file)) {
-    Write-Host "Path doesn't seem to be a qpid src tree (no QPID_VERSION.txt)"
+if ($args.length -lt 3) {
+    Write-Host 'Usage: bld-winsdk.ps1 boost_root  buildVersion [VisualStudioVersion [architecture]]'
+    Write-Host '       bld-winsdk.ps1 d:\boost-32 1.2.3.4       VS2008               x86'
     exit
-  }
-  $ver=Get-Content $qpid_version_file
 }
 
+$qpid_src    = "qpid"
+$boostRoot   = $args[0]
+$ver         = $args[1]
 $generator = ""
-$global:vsVersion = $args[4]
+$global:vsVersion = $args[2]
 if ( !($global:vsVersion -eq $null) ) {
     if ($global:vsVersion -eq "VS2008") {
         $generator = "Visual Studio 9 2008"
@@ -432,13 +365,29 @@ if ( !($global:vsVersion -eq $null) ) {
     $global:vsVersion = "VS2008"
     $generator = "Visual Studio 9 2008"
 }
+
+$global:vsArch = $args[3]
+if ( !($global:vsArch -eq $null) ) {
+    if ($global:vsArch -eq "x86") {
+    } else {
+        if ($global:vsArch -eq "x64") {
+        } else {
+            Write-Host "Architecture must be x86 or x64"
+            exit
+        }
+    }
+} else {
+    # default architecture
+    $global:vsArch = "x86"
+}
+
 Write-Host "bld-winsdk.ps1"
 Write-Host " qpid_src    : $qpid_src"
-Write-Host " boostRoot32 : $boostRoot32"
-Write-Host " boostRoot64 : $boostRoot64"
+Write-Host " boostRoot   : $boostRoot"
 Write-Host " ver         : $ver"
 Write-Host " cmake gene  : $generator"
 Write-Host " vsVersion   : $global:vsVersion"
+Write-Host " vsArch      : $global:vsArch"
 
 #
 # Verify that Boost is not in PATH
@@ -458,20 +407,22 @@ $qpid_cpp_src="$qpid_src\cpp"
 #
 # buid
 #
-BuildAPlatform $qpid_cpp_src `
-               "x64" `
-               "$generator Win64" `
-               "Debug|x64" `
-               "RelWithDebInfo|x64" `
-               $boostRoot64 `
-               $randomness `
-               $global:vsVersion
-
-BuildAPlatform $qpid_cpp_src `
-               "x86" `
-               "$generator" `
-               "Debug|Win32" `
-               "RelWithDebInfo|Win32" `
-               $boostRoot32 `
-               $randomness `
-               $global:vsVersion
+if ($global:vsArch -eq "x86") {
+    BuildAPlatform $qpid_cpp_src `
+                   "x86" `
+                   "$generator" `
+                   "Debug|Win32" `
+                   "RelWithDebInfo|Win32" `
+                   $boostRoot `
+                   $randomness `
+                   $global:vsVersion
+} else {
+    BuildAPlatform $qpid_cpp_src `
+                   "x64" `
+                   "$generator Win64" `
+                   "Debug|x64" `
+                   "RelWithDebInfo|x64" `
+                   $boostRoot `
+                   $randomness `
+                   $global:vsVersion
+}
\ No newline at end of file

Modified: qpid/trunk/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt?rev=1209240&r1=1209239&r2=1209240&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt (original)
+++ qpid/trunk/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt Thu Dec  1 21:10:17 2011
@@ -17,34 +17,39 @@
 # under the License.
 #
 
-#
-# For making WinSDK example solution and project files:
-# Top-level CMake source to build version-independent C++ 
-# example solution and project files for Visual Studio.
-#
-# mkdir msvc9-win32
-# cd    msvc9-win32
-# cmake -G "Visual Studio 9 2008" ..\cmake
-# cd ..
-#
-# mkdir msvc9-x64
-# cd    msvc9-x64
-# cmake -G "Visual Studio 9 2008 x64" ..\cmake
-# cd ..
+# Description
+#   For WinSDK:
+#   Top-level CMake source to build version-independent C++ 
+#   example solution and project files for Visual Studio.
+#
+# Usage:
+#   mkdir msvc9-win32
+#   cd    msvc9-win32
+#   cmake -G "Visual Studio 9 2008" ..\winsdk-cmake
+#   cd ..
+#
+#   mkdir msvc9-x64
+#   cd    msvc9-x64
+#   cmake -G "Visual Studio 9 2008 Win64" ..\winsdk-cmake
+#   cd ..
+#
+#   mkdir msvc10-win32
+#   cd    msvc10-win32
+#   cmake -G "Visual Studio 10" ..\winsdk-cmake
+#   cd ..
+#
+#   mkdir msvc10-x64
+#   cd    msvc10-x64
+#   cmake -G "Visual Studio 10 Win64" ..\winsdk-cmake
+#   cd ..
 #
 
 project(examples)
 
-set (CMAKE_VERBOSE_MAKEFILE ON)  # for debugging
+set (CMAKE_VERBOSE_MAKEFILE ON)
 
-cmake_minimum_required(VERSION 2.4.0 FATAL_ERROR)
-
-#
-# This script supports settings for the WinSDK build and
-# for a normal source build.
-#
-option (BUILD_WINSDK
-        "Generate for the WinSDK packaged environment" ON)
+cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
+cmake_policy (SET CMP0015 NEW)
 
 set (CMAKE_SUPPRESS_REGENERATION TRUE)
 
@@ -56,33 +61,16 @@ add_definitions(
 
 set (CMAKE_DEBUG_POSTFIX "d")
 
-set (CMAKE_CONFIGURATION_TYPES Debug Release)
-
-if (BUILD_WINSDK)
-    # Set for WinSDK builds
-    message(STATUS "BUILD_WINSDK is ON")
-    set (includeDirs            "../../include")
-    set (linkDirs               "../../lib")
-else (BUILD_WINSDK)
-    # Set for in-source builds
-    message(STATUS "BUILD_WINSDK is OFF")
-    set (includeDirs            "$(QPID_ROOT)/include;../../include")
-    set (linkDirs               "$(QPID_ROOT)/src/$(Configuration);../../lib")
-endif (BUILD_WINSDK)
-
-
-include_directories      ( ${includeDirs} )
-link_directories         ( ${linkDirs}    )
+include_directories      ( "../../include" )
+link_directories         ( "../../lib"     )
 
 macro(add_example_properties example)
   set_target_properties(${example} PROPERTIES OUTPUT_NAME "${example}" )
-  IF (BUILD_WINSDK)
-    set_target_properties(${example} PROPERTIES PREFIX "../../../bin/")
-  ENDIF (BUILD_WINSDK)
+  set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/${CMAKE_BUILD_TYPE})
   
-  target_link_libraries(${example} qpidmessaging debug qpidmessagingd)
-  target_link_libraries(${example} qpidcommon    debug qpidcommond)
-  target_link_libraries(${example} qpidtypes     debug qpidtypesd)
+  target_link_libraries(${example} qpidmessaging)
+  target_link_libraries(${example} qpidcommon   )
+  target_link_libraries(${example} qpidtypes    )
 endmacro(add_example_properties)
 
 macro(add_example srcdirectory example)
@@ -102,14 +90,3 @@ add_example(messaging map_receiver)
 add_example(messaging map_sender)
 add_example(messaging client)
 add_example(messaging server)
-
-if (NOT BUILD_WINSDK)
-  add_example(messaging hello_world)
-  add_example(messaging hello_xml)
-  
-  add_example(qmf-console console)
-  add_example(qmf-console ping)
-  add_example(qmf-console printevents)
-  add_example(qmf-console queuestats)
-  
-endif (NOT BUILD_WINSDK)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message