From 5e5de4d0199e5fbdee51765b740ce99162ed140e Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 8 May 2024 21:25:48 +0800 Subject: [PATCH] try fix --- src/CMakeLists.txt | 32 ++++++++++++++++---------------- src/CPackLinuxDeployQt.cmake.in | 9 +++++---- src/Packaging.cmake | 20 +++++--------------- 3 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7728addca2..4b80ea2296 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -125,22 +125,22 @@ if (WIN32) elseif(APPLE) else() - desktop.path = applications - desktop.files = data/core/vnote.desktop - icon16.path = icons/hicolor/16x16/apps - icon16.files = data/core/logo/16x16/vnote.png - icon32.path = icons/hicolor/32x32/apps - icon32.files = data/core/logo/32x32/vnote.png - icon48.path = icons/hicolor/48x48/apps - icon48.files = data/core/logo/48x48/vnote.png - icon64.path = icons/hicolor/64x64/apps - icon64.files = data/core/logo/64x64/vnote.png - icon128.path = icons/hicolor/128x128/apps - icon128.files = data/core/logo/128x128/vnote.png - icon256.path = icons/hicolor/256x256/apps - icon256.files = data/core/logo/256x256/vnote.png - iconsvg.path = icons/hicolor/scalable/apps - iconsvg.files = data/core/logo/vnote.svg + set(desktop.path applications) + set(desktop.files data/core/vnote.desktop) + set(icon16.path icons/hicolor/16x16/apps) + set(icon16.files data/core/logo/16x16/vnote.png) + set(icon32.path icons/hicolor/32x32/apps) + set(icon32.files data/core/logo/32x32/vnote.png) + set(icon48.path icons/hicolor/48x48/apps) + set(icon48.files data/core/logo/48x48/vnote.png) + set(icon64.path icons/hicolor/64x64/apps) + set(icon64.files data/core/logo/64x64/vnote.png) + set(icon128.path icons/hicolor/128x128/apps) + set(icon128.files data/core/logo/128x128/vnote.png) + set(icon256.path icons/hicolor/256x256/apps) + set(icon256.files data/core/logo/256x256/vnote.png) + set(iconsvg.path icons/hicolor/scalable/apps) + set(iconsvg.files data/core/logo/vnote.svg) foreach(items IN ITEMS desktop icon16 icon32 icon48 icon64 icon128 icon256 iconsvg) install(FILES ${CMAKE_CURRENT_LIST_DIR}/${${items}.files} DESTINATION share/${${items}.path} diff --git a/src/CPackLinuxDeployQt.cmake.in b/src/CPackLinuxDeployQt.cmake.in index 47263f471c..485b6d9367 100644 --- a/src/CPackLinuxDeployQt.cmake.in +++ b/src/CPackLinuxDeployQt.cmake.in @@ -1,8 +1,9 @@ -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") +message(STATUS "VX_APPIMAGE_DEST_DIR ${VX_APPIMAGE_DEST_DIR}") +message(STATUS "VX_APPIMAGE_DESKTOP_FILE ${VX_APPIMAGE_DESKTOP_FILE}") + execute_process( - COMMAND ${CMAKE_MAKE_PROGRAM} DESTDIR="${VX_DEST_DIR}" install + COMMAND ${CMAKE_MAKE_PROGRAM} DESTDIR=${VX_APPIMAGE_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}" + COMMAND env QMAKE=${qmake_executable} "${LINUXDEPLOY_EXECUTABLE}" --plugin=qt --output=appimage --appdir=${VX_APPIMAGE_DEST_DIR} -e ${CMAKE_CURRENT_BINARY_DIR}/vnote -d ${VX_APPIMAGE_DESKTOP_FILE} WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}) diff --git a/src/Packaging.cmake b/src/Packaging.cmake index 7cbad623ac..38ee144707 100644 --- a/src/Packaging.cmake +++ b/src/Packaging.cmake @@ -15,17 +15,6 @@ find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}") 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) # Bundle Library Files string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER) @@ -38,8 +27,6 @@ function(windeployqt target) endif() endif() - message(INFO " debug: windeployqt:${WINDEPLOYQT_EXECUTABLE}") - add_custom_target(deploy COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/winqt/" COMMAND "${CMAKE_COMMAND}" -E @@ -68,10 +55,10 @@ function(windeployqt target) cmake_path(NORMAL_PATH OPENSSL_LIBS_FILES OUTPUT_VARIABLE OPENSSL_LIBS_FILES) install(FILES ${OPENSSL_LIBS_FILES} DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) - message(INFO " debug: OpenSSLExtraLIBDIR:${OPENSSL_EXTRA_LIB_DIR}") + message(STATUS "OpenSSLExtraLIBDIR:${OPENSSL_EXTRA_LIB_DIR}") file(GLOB OPENSSL_EXTRA_LIB_FILES "${OPENSSL_EXTRA_LIB_DIR}/lib*.dll") cmake_path(NORMAL_PATH OPENSSL_EXTRA_LIB_FILES OUTPUT_VARIABLE OPENSSL_EXTRA_LIB_FILES) - message(INFO " debug: OpenSSLExtraLibFiles:${OPENSSL_EXTRA_LIB_FILES}") + message(STATUS "OpenSSLExtraLibFiles:${OPENSSL_EXTRA_LIB_FILES}") install(FILES ${OPENSSL_EXTRA_LIB_FILES} DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) @@ -132,10 +119,13 @@ if(WIN32) windeployqt(vnote) elseif(APPLE) else() + message(STATUS "LinuxDeployExecutable: ${LINUXDEPLOY_EXECUTABLE}") if(LINUXDEPLOY_EXECUTABLE) message(STATUS "Package generation - Linux - AppImage") set(CPACK_GENERATOR "External;${CPACK_GENERATOR}") + set(VX_APPIMAGE_DEST_DIR "${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/Linux/External/AppImage") + set(VX_APPIMAGE_DESKTOP_FILE "${VX_APPIMAGE_DEST_DIR}${CMAKE_INSTALL_PREFIX}/share/applications/vnote.desktop") 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()