Skip to content

Commit 1dd2c09

Browse files
Fabien-BFabien-B
authored andcommitted
[appimage] other way to make an appimage
1 parent 6585da2 commit 1dd2c09

File tree

7 files changed

+53
-33
lines changed

7 files changed

+53
-33
lines changed

.github/workflows/appimage.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,16 @@ jobs:
3232

3333
- name: build
3434
run: |
35-
cmake -S pprzgcs -B build.appimage/pprzgcs -DCMAKE_INSTALL_PREFIX="AppDir/usr"
36-
cmake --build build.appimage/pprzgcs -j$(nproc)
37-
cmake --install build.appimage/pprzgcs
38-
39-
- name: Build AppImage
40-
uses: paparazzi/build-appimage@master
41-
env:
42-
UPDATE_INFO: gh-releases-zsync|Fabien-B|PprzGCS|latest|*x86_64.AppImage.zsync
43-
with:
44-
recipe: pprzgcs/appimage-amd64.yml
35+
./pprzgcs/make_appimage.sh $(pwd)/build_appimage $(pwd)/pprzgcs
4536
- uses: actions/upload-artifact@v4
4637
with:
4738
name: AppImage_${{ env.PPRZGCS_VERSION }}
48-
path: './*.AppImage*'
39+
path: 'build_appimage/PprzGCS*.AppImage*'
40+
41+
- name: rename AppImage
42+
run: |
43+
find . -iname "*appimage*"
44+
mv ./build_appimage/PprzGCS-x86_64.AppImage PprzGCS_${{ env.PPRZGCS_VERSION }}-x86_64.AppImage
4945
5046
5147
- name: make release
@@ -54,6 +50,6 @@ jobs:
5450
repo_token: "${{ secrets.GITHUB_TOKEN }}"
5551
prerelease: false
5652
files: |
57-
*.AppImage
53+
'PprzGCS_${{ env.PPRZGCS_VERSION }}-x86_64.AppImage'
5854
5955

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ endif()
2626

2727
find_package(LibXml2 REQUIRED)
2828

