Как установить Qt 5.2.1 из командной строки в 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
$
Как видно выше, я впервые загрузил Qt-пакет для Visual Studio в оболочку Cygwin Bash.
A sidenote: библиотека Qt, упакованная в Cygwin, не полезна для меня, потому что мне нужно использовать компилятор Visual Studio С++.
Сначала я установил правильные разрешения для файла
$ 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), но это не то, что я хочу, поскольку позже мне хотелось бы, чтобы процедура установки была записана в Bash script, который я мог бы запустить в Cygwin.
Если добавить параметр --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 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.
Я не знаю, как продолжить отсюда. Вы знаете, как я могу установить библиотеку Qt 5.2.1 (для Visual Studio) из оболочки Bash в Cygwin?
Обновление: Преимущество записи script для среды Cygwin заключается в том, что команды, такие как git, wget и scp. Этот qaru.site/info/221043/... описывает, как вызвать компилятор MSVC из Cygwin Bash script. Обратите внимание, что приложение Qt, которое я создаю, не будет иметь никакой зависимости от Cygwin.
Ответы
Ответ 1
Я не тестировал 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
компонентов! Мне удалось найти правильный идентификатор qt.55.win64_msvc2013_64
, добавив флаг --verbose
и установив его в обычном режиме с пользовательским интерфейсом и остановившись на последней странице; все ids
, которые вы выбрали для установки, находятся там.
В этом ответе есть немного больше информации, если вам нужна дополнительная информация.
ОБНОВЛЕНИЕ (29-11-2017): для установщика 3.0.2-online
кнопка "Далее" на странице "Добро пожаловать" отключена на 1 секунду, поэтому необходимо добавить задержку
gui.clickButton(buttons.NextButton, 3000);
ОБНОВЛЕНИЕ (10-11-2019): см. ответ джошуа Уэйда, чтобы узнать больше о ловушках и ловушках, таких как форма "Сбор данных пользователя", а также флажки "Архив" и "Последние выпуски".