diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-03-31 04:27:03 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-03-31 06:35:23 -0700 |
| commit | 558d54dd4e86055c336e1d5f677407631edf1917 (patch) | |
| tree | b67ad0728965e963fcf15e7cf5ffcc110c54557e | |
| parent | bbaf4d77e7c9936c51cb498ac345b318207e8771 (diff) | |
| download | vcpkg-558d54dd4e86055c336e1d5f677407631edf1917.tar.gz vcpkg-558d54dd4e86055c336e1d5f677407631edf1917.zip | |
[qt5] Add qtdeploy.ps1 to enhance applocal.ps1 when Qt is in use.
| -rw-r--r-- | ports/qt5/CONTROL | 2 | ||||
| -rw-r--r-- | ports/qt5/portfile.cmake | 6 | ||||
| -rw-r--r-- | ports/qt5/qtdeploy.ps1 | 68 | ||||
| -rw-r--r-- | scripts/buildsystems/msbuild/applocal.ps1 | 22 |
4 files changed, 91 insertions, 7 deletions
diff --git a/ports/qt5/CONTROL b/ports/qt5/CONTROL index d8a6dee84..98fd1ef98 100644 --- a/ports/qt5/CONTROL +++ b/ports/qt5/CONTROL @@ -1,4 +1,4 @@ Source: qt5 -Version: 5.7.1-6 +Version: 5.7.1-7 Description: Qt5 application framework main components. Webengine, examples and tests not included. Build-Depends: sqlite3, libpq, double-conversion diff --git a/ports/qt5/portfile.cmake b/ports/qt5/portfile.cmake index 2319c26c8..d79ed5d39 100644 --- a/ports/qt5/portfile.cmake +++ b/ports/qt5/portfile.cmake @@ -198,6 +198,12 @@ vcpkg_execute_required_process( ) file(INSTALL ${SOURCE_PATH}/LICENSE.LGPLv3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5 RENAME copyright) +if(EXISTS ${CURRENT_PACKAGES_DIR}/plugins) + file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/qtdeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/plugins) +endif() +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/plugins) + file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/qtdeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/debug/plugins) +endif() vcpkg_copy_pdbs() diff --git a/ports/qt5/qtdeploy.ps1 b/ports/qt5/qtdeploy.ps1 new file mode 100644 index 000000000..9d514e411 --- /dev/null +++ b/ports/qt5/qtdeploy.ps1 @@ -0,0 +1,68 @@ +# This script is based on the implementation of windeployqt for qt5.7.1 +# +# Qt's plugin deployment strategy is that each main Qt Module has a hardcoded +# set of plugin subdirectories. Each of these subdirectories is deployed in +# full if that Module is referenced. +# +# This hardcoded list is found inside qttools\src\windeployqt\main.cpp. For +# updating, inspect the symbols qtModuleEntries and qtModuleForPlugin. + +# Note: this function signature and behavior is depended upon by applocal.ps1 +function deployPluginsIfQt([string]$targetBinaryDir, [string]$QtPluginsDir, [string]$targetBinaryName) { + + function deployPlugins([string]$pluginSubdirName) { + if (Test-Path "$QtPluginsDir\$pluginSubdirName") { + Write-Verbose " Deploying plugins directory '$pluginSubdirName'" + New-Item "$targetBinaryDir\$pluginSubdirName" -ItemType Directory -ErrorAction SilentlyContinue | Out-Null + Get-ChildItem "$QtPluginsDir\$pluginSubdirName\*.dll" | % { + deployBinary "$targetBinaryDir\$pluginSubdirName" "$QtPluginsDir\$pluginSubdirName" $_.Name + } + } else { + Write-Verbose " Skipping plugins directory '$pluginSubdirName': doesn't exist" + } + } + + # We detect Qt modules in use via the DLLs themselves. See qtModuleEntries in Qt to find the mapping. + if ($targetBinaryName -like "Qt5Gui*.dll") { + Write-Verbose " Deploying platforms" + New-Item "$targetBinaryDir\platforms" -ItemType Directory -ErrorAction SilentlyContinue | Out-Null + Get-ChildItem "$QtPluginsDir\platforms\qwindows*.dll" | % { + deployBinary "$targetBinaryDir\platforms" "$QtPluginsDir\platforms" $_.Name + } + + deployPlugins "accessible" + deployPlugins "imageformats" + deployPlugins "iconengines" + deployPlugins "platforminputcontexts" + } elseif ($targetBinaryName -like "Qt5Network*.dll") { + deployPlugins "bearer" + } elseif ($targetBinaryName -like "Qt5Sql*.dll") { + deployPlugins "sqldrivers" + } elseif ($targetBinaryName -like "Qt5Multimedia*.dll") { + deployPlugins "audio" + deployPlugins "mediaservice" + deployPlugins "playlistformats" + } elseif ($targetBinaryName -like "Qt5PrintSupport*.dll") { + deployPlugins "printsupport" + } elseif ($targetBinaryName -like "Qt5Quick*.dll") { + deployPlugins "scenegraph" + deployPlugins "qmltooling" + } elseif ($targetBinaryName -like "Qt5Declarative*.dll") { + deployPlugins "qml1tooling" + } elseif ($targetBinaryName -like "Qt5Positioning*.dll") { + deployPlugins "position" + } elseif ($targetBinaryName -like "Qt5Location*.dll") { + deployPlugins "geoservices" + } elseif ($targetBinaryName -like "Qt5Sensors*.dll") { + deployPlugins "sensors" + deployPlugins "sensorgestures" + } elseif ($targetBinaryName -like "Qt5WebEngineCore*.dll") { + deployPlugins "qtwebengine" + } elseif ($targetBinaryName -like "Qt53DRenderer*.dll") { + deployPlugins "sceneparsers" + } elseif ($targetBinaryName -like "Qt5TextToSpeech*.dll") { + deployPlugins "texttospeech" + } elseif ($targetBinaryName -like "Qt5SerialBus*.dll") { + deployPlugins "canbus" + } +} diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1 index aef22bb50..21e42d479 100644 --- a/scripts/buildsystems/msbuild/applocal.ps1 +++ b/scripts/buildsystems/msbuild/applocal.ps1 @@ -2,14 +2,17 @@ param([string]$targetBinary, [string]$installedDir, [string]$tlogFile) $g_searched = @{} +# Note: installedDir is actually the bin\ directory. +$g_install_root = Split-Path $installedDir -parent -function deployBinary([string]$targetBinaryDir, [string]$targetBinaryName) { +# Note: this function signature is depended upon by the qtdeploy.ps1 script introduced in 5.7.1-7 +function deployBinary([string]$targetBinaryDir, [string]$SourceDir, [string]$targetBinaryName) { if (Test-Path "$targetBinaryDir\$targetBinaryName") { - Write-Verbose " ${targetBinaryName}: already present - Only recurse" + Write-Verbose " ${targetBinaryName}: already present" } else { - Copy-Item "$installedDir\$targetBinaryName" $targetBinaryDir - Write-Verbose " ${targetBinaryName}: Copying $installedDir\$targetBinaryName" + Write-Verbose " ${targetBinaryName}: Copying $SourceDir\$targetBinaryName" + Copy-Item "$SourceDir\$targetBinaryName" $targetBinaryDir } "$targetBinaryDir\$targetBinaryName" if ($tlogFile) { Add-Content $tlogFile "$targetBinaryDir\$targetBinaryName" } @@ -38,8 +41,9 @@ function resolve([string]$targetBinary) { } $g_searched.Set_Item($_, $true) if (Test-Path "$installedDir\$_") { - deployBinary($targetBinaryDir, $_) - resolve("$targetBinaryDir\$_") + deployBinary $targetBinaryDir $installedDir "$_" + if (Test-Path function:\deployPluginsIfQt) { deployPluginsIfQt $targetBinaryDir "$g_install_root\plugins" "$_" } + resolve "$targetBinaryDir\$_" } else { Write-Verbose " ${_}: $installedDir\$_ not found" } @@ -47,5 +51,11 @@ function resolve([string]$targetBinary) { Write-Verbose "Done Resolving $targetBinary." } +# Note: This is a hack to make Qt5 work. +# Introduced with Qt package version 5.7.1-7 +if (Test-Path "$g_install_root\plugins\qtdeploy.ps1") { + . "$g_install_root\plugins\qtdeploy.ps1" +} + resolve($targetBinary) Write-Verbose $($g_searched | out-string)
\ No newline at end of file |