29-
if(NOT DEFAULT_APP_DATA_PATH)
30-
set(DEFAULT_APP_DATA_PATH "/usr/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
31-
endif()
32-
message("DEFAULT_APP_DATA_PATH set to ${DEFAULT_APP_DATA_PATH}")
33-
add_definitions(-DDEFAULT_APP_DATA_PATH="${DEFAULT_APP_DATA_PATH}")
34-
3529
# Get current version
3630
execute_process(
3731
COMMAND ${CMAKE_SOURCE_DIR}/pprzgcs_version.sh

assets/org.paparazzi.pprzgcs.appdata.xml.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<name>PprzGCS</name>
66
<summary>Paparazzi UAV GCS</summary>
77
<launchable type="desktop-id">org.paparazzi.pprzgcs.desktop</launchable>
8-
<screenshots/>
98
<project_group>Paparazzi UAV</project_group>
109
<provides>
1110
<binary>pprzgcs</binary>

assets/org.paparazzi.pprzgcs.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Desktop Entry]
22
Name=PprzGCS
33
Comment=GCS for PaparazziUAV
4-
Exec=/usr/bin/pprzgcs
4+
Exec=pprzgcs
55
Terminal=false
66
Type=Application
77
Icon=pprzgcs

make_appimage.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#! /bin/bash
2+
set -x
3+
set -e
4+
5+
BUILD_DIR=$1
6+
REPO_ROOT=$2
7+
8+
mkdir -p "$BUILD_DIR"
9+
rm -rf "$BUILD_DIR/*"
10+
11+
# switch to build dir
12+
pushd "$BUILD_DIR"
13+
14+
# configure build files with CMake
15+
# we need to explicitly set the install prefix, as CMake's default is /usr/local for some reason...
16+
cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr
17+
18+
# build project and install files into AppDir
19+
cmake --build . -j $(nproc)
20+
make install DESTDIR=AppDir
21+
22+
# now, build AppImage using linuxdeploy and linuxdeploy-plugin-qt
23+
# download linuxdeploy and its Qt plugin
24+
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
25+
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
26+
27+
ln -s $(which qmake6) qmake
28+
export PATH="$(pwd):$PATH"
29+
30+
# make them executable
31+
chmod +x linuxdeploy*.AppImage
32+
33+
# initialize AppDir, bundle shared libraries for QtQuickApp, use Qt plugin to bundle additional resources, and build AppImage, all in one single command
34+
./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --output appimage

src/main.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
#include "speaker.h"
1919
#endif
2020

21-
#ifndef DEFAULT_APP_DATA_PATH
22-
#error "you need to define DEFAULT_APP_DATA_PATH!"
23-
#endif
24-
2521
#ifndef PPRZGCS_VERSION
2622
#error "you need to define PPRZGCS_VERSION!"
2723
#endif
@@ -130,8 +126,9 @@ int main(int argc, char *argv[])
130126

131127
auto data_path = QString(qgetenv("PPRZGCS_DATA_PATH"));
132128
if(data_path == "") {
133-
data_path = DEFAULT_APP_DATA_PATH;
129+
data_path = QCoreApplication::applicationDirPath() + "/../share/pprzgcs";
134130
}
131+
qDebug() << "DATA_PATH: " << data_path;
135132
gconfig->setValue("APP_DATA_PATH", data_path);
136133

137134
set_app_settings();

src/widgets/map/mapwidget.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -679,12 +679,12 @@ bool MapWidget::viewportEvent(QEvent *event) {
679679
QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints();
680680

681681
for(auto &touchPoint: touchPoints) {
682-
if(touchPoint.state() == Qt::TouchPointPressed) {
683-
auto scenePos = mapToScene(touchPoint.pos().toPoint());
682+
if(touchPoint.state() == QEventPoint::State::Pressed) {
683+
auto scenePos = mapToScene(touchPoint.position().toPoint());
684684
auto tp = tilePoint(scenePos, zoomLevel(zoom()), tileSize());
685685
pms[touchPoint.id()] = Point2DPseudoMercator(tp);
686686
}
687-
else if(touchPoint.state() == Qt::TouchPointReleased && pms.contains(touchPoint.id())) {
687+
else if(touchPoint.state() == QEventPoint::State::Released && pms.contains(touchPoint.id())) {
688688
pms.remove(touchPoint.id());
689689
}
690690
}
@@ -703,7 +703,7 @@ bool MapWidget::viewportEvent(QEvent *event) {
703703
return true;
704704
}
705705

706-
auto px_dist = QVector2D(tp1->pos() - tp0->pos()).length();
706+
auto px_dist = QVector2D(tp1->position() - tp0->position()).length();
707707

708708
for(int zo=0; zo<25; zo++) {
709709
auto pt1 = scenePoint(pms[id0], zo, tileSize());
@@ -714,18 +714,18 @@ bool MapWidget::viewportEvent(QEvent *event) {
714714
double s = px_dist/dist;
715715
double new_zoom = zo + log2(s);
716716

717-
auto center = (tp1->pos() + tp0->pos())/2;
717+
auto center = (tp1->position() + tp0->position())/2;
718718
auto pmc = (pms[id0] + pms[id1])/2;
719719
zoomCenteredScene(new_zoom, center.toPoint(), pmc);
720720
updateGraphics(UpdateEvent::MAP_ZOOMED|UpdateEvent::MAP_MOVED|UpdateEvent::MAP_ROTATED);
721721
break;
722722
}
723723
}
724724
return true;
725-
} else if(touchPoints.count() == 1 && touchPoints.first().state() == Qt::TouchPointMoved) {
725+
} else if(touchPoints.count() == 1 && touchPoints.first().state() == QEventPoint::State::Updated) {
726726
//Pan only
727727
auto pm = pms[touchPoints.first().id()];
728-
auto pos = touchPoints.first().pos().toPoint();
728+
auto pos = touchPoints.first().position().toPoint();
729729
zoomCenteredScene(zoom(), pos, pm);
730730
return true;
731731
}
@@ -807,7 +807,7 @@ void MapWidget::dropEvent(QDropEvent *event) {
807807
scale,
808808
};
809809

810-
Papget* papget = new Papget(datadef, event->pos());
810+
Papget* papget = new Papget(datadef, event->position().toPoint());
811811
scene()->addItem(papget);
812812
papget->setZValue(1000);
813813
papgets.append(papget);

0 commit comments

Comments
 (0)