3 # Windeployqt-to-nsh - Convert the output of windeployqt to an equivalent set of
4 # NSIS "File" function calls.
6 # Copyright 2014 Gerald Combs <gerald@wireshark.org>
8 # Wireshark - Network traffic analyzer
9 # By Gerald Combs <gerald@wireshark.org>
10 # Copyright 1998 Gerald Combs
12 # SPDX-License-Identifier: GPL-2.0-or-later
18 Creates NSIS "File" function calls required for Qt packaging.
21 This script creates an NSIS-compatible file based on the following Qt
24 - 5.3 and later: A list of DLLs and directories based on the output of the
25 "windeployqt" utility. Windeployqt lists the DLLs required to run a Qt
26 application. (The initial version that shipped with Qt 5.2 is unusable.)
28 - 5.2 and earlier: A hard-coded list of Qt DLLs and directories appropriate
29 for earlier Qt versions.
33 If building with Qt, QMake must be in your PATH.
36 The path to a Qt application. It will be examined for dependent DLLs.
42 -Executable Path to the Qt application.
43 -FilePath Output NSIS file.
46 List of NSIS commands required to package supporting DLLs.
49 C:\PS> .\windeployqt-to-nsis.ps1 windeployqt.exe ..\..\staging\wireshark.exe qt-dll-manifest.nsh
53 [Parameter(Mandatory=$true, Position=0)]
56 [Parameter(Position=1)]
57 [String] $FilePath = "qt-dll-manifest.nsh"
62 $qtVersion = [version](qmake -query QT_VERSION)
63 $nsisCommands = @("# Qt version " + $qtVersion ; "#")
65 if ($qtVersion -ge "5.3") {
66 # Qt 5.3 or later. Windeployqt is present and works
68 $wdqtList = windeployqt `
70 --no-compiler-runtime `
74 $dllPath = Split-Path -Parent $Executable
79 foreach ($entry in $wdqtList) {
80 $dir = Split-Path -Parent $entry
82 $dirList += "File /r `"$dllPath\$dir`""
84 $dllList += "File `"$dllPath\$entry`""
88 $dirList = $dirList | Sort-Object | Get-Unique
90 $nsisCommands += $dllList + $dirList
92 } elseif ($qtVersion -ge "5.0") {
93 # Qt 5.0 - 5.2. Windeployqt is buggy or not present
96 File "..\..\wireshark-qt-release\Qt5Core.dll"
97 File "..\..\wireshark-qt-release\Qt5Gui.dll"
98 File "..\..\wireshark-qt-release\Qt5Widgets.dll"
99 File "..\..\wireshark-qt-release\Qt5PrintSupport.dll"
100 File /r "..\..\wireshark-qt-release\platforms"
107 File "..\..\wireshark-qt-release\QtCore4.dll"
108 File "..\..\wireshark-qt-release\QtGui4.dll"
123 Set-Content $FilePath @"
125 # Automatically generated by $($MyInvocation.MyCommand.Name)
129 Add-Content $FilePath $nsisCommands