Browse Source

Qt module project structure (#124)

Refactor the project structure to make it build as a "Qt module". It's a first step to get this tool closer to Qt.

The main advantage here is: Simply running:
```
qmake
make
make install
```

will compile and install the tool into your Qt installation, and make it a part of your Qt just like any other tool (qmake, etc.)
master
Felix Barz 7 years ago
committed by probonopd
parent
commit
93ba2f186e
  1. 5
      .qmake.conf
  2. 8
      BUILDING.md
  3. 3
      linuxdeployqt.pro
  4. 2
      linuxdeployqt/linuxdeployqt.pro
  5. 1
      src/src.pro
  6. 5
      sync.profile
  7. 4
      tests/tests-ci.sh
  8. 11
      tests/tests.pro
  9. 17
      tools/linuxdeployqt/linuxdeployqt.pro
  10. 6
      tools/linuxdeployqt/main.cpp
  11. 0
      tools/linuxdeployqt/shared.cpp
  12. 0
      tools/linuxdeployqt/shared.h
  13. 4
      tools/tools.pro

5
.qmake.conf

@ -0,0 +1,5 @@
load(qt_build_config)
CONFIG += warning_clean exceptions
MODULE_VERSION = 0.5.0

8
BUILDING.md

@ -12,10 +12,16 @@ git clone https://github.com/probonopd/linuxdeployqt.git
# Then build in Qt Creator, or use # Then build in Qt Creator, or use
export PATH=$(readlink -f /tmp/.mount_QtCreator-*-x86_64/*/gcc_64/bin/):$PATH export PATH=$(readlink -f /tmp/.mount_QtCreator-*-x86_64/*/gcc_64/bin/):$PATH
cd linuxdeployqt cd linuxdeployqt
qmake linuxdeployqt.pro qmake
make make
``` ```
* Optional if you want to install `linuxdeployqt` into your Qt installation, and make it a part of your Qt just like any other tool (qmake, etc.)
```
sudo make install
```
* Build and install [patchelf](https://nixos.org/patchelf.html) (a small utility to modify the dynamic linker and RPATH of ELF executables; similar to `install_name_tool` on macOS). To learn more about this, see http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/ * Build and install [patchelf](https://nixos.org/patchelf.html) (a small utility to modify the dynamic linker and RPATH of ELF executables; similar to `install_name_tool` on macOS). To learn more about this, see http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/
``` ```

3
linuxdeployqt.pro

@ -1,2 +1 @@
TEMPLATE = subdirs load(qt_parts)
SUBDIRS = linuxdeployqt

2
linuxdeployqt/linuxdeployqt.pro

@ -1,2 +0,0 @@
QT = core
SOURCES += main.cpp ../shared/shared.cpp

1
src/src.pro

@ -0,0 +1 @@
TEMPLATE = aux

5
sync.profile

@ -0,0 +1,5 @@
%modules = (
);
%moduleheaders = (
);

4
tests/tests-ci.sh

@ -10,8 +10,8 @@ mkdir -p linuxdeployqt.AppDir/usr/bin/
cp /usr/bin/patchelf /usr/local/bin/{appimagetool,mksquashfs,zsyncmake} linuxdeployqt.AppDir/usr/bin/ cp /usr/bin/patchelf /usr/local/bin/{appimagetool,mksquashfs,zsyncmake} linuxdeployqt.AppDir/usr/bin/
find linuxdeployqt.AppDir/ find linuxdeployqt.AppDir/
export VERSION=continuous export VERSION=continuous
cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/ cp ./bin/linuxdeployqt linuxdeployqt.AppDir/usr/bin/
./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt.desktop -verbose=3 -appimage ./bin/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt.desktop -verbose=3 -appimage
ls -lh ls -lh
find *.AppDir find *.AppDir
xpra start :99 xpra start :99

11
tests/tests.pro

@ -0,0 +1,11 @@
TEMPLATE = subdirs
SUBDIRS += \
QtQuickControls2Application \
QtWebEngineApplication \
QtWidgetsApplication
DISTFILES += \
tests-ci.sh \
tests-environment.sh \
tests.sh

17
tools/linuxdeployqt/linuxdeployqt.pro

@ -0,0 +1,17 @@
option(host_build)
QT = core
CONFIG += console
TARGET = linuxdeployqt
VERSION = $$MODULE_VERSION
DEFINES += BUILD_LINUXDEPLOYQT
load(qt_tool)
HEADERS += shared.h
SOURCES += main.cpp \
shared.cpp
DEFINES -= QT_USE_QSTRINGBUILDER #leads to compile errors if not disabled

6
linuxdeployqt/main.cpp → tools/linuxdeployqt/main.cpp

@ -28,7 +28,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QProcessEnvironment> #include <QProcessEnvironment>
#include "../shared/shared.h" #include "shared.h"
#include <QRegularExpression> #include <QRegularExpression>
#include <stdlib.h> #include <stdlib.h>
#include <QSettings> #include <QSettings>
@ -146,7 +146,7 @@ int main(int argc, char **argv)
// Allow binaries next to linuxdeployqt to be found; this is useful for bundling // Allow binaries next to linuxdeployqt to be found; this is useful for bundling
// this application itself together with helper binaries such as patchelf // this application itself together with helper binaries such as patchelf
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString oldPath = env.value("PATH"); QString oldPath = env.value("PATH");
QString newPath = QCoreApplication::applicationDirPath() + ":" + oldPath; QString newPath = QCoreApplication::applicationDirPath() + ":" + oldPath;
LogDebug() << newPath; LogDebug() << newPath;
setenv("PATH",newPath.toUtf8().constData(),1); setenv("PATH",newPath.toUtf8().constData(),1);
@ -306,7 +306,7 @@ int main(int argc, char **argv)
qDebug() << "preExistingToplevelIcon:" << preExistingToplevelIcon; qDebug() << "preExistingToplevelIcon:" << preExistingToplevelIcon;
} else { } else {
qDebug() << "iconToBeUsed:" << iconToBeUsed; qDebug() << "iconToBeUsed:" << iconToBeUsed;
QString targetIconPath = appDirPath + "/" + QFileInfo(iconToBeUsed).fileName(); QString targetIconPath = appDirPath + "/" + QFileInfo(iconToBeUsed).fileName();
if (QFile::copy(iconToBeUsed, targetIconPath)){ if (QFile::copy(iconToBeUsed, targetIconPath)){
qDebug() << "Copied" << iconToBeUsed << "to" << targetIconPath; qDebug() << "Copied" << iconToBeUsed << "to" << targetIconPath;
QFile::copy(targetIconPath, appDirPath + "/.DirIcon"); QFile::copy(targetIconPath, appDirPath + "/.DirIcon");

0
shared/shared.cpp → tools/linuxdeployqt/shared.cpp

0
shared/shared.h → tools/linuxdeployqt/shared.h

4
tools/tools.pro

@ -0,0 +1,4 @@
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += linuxdeployqt
Loading…
Cancel
Save