Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tamlok committed May 7, 2024
1 parent 448b656 commit 2f161f0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ if (WIN32)
DESTINATION ${CMAKE_INSTALL_BINDIR})
elseif(APPLE)

elseif(UNIX)
else()
desktop.path = applications
desktop.files = data/core/vnote.desktop
icon16.path = icons/hicolor/16x16/apps
Expand Down
11 changes: 7 additions & 4 deletions src/CPackLinuxDeployQt.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
set(VX_DEST_DIR "${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/Linux/External/AppImage")
set(VX_DESKTOP_FILE "${VX_DEST_DIR}${CMAKE_INSTALL_PREFIX}/share/applications/vnote.desktop")
execute_process(
COMMAND ${CMAKE_MAKE_PROGRAM} DESTDIR=${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/Linux/External/AppImage install
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
execute_process(COMMAND env QMAKE=${qmake_executable} "${LINUXDEPLOY_EXECUTABLE}" --plugin=qt --output=appimage --appdir=${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/Linux/External/AppImage -e ${CMAKE_BINARY_DIR}/${target} -d ${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/Linux/External/AppImage${CMAKE_INSTALL_PREFIX}/share/applications/example.desktop
WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY})
COMMAND ${CMAKE_MAKE_PROGRAM} DESTDIR="${VX_DEST_DIR}" install
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
execute_process(
COMMAND env QMAKE=${qmake_executable} "${LINUXDEPLOY_EXECUTABLE}" --plugin=qt --output=appimage --appdir="${VX_DEST_DIR}" -e ${CMAKE_BINARY_DIR}/${target} -d "${VX_DESKTOP_FILE}"
WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY})
23 changes: 20 additions & 3 deletions src/Packaging.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# from: https://github.com/miurahr/cmake-qt-packaging-example

find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS Core)

get_target_property(QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
Expand All @@ -17,7 +16,14 @@ find_program(MACDEPLOYQTFIX_EXECUTABLE macdeployqtfix.py HINTS "${QT_BIN_DIR}")
find_package(Python)

function(linuxdeployqt dest_dir desktop_file)

add_custom_command(
TARGET pack PRE_BUILD
COMMAND "${CMAKE_MAKE_PROGRAM}" DESTDIR=${dest_dir} install
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_command(
TARGET pack POST_BUILD
COMMAND env QMAKE=${qmake_executable} "${LINUXDEPLOY_EXECUTABLE}" --appdir=${dest_dir} --plugin=qt --output=appimage -e ${CMAKE_BINARY_DIR}/${target} -d ${destdir}/${CMAKE_INSTALL_PREFIX}/${desktopfile}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endfunction()

function(windeployqt target)
Expand Down Expand Up @@ -110,7 +116,7 @@ add_custom_target(pack
DEPENDS vnote)
set(CPACK_GENERATOR)

if (WIN32)
if(WIN32)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}" DOC "Path to the windeployqt utility")

list(APPEND CPACK_GENERATOR ZIP)
Expand All @@ -124,6 +130,17 @@ if (WIN32)
endif()

windeployqt(vnote)
elseif(APPLE)
else()
if(LINUXDEPLOY_EXECUTABLE)
message(STATUS "Package generation - Linux - AppImage")

set(CPACK_GENERATOR "External;${CPACK_GENERATOR}")
configure_file(${CMAKE_CURRENT_LIST_DIR}/CPackLinuxDeployQt.cmake.in "${CMAKE_BINARY_DIR}/CPackExternal.cmake")
set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_BINARY_DIR}/CPackExternal.cmake")
endif()

set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/logo/64x64/vnote.png")
endif()

include(CPack)

0 comments on commit 2f161f0

Please sign in to comment.