From 44480e795b2a4d251db7e911770bcc3ef677247d Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Mon, 28 Jun 2010 20:22:25 +0000 Subject: QPID-2689: Install and package Visual Studio debugging symbols (.pdb) files, in the windows sdk zip package. A Modified version of a patch from Chuck Rolke git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@958703 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/bld-winsdk.ps1 | 278 +++++++++++++++++++++++--------------------- qpid/cpp/src/CMakeLists.txt | 81 +++++++------ 2 files changed, 191 insertions(+), 168 deletions(-) diff --git a/qpid/cpp/bld-winsdk.ps1 b/qpid/cpp/bld-winsdk.ps1 index 8618160259..7aa6df81cd 100644 --- a/qpid/cpp/bld-winsdk.ps1 +++ b/qpid/cpp/bld-winsdk.ps1 @@ -1,133 +1,145 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# 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 - -Set-PSDebug -strict -$ErrorActionPreference='Stop' - -if ($args.length -lt 1) { - Write-Host 'Need to specify location of qpid src tree' - exit -} - -$qpid_src=$args[0] -$ver=$args[1] -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)" - exit - } - $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 so we can ship both sets of libs -# (Do release after debug so that the release executables overwrite the -# debug executables) -devenv qpid-cpp.sln /build "Debug|Win32" /project INSTALL -devenv qpid-cpp.sln /build "Release|Win32" /project INSTALL - -# 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/qmfengine*.*', 'bin/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 - -# 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 - -# Create a new zip -if (Test-Path $zipfile) {Remove-Item $zipfile} -&'7z' a $zipfile ".\$install_dir\*" - -# Remove temporary install area -# Remove-Item -recurse $install_dir +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# 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 + +Set-PSDebug -strict +$ErrorActionPreference='Stop' + +if ($args.length -lt 1) { + Write-Host 'Need to specify location of qpid src tree' + exit +} + +$qpid_src=$args[0] +$ver=$args[1] +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)" + exit + } + $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 + +# 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 + +# 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 + + +# 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 + +# Remove temporary install area +# Remove-Item -recurse $install_dir diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt index 44dea3a155..8bf1178237 100644 --- a/qpid/cpp/src/CMakeLists.txt +++ b/qpid/cpp/src/CMakeLists.txt @@ -34,6 +34,37 @@ include(FindDoxygen) #set (CMAKE_VERBOSE_MAKEFILE ON) # for debugging +# +# Set up installation of .pdb files if the compiler is Visual Studio +# +# Sample: install_pdb (qpidcommon ${QPID_COMPONENT_COMMON}) +# +MACRO (install_pdb theLibrary theComponent) + if (MSVC) + get_target_property(library_dll ${theLibrary} LOCATION) + string(REPLACE .dll .pdb library_pdb ${library_dll}) + string(REPLACE $(OutDir) \${CMAKE_INSTALL_CONFIG_NAME} library_pdb ${library_pdb}) + string(REPLACE .pdb d.pdb libraryd_pdb ${library_pdb}) + #message(STATUS "_pdb: ${library_pdb}, ${libraryd_pdb}") + install (PROGRAMS + ${library_pdb} + DESTINATION ${QPID_INSTALL_LIBDIR}/ReleasePDB + COMPONENT ${theComponent} + OPTIONAL + CONFIGURATIONS Release|MinSizeRel) + install (PROGRAMS + ${library_pdb} + DESTINATION ${QPID_INSTALL_LIBDIR}/ReleasePDB + COMPONENT ${theComponent} + CONFIGURATIONS RelWithDebInfo) + install (PROGRAMS + ${libraryd_pdb} + DESTINATION ${QPID_INSTALL_LIBDIR}/DebugPDB + COMPONENT ${theComponent} + CONFIGURATIONS Debug) + endif (MSVC) +ENDMACRO (install_pdb) + # check if we generate source as part of the build # - rubygen generates the amqp spec and clustering # - managementgen generates the broker management code @@ -459,6 +490,10 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows) if (MSVC80) add_definitions(/D "_WIN32_WINNT=0x0501") endif (MSVC80) + + # set the RelWithDebInfo compile/link switchs to equal Release + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /O2 /Ob2 /D NDEBUG") + set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "/debug /INCREMENTAL:NO") endif (MSVC) set (qpidcommon_platform_SOURCES @@ -543,7 +578,7 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows) ${qpid_poller_module} ) - set (qpidcommon_platform_LIBS + set (qpidcommon_platform_LIBS ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} uuid @@ -645,19 +680,8 @@ set_target_properties (qpidcommon PROPERTIES install (TARGETS qpidcommon DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_COMMON}) +install_pdb (qpidcommon ${QPID_COMPONENT_COMMON}) -if (WIN32) - # Need the .pdb file, which isn't installed with the .dll/.lib - # Not built... if needed, add the build option then uncomment this. - #get_target_property(qpidcommon_dll qpidcommon LOCATION) - #string(REPLACE .dll .pdb qpidcommon_pdb ${qpidcommon_dll}) - #string(REPLACE $(OutDir) \${CMAKE_INSTALL_CONFIG_NAME} qpidcommon_pdb ${qpidcommon_pdb}) - #message(STATUS "_pdb: ${qpidcommon_pdb}") - #install (PROGRAMS - # ${qpidcommon_pdb} - # DESTINATION ${QPID_INSTALL_LIBDIR} - # COMPONENT ${QPID_COMPONENT_CLIENT}) -endif (WIN32) set (qpidclient_SOURCES ${rgen_client_srcs} @@ -708,6 +732,8 @@ install (DIRECTORY ../include/qpid DESTINATION ${QPID_INSTALL_INCLUDEDIR} COMPONENT ${QPID_COMPONENT_CLIENT_INCLUDE} PATTERN ".svn" EXCLUDE) +install_pdb (qpidclient ${QPID_COMPONENT_CLIENT}) + set (qpidmessaging_SOURCES qpid/messaging/Address.cpp @@ -755,6 +781,7 @@ set_target_properties (qpidmessaging PROPERTIES VERSION ${qpidc_version}) install (TARGETS qpidmessaging DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_CLIENT}) +install_pdb (qpidmessaging ${QPID_COMPONENT_CLIENT}) # Released source artifacts from Apache have the generated headers included in # the source tree, not the binary tree. So don't attempt to grab them when @@ -765,17 +792,6 @@ if (NOT QPID_GENERATED_HEADERS_IN_SOURCE) COMPONENT ${QPID_COMPONENT_CLIENT_INCLUDE}) endif (NOT QPID_GENERATED_HEADERS_IN_SOURCE) -if (WIN32) - # Need the .pdb file, which isn't installed with the .dll/.lib - #get_target_property(qpidclient_dll qpidclient LOCATION) - #string(REPLACE .dll .pdb qpidclient_pdb ${qpidclient_dll}) - #string(REPLACE $(OutDir) \${CMAKE_INSTALL_CONFIG_NAME} qpidclient_pdb ${qpidclient_pdb}) - #message(STATUS "_pdb: ${qpidclient_pdb}") - #install (PROGRAMS - # ${qpidclient_pdb} - # DESTINATION ${QPID_INSTALL_LIBDIR} - # COMPONENT ${QPID_COMPONENT_CLIENT}) -endif (WIN32) if (WIN32) set(AMQP_WCF_DIR ${qpid-cpp_SOURCE_DIR}/../wcf) @@ -786,6 +802,7 @@ if (WIN32) install (TARGETS qpidxarm DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_CLIENT}) + install_pdb (qpidxarm ${QPID_COMPONENT_CLIENT}) endif (EXISTS ${DTC_PLUGIN_SOURCE}) endif (WIN32) @@ -866,6 +883,8 @@ endif (MSVC) install (TARGETS qpidbroker DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_BROKER}) +install_pdb (qpidbroker ${QPID_COMPONENT_BROKER}) + set (qpidd_SOURCES ${qpidd_platform_SOURCES} @@ -904,6 +923,7 @@ set_target_properties (qmf PROPERTIES install (TARGETS qmf OPTIONAL DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_QMF}) +install_pdb (qmf ${QPID_COMPONENT_QMF}) set (qmfengine_SOURCES qmf/engine/Agent.cpp @@ -943,6 +963,7 @@ set_target_properties (qmfengine PROPERTIES install (TARGETS qmfengine OPTIONAL DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_QMF}) +install_pdb (qmfengine ${QPID_COMPONENT_QMF}) # QMF console library #module_hdr += \ @@ -992,17 +1013,7 @@ set_target_properties (qmfconsole PROPERTIES install (TARGETS qmfconsole DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_QMF}) -if (WIN32) - # Need the .pdb file, which isn't installed with the .dll/.lib - #get_target_property(qmfconsole_dll qmfconsole LOCATION) - #string(REPLACE .dll .pdb qmfconsole_pdb ${qmfconsole_dll}) - #string(REPLACE $(OutDir) \${CMAKE_INSTALL_CONFIG_NAME} qmfconsole_pdb ${qmfconsole_pdb}) - #message(STATUS "_pdb: ${qmfconsole_pdb}") - #install (PROGRAMS - # ${qmfconsole_pdb} - # DESTINATION ${QPID_INSTALL_LIBDIR} - # COMPONENT ${QPID_COMPONENT_QMF}) -endif (WIN32) +install_pdb (qmfconsole ${QPID_COMPONENT_QMF}) # A queue event listener plugin that creates messages on a replication # queue corresponding to enqueue and dequeue events: -- cgit v1.2.1