1+ cmake_minimum_required (VERSION 3.1.0)
2+
3+ project (QtQuickControls2Application)
4+
5+ # Find includes in corresponding build directories
6+ set (CMAKE_INCLUDE_CURRENT_DIR ON )
7+ set (CMAKE_AUTOMOC ON )
8+ set (CMAKE_AUTOUIC ON )
9+ set (CMAKE_AUTORCC ON )
10+
11+ # Find the QtWidgets library
12+ find_package (Qt5Widgets CONFIG REQUIRED)
13+ find_package (Qt5Qml CONFIG REQUIRED)
14+
15+ add_executable (QtQuickControls2Application src/main.cpp src/qml.qrc)
16+ target_link_libraries (QtQuickControls2Application Qt5::Widgets Qt5::Qml)
17+
18+ install (TARGETS QtQuickControls2Application DESTINATION bin COMPONENT binaries)
19+ install (FILES QtQuickControls2Application.desktop DESTINATION share/applications/ COMPONENT desktop)
20+ install (FILES QtQuickControls2Application.svg DESTINATION share/icons/hicolor/scalable/apps/ COMPONENT desktop)
21+
22+ set (APP_NAME QtQuickControls2Application)
23+ set (APP_TARGET_ARCH x86_64)
24+ set (APP_DESKTOP_FILE_PATH AppDir/${CMAKE_INSTALL_PREFIX} /share/applications/QtQuickControls2Application.desktop)
25+ set (APP_ICON_FILE_PATH AppDir/${CMAKE_INSTALL_PREFIX} /share/icons/hicolor/scalable/apps/QtQuickControls2Application.svg)
26+
27+ set (ENV ARCH=${APP_TARGET_ARCH} )
28+ add_custom_target (AppImage
29+ COMMENT "Creating AppImage of ${APP_NAME} "
30+ COMMAND make install DESTDIR=AppDir
31+ COMMAND wget -nc https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-${APP_TARGET_ARCH} .AppImage
32+ COMMAND chmod +x ./linuxdeploy-${APP_TARGET_ARCH} .AppImage
33+ COMMAND export ARCH=${APP_TARGET_ARCH} USES_TERMINAL
34+ COMMAND ./linuxdeploy-${APP_TARGET_ARCH} .AppImage -n ${APP_NAME} --appdir AppDir --init-appdir -d ${APP_DESKTOP_FILE_PATH}
35+ -i ${APP_ICON_FILE_PATH} --output appimage
36+ )
0 commit comments