qt - 如何从 Cygwin 的命令行安装 Qt 5.2.1?

标签 qt command-line installation cygwin

$ wget --quiet http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-windows-x86-msvc2012_64_opengl-5.2.1.exe
$

如上所示,我首先在 Cygwin Bash shell 中下载了用于 Visual Studio 的 Qt 包。

旁注:Cygwin 中打包的 Qt 库对我没有用,因为我需要使用 Visual Studio C++ 编译器。

首先我在文件上设置正确的权限

$ chmod 755 qt-opensource-windows-x86-msvc2012_64_opengl-5.2.1.exe

如果我这样开始

$ ./qt-opensource-windows-x86-msvc2012_64_opengl-5.2.1.exe

显示了一个图形窗口 (GUI),但这不是我想要的,因为我以后希望将安装过程写入可以在 Cygwin 中运行的 Bash 脚本中。

如果我添加选项 --help , 像这样

$ ./qt-opensource-windows-x86-msvc2012_64_opengl-5.2.1.exe --help

打开一个新的终端窗口,其中包含以下文本

Usage: SDKMaintenanceTool [OPTIONS]

User:
  --help                                      Show commandline usage                  
  --version                                   Show current version                    
  --checkupdates                              Check for updates and return an XML file describing
                                              the available updates                   
  --updater                                   Start in updater mode.                  
  --manage-packages                           Start in packagemanager mode.  
  --proxy                                     Set system proxy on Win and Mac.        
                                              This option has no effect on Linux.     
  --verbose                                   Show debug output on the console        
  --create-offline-repository                 Offline installer only: Create a local repository inside the
                                              installation directory based on the offline
                                              installer's content.                    

Developer:
  --runoperation [OPERATION] [arguments...]   Perform an operation with a list of arguments
  --undooperation [OPERATION] [arguments...]  Undo an operation with a list of arguments
  --script [scriptName]                       Execute a script                        
  --no-force-installations                    Enable deselection of forced components 
  --addRepository [URI]                       Add a local or remote repo to the list of user defined repos.
  --addTempRepository [URI]                   Add a local or remote repo to the list of temporary available
                                              repos.                                  
  --setTempRepository [URI]                   Set a local or remote repo as tmp repo, it is the only one
                                              used during fetch.                      
                                              Note: URI must be prefixed with the protocol, i.e. file:///
                                              http:// or ftp://. It can consist of multiple
                                              addresses separated by comma only.      
  --show-virtual-components                   Show virtual components in package manager and updater
  --binarydatafile [binary_data_file]         Use the binary data of another installer or maintenance tool.
  --update-installerbase [new_installerbase]  Patch a full installer with a new installer base
  --dump-binary-data -i [PATH] -o [PATH]      Dumps the binary content into specified output path (offline
                                              installer only).                        
                                              Input path pointing to binary data file, if omitted
                                              the current application is used as input.

我不知道如何从这里继续。您知道如何从 Cygwin 的 Bash shell 安装 Qt 5.2.1 库(用于 Visual Studio)吗?

更新:为 Cygwin 环境编写构建脚本的优势在于可以使用类似 的命令。 git , wget , 和 SCP 可用。此 Stackoverflow answer描述了如何从 Cygwin bash 脚本调用 MSVC 编译器。请注意,我正在构建的 Qt 应用程序不会对 Cygwin 产生任何依赖。

最佳答案

我没有使用 Cygwin 进行测试,但我使用脚本成功安装了 Qt5.5。为此,您必须使用 --script正常安装程序的行。

.\qt-opensource-windows-x86-msvc2013_64-5.5.1.exe --script .\qt-installer-noninteractive.qs

这是 qt-installer-noninteractive.qs 的示例我在上面的命令中使用的文件
function Controller() {
  installer.autoRejectMessageBoxes();
  installer.installationFinished.connect(function() {
    gui.clickButton(buttons.NextButton);
  })
}

Controller.prototype.WelcomePageCallback = function() {
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.CredentialsPageCallback = function() {
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.IntroductionPageCallback = function() {
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.TargetDirectoryPageCallback = function() {
  gui.currentPageWidget().TargetDirectoryLineEdit.setText("C:/Qt/Qt5.5.1");
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.ComponentSelectionPageCallback = function() {
  var widget = gui.currentPageWidget();

  widget.deselectAll();
  widget.selectComponent("qt.55.win64_msvc2013_64");
  // widget.selectComponent("qt.55.qt3d");
  // widget.selectComponent("qt.55.qtcanvas3d");
  // widget.selectComponent("qt.55.qtquick1");
  // widget.selectComponent("qt.55.qtscript");
  // widget.selectComponent("qt.55.qtwebengine");
  // widget.selectComponent("qt.55.qtquickcontrols");
  // widget.selectComponent("qt.55.qtlocation");

  gui.clickButton(buttons.NextButton);
}

Controller.prototype.LicenseAgreementPageCallback = function() {
  gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.StartMenuDirectoryPageCallback = function() {
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.ReadyForInstallationPageCallback = function()
{
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.FinishedPageCallback = function() {
  var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm
  if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
    checkBoxForm.launchQtCreatorCheckBox.checked = false;
  }
  gui.clickButton(buttons.FinishButton);
}

棘手的部分是找到 id的组件!我找到了正确的 ID qt.55.win64_msvc2013_64通过添加标志 --verbose并使用UI正常安装并在最后一页停止;所有的ids你选择安装的就在那里。

answer 中的信息略多如果您需要更多详细信息。

编辑 (29-11-2017) : 安装人员 3.0.2-online ,“欢迎”页面中的“下一步”按钮禁用 1 秒,因此您必须添加延迟
gui.clickButton(buttons.NextButton, 3000);

编辑 (10-11-2019) : 见 Joshua Wade's answer更多陷阱和陷阱,如“用户数据收集”表单和“存档”和“最新版本”复选框。

关于qt - 如何从 Cygwin 的命令行安装 Qt 5.2.1?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23564377/

相关文章:

c++ - qt从U盘读取数据

c++ - 使用迭代器构造 QVector 对象

mysql - Qt 的 odbc 驱动程序不支持 mysql 的 LastInsertId,解决方法是什么?

java - 从命令行运行 netbeans maven 项目

c#.net 32​​ 位应用程序不适用于 64 位操作系统

qt - 如何在 Qt 上实现提示对话框

excel - 从命令行或批处理文件运行 Excel 宏的方法?

windows - 在 Linux 上开发 Windows 应用程序?

r - 无法构建 R 包 "png"Fedora 20

node.js - 如何从命令行将脚本通过管道传输到 NodeJs?