Skip to content

Commit 63de2fa

Browse files
committed
Complete working AppImage build succeded with these scripts … merging to master
2 parents 958b862 + 4f6a624 commit 63de2fa

File tree

4 files changed

+69
-3
lines changed

4 files changed

+69
-3
lines changed

CMakeLists.txt

+15-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ IF (CUSTOM_QT_PATH)
2929
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
3030
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
3131
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
32-
SET(CMAKE_PREFIX_PATH "${CUSTOM_QT_PATH}/cmake")
32+
SET(CMAKE_PREFIX_PATH "${CUSTOM_QT_PATH}/lib/cmake")
3333
ENDIF(CUSTOM_QT_PATH)
3434

3535
FIND_PACKAGE (Qt5 REQUIRED COMPONENTS Core Gui Widgets 3DCore 3DExtras 3DRender 3DInput)
@@ -54,6 +54,8 @@ ELSE( ${CMAKE_VERSION} VERSION_LESS 3.12.0 )
5454
ADD_COMPILE_DEFINITIONS (TOOKIT_VERSION="${TOOLKIT_VERSION}" INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/share/ORB/rbdl-toolkit")
5555
ENDIF( ${CMAKE_VERSION} VERSION_LESS 3.12.0 )
5656

57+
CONFIGURE_FILE(extra/mk_appimage.sh mk_appimage.sh)
58+
5759
QT5_WRAP_UI ( UI_SRC
5860
ui/Timeline.ui
5961
ui/ModelSelector.ui
@@ -124,6 +126,18 @@ TARGET_LINK_LIBRARIES ( rbdl-toolkit
124126
toolkitlib
125127
)
126128

129+
IF (CUSTOM_QT_PATH)
130+
ADD_CUSTOM_TARGET(appimage
131+
BYPRODUCTS rbdl-toolkit-x86_64.AppImage rbdl-toolkit.AppDir
132+
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/mk_appimage.sh -customqt
133+
)
134+
ELSE(CUSTOM_QT_PATH)
135+
ADD_CUSTOM_TARGET(appimage
136+
BYPRODUCTS rbdl-toolkit-x86_64.AppImage rbdl-toolkit.AppDir
137+
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/mk_appimage.sh
138+
)
139+
ENDIF(CUSTOM_QT_PATH)
140+
127141
INSTALL ( TARGETS rbdl-toolkit RUNTIME DESTINATION bin )
128142
INSTALL ( TARGETS toolkitlib RUNTIME DESTINATION lib )
129143

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ at version *5.13.2* other versions are not guaranteed to work, since Qt3D is
4949
at the moment subject to many changes!
5050

5151
Afterwards build *rbdl-toolkit* with cmake and adding the CUSTOM_QT_PATH variable set to
52-
your [QT_INSTALL_DIR]/[QT_VERSION]/[COMPILER]/lib.
52+
your [QT_INSTALL_DIR]/[QT_VERSION]/[COMPILER]. If you compiled QT yourself just set this
53+
variable to the -prefix you used for the compile/install.
54+
5355
For me that looked like this:
5456

5557
```code
56-
cmake -DCUSTOM_QT_PATH=~/Qt5.13/5.13.2/gcc_64/lib ..
58+
cmake -DCUSTOM_QT_PATH=~/Qt5.13/5.13.2/gcc_64 ..
5759
make
5860
```
5961

extra/mk_appimage.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
customqt=false
4+
for arg in "$@"
5+
do
6+
if [ "$arg" == "-customqt" ]
7+
then
8+
customqt=true
9+
fi
10+
done
11+
12+
13+
# install application to appdir
14+
make install DESTDIR=rbdl-toolkit.AppDir
15+
16+
if (( $? )); then
17+
exit 1
18+
fi
19+
20+
# populate appdir with need libs
21+
linuxdeploy --appdir=rbdl-toolkit.AppDir -e rbdl-toolkit --deploy-deps-only=rbdl-toolkit.AppDir/usr/local/share/ORB/rbdl-toolkit/plugins/librenderplugin.so -i ../extra/rbdl-toolkit.png --create-desktop-file
22+
23+
if (( $? )); then
24+
exit 1
25+
fi
26+
27+
# pull correct qt dependencies into appdir
28+
if [ "$customqt" == true ]
29+
then
30+
QMAKE=${CUSTOM_QT_PATH}/bin/qmake linuxdeploy-qt --appdir=rbdl-toolkit.AppDir -p libdefaultgeometryloader.so -p 3dquickrender
31+
else
32+
linuxdeploy-qt --appdir=rbdl-toolkit.AppDir
33+
fi
34+
35+
if (( $? )); then
36+
exit 1
37+
fi
38+
39+
#create AppImage
40+
appimagetool rbdl-toolkit.AppDir
41+
42+
exit 0

src/ToolkitApp.cc

+8
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,17 @@ ToolkitApp::ToolkitApp(QWidget *parent) {
8787

8888
//find application path important for plugin loading if running as AppImage
8989
auto app_dir = QDir(QCoreApplication::applicationDirPath());
90+
bool found = false;
9091
if (app_dir.cd("../share/ORB/rbdl-toolkit")) {
9192
std::cout << app_dir.absolutePath().toStdString() << std::endl;
9293
paths.prepend(app_dir.absolutePath());
94+
found = true;
95+
}
96+
97+
app_dir = QDir(QCoreApplication::applicationDirPath());
98+
if ( !found && app_dir.cd("../local/share/ORB/rbdl-toolkit")) {
99+
std::cout << app_dir.absolutePath().toStdString() << std::endl;
100+
paths.prepend(app_dir.absolutePath());
93101
}
94102

95103
if (env.contains(PATH_VAR)) {

0 commit comments

Comments
 (0)