Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion cmake/PackagingLinux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,46 @@ set(APPDIR_USR ${APPDIR}/usr)
set(LINUXDEPLOY ${CMAKE_BINARY_DIR}/linuxdeploy-x86_64.AppImage)
set(LINUXDEPLOY_QT ${CMAKE_BINARY_DIR}/linuxdeploy-plugin-qt-x86_64.AppImage)

set(APPIMAGE_ENV_VARS
LDAI_OUTPUT=NotepadNext-v${PROJECT_VERSION}-x86_64.AppImage
)

if(DEFINED ENV{QMAKE} AND NOT "$ENV{QMAKE}" STREQUAL "")
set(APPIMAGE_QMAKE "$ENV{QMAKE}")
else()
find_program(APPIMAGE_QMAKE NAMES qmake)
endif()

if(NOT APPIMAGE_QMAKE)
message(FATAL_ERROR
"Could not find qmake for AppImage packaging.\n"
"Please install the QT 6 qmake or set the QMAKE variable to a Qt 6 qmake and re-run CMake, for example:\n"
" QMAKE=$(which qmake6) cmake -S . -B build -DAPP_DISTRIBUTION=AppImage"
)
endif()

execute_process(
COMMAND "${APPIMAGE_QMAKE}" -query QT_VERSION
OUTPUT_VARIABLE APPIMAGE_QT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
RESULT_VARIABLE APPIMAGE_QMAKE_RESULT
)

if(NOT APPIMAGE_QMAKE_RESULT EQUAL 0 OR NOT APPIMAGE_QT_VERSION MATCHES "^6\\.")
message(FATAL_ERROR
"AppImage packaging requires a Qt 6 qmake, but CMake found:\n"
" ${APPIMAGE_QMAKE}\n"
"Reported Qt version:\n"
" ${APPIMAGE_QT_VERSION}\n"
"Please set the QMAKE variable to a Qt 6 qmake and re-run CMake, for example:\n"
" QMAKE=$(which qmake6) cmake -S . -B build -DAPP_DISTRIBUTION=AppImage"
)
endif()

message(STATUS "Using qmake for AppImage packaging: ${APPIMAGE_QMAKE}")
list(APPEND APPIMAGE_ENV_VARS QMAKE=${APPIMAGE_QMAKE})

install(TARGETS NotepadNext
RUNTIME DESTINATION bin
)
Expand Down Expand Up @@ -40,7 +80,7 @@ add_custom_target(download_linuxdeploy

add_custom_target(appimage
COMMAND ${CMAKE_COMMAND} -E env
LDAI_OUTPUT=NotepadNext-v${PROJECT_VERSION}-x86_64.AppImage
${APPIMAGE_ENV_VARS}
${LINUXDEPLOY}
--appdir ${APPDIR}
--executable ${APPDIR_USR}/bin/NotepadNext
Expand Down