Skip to content

Commit

Permalink
#4 qt installer defs + batch scripts for Windows installer builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Davis committed Mar 8, 2020
1 parent 6036e33 commit a576cf1
Show file tree
Hide file tree
Showing 12 changed files with 218 additions and 0 deletions.
2 changes: 2 additions & 0 deletions installer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages/com.github.mstrthealias/data/*
TFCtrlInstaller.exe
15 changes: 15 additions & 0 deletions installer/config/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>Teensy Fan Controller</Name>
<Version>0.1.0.0</Version>
<Title>Teensy Fan Controller</Title>
<Publisher>mstrthealias</Publisher>
<ProductUrl>https://github.com/mstrthealias/TeensyFanController</ProductUrl>
<!-- Directory name is used in component.xml -->
<StartMenuDir>Teensy Fan Controller</StartMenuDir>
<TargetDir>@ApplicationsDirX64@/TeensyFanController</TargetDir>
<Logo>installerlogo.png</Logo>
<InstallerWindowIcon>installericon</InstallerWindowIcon>
<InstallerApplicationIcon>installericon</InstallerApplicationIcon>
<WizardStyle>Modern</WizardStyle>
</Installer>
Binary file added installer/config/installericon.ico
Binary file not shown.
Binary file added installer/config/installerlogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions installer/packages/com.github.mstrthealias/meta/installscript.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the FOO module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

function Component()
{
installer.installationFinished.connect(this, Component.prototype.installationFinishedPageIsShown);
installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
}

Component.prototype.createOperations = function()
{
// call default implementation to actually install README.txt!
component.createOperations();

if (systemInfo.productType === "windows") {
component.addOperation("CreateShortcut", "@TargetDir@/tfctrl.exe", "@StartMenuDir@/Teensy Fan Controller.lnk",
"workingDirectory=@TargetDir@", "iconId=2", "description=Launch Teensy Fan Controller configuration");

try {
if(systemInfo.currentCpuArchitecture.search("64") < 0) {
//x86
console.log('UNSUPPORTED x86');
} else {
//x64
component.addOperation("Execute", "@TargetDir@/vc_redist.x64.exe", "/install", "/passive", "/norestart");
}
} catch(e) {
console.log(e);
}
}
}

Component.prototype.installationFinishedPageIsShown = function()
{
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
installer.addWizardPageItem( component, "LaunchCheckBoxForm", QInstaller.InstallationFinished );
}
} catch(e) {
console.log(e);
}
}

Component.prototype.installationFinished = function()
{
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
var isLaunchCheckBoxChecked = component.userInterface( "LaunchCheckBoxForm" ).launchCheckBox.checked;
if (isLaunchCheckBoxChecked) {
QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/tfctrl.exe");
}
}
} catch(e) {
console.log(e);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LaunchCheckBoxForm</class>
<widget class="QWidget" name="LaunchCheckBoxForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>412</width>
<height>179</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="launchCheckBox">
<property name="text">
<string>Launch Teensy Fan Controller</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
14 changes: 14 additions & 0 deletions installer/packages/com.github.mstrthealias/meta/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package>
<DisplayName>Teensy Fan Controller</DisplayName>
<Description>tfctrl (Teensy Fan Controller)</Description>
<Name>com.github.mstrthealias</Name>
<Version>0.1.0.0</Version>
<ReleaseDate>2020-03-08</ReleaseDate>
<Default>true</Default>
<ForcedInstallation>true</ForcedInstallation>
<Script>installscript.qs</Script>
<UserInterfaces>
<UserInterface>launchcheckboxform.ui</UserInterface>
</UserInterfaces>
</Package>
13 changes: 13 additions & 0 deletions installer/tfctrl-installer.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
TEMPLATE = aux

INSTALLER = installer

INPUT = $$PWD/config/config.xml $$PWD/packages
example.input = INPUT
example.output = $$INSTALLER
example.commands = ../../bin/binarycreator -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT}
example.CONFIG += target_predeps no_link combine

QMAKE_EXTRA_COMPILERS += example

OTHER_FILES = README
15 changes: 15 additions & 0 deletions scripts/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@ECHO OFF
CALL scripts\env.bat

PATH=%PATH%;%QT_DIST_PATH%\%QT_BUILD%\bin

Echo Loading Visual Studio environment
CALL %VC_VARS_PATH%

ECHO Building Teensy Fan Controller

nmake clean
qmake -config release
nmake

ECHO Auild at .\release\
17 changes: 17 additions & 0 deletions scripts/deploy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@ECHO OFF
CALL scripts\env.bat

PATH=%PATH%;%QT_DIST_PATH%\%QT_BUILD%\bin

del /F /S /Q %INSTALL_DEST%\*
del /F /S /Q %INSTALL_DEST%\*.*

mkdir %INSTALL_DEST%
copy release\tfctrl.exe %INSTALL_DEST%\
copy release\tfctrl_resource.rc %INSTALL_DEST%\

ECHO Creating application deployment
windeployqt --compiler-runtime --qmldir . --release .\%INSTALL_DEST%\


ECHO Application deployed to %INSTALL_DEST%
12 changes: 12 additions & 0 deletions scripts/env.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@ECHO OFF

SET QT_PATH=C:\shared\Qt
SET QT_DIST_PATH=C:\shared\Qt\5.13.2
SET QT_BUILD=msvc2017_64

SET INSTALL_DEST=.\installer\packages\com.github.mstrthealias\data\


SET VC_VARS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

SET SIGN_TOOL="C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe"
14 changes: 14 additions & 0 deletions scripts/installer.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@ECHO OFF
CALL scripts\env.bat

PATH=%PATH%;%QT_DIST_PATH%\%QT_BUILD%\bin;%QT_PATH%\tools\QtInstallerFramework\3.2\bin

cd installer

ECHO Building installer
binarycreator --offline-only -c config/config.xml -p packages TFCtrlInstaller

cd ..


ECHO Installer available at .\installer\TFCtrlInstaller.exe

0 comments on commit a576cf1

Please sign in to comment.