try fix macOS CI (#2499)

This commit is contained in:
Le Tan 2024-05-23 08:09:41 -07:00 committed by GitHub
parent f5b69b73cf
commit 898c82ec8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 148 additions and 118 deletions

View File

@ -58,6 +58,7 @@ jobs:
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libfcitx5-qt-dev fcitx-libs-dev extra-cmake-modules libxkbcommon-dev sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libfcitx5-qt-dev fcitx-libs-dev extra-cmake-modules libxkbcommon-dev
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tree sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tree
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y fuse libxcb-cursor-dev sudo DEBIAN_FRONTEND=noninteractive apt-get install -y fuse libxcb-cursor-dev
python3 -m pip config set global.break-system-packages true
- name: Cache Qt - name: Cache Qt
id: cache-qt id: cache-qt

View File

@ -8,27 +8,31 @@ on:
# Allows you to run this workflow manually from the Actions tab. # Allows you to run this workflow manually from the Actions tab.
workflow_dispatch: workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled'
required: false
default: false
env: env:
VNOTE_VER: 3.17.0 VNOTE_VER: 3.17.0
CMAKE_VER: 3.24.3
jobs: jobs:
build: build:
name: Build On MacOS name: Build On MacOS
runs-on: macos-latest
timeout-minutes: 120 timeout-minutes: 120
strategy: strategy:
fail-fast: false
matrix: matrix:
config: config:
# - { - name: "Build on Arm64"
# name: "Build Qt 5.12", os: macos-latest
# qt: 5.12.12 arch: universal
# }
- { runs-on: ${{matrix.config.os}}
name: "Build Qt 5.15",
qt: 5.15.2
}
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE. # Checks-out your repository under $GITHUB_WORKSPACE.
@ -44,7 +48,24 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
run: | run: |
brew install tree brew install tree libiodbc libpq
- name: Fix SQL
if: ${{matrix.config.arch == 'universal'}}
run: |
sudo mkdir -p /usr/local/opt/libiodbc/lib
sudo ln -s /opt/homebrew/opt/libiodbc/lib/libiodbc.2.dylib /usr/local/opt/libiodbc/lib/libiodbc.2.dylib
sudo mkdir -p /Applications/Postgres.app/Contents/Versions/14/lib
sudo ln -s /opt/homebrew/Cellar/libpq/16.3/lib/libpq.5.dylib /Applications/Postgres.app/Contents/Versions/14/lib/libpq.5.dylib
- name: Install a fresh CMake
run: |
wget --no-verbose https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-macos-universal.tar.gz
tar xzf cmake-${CMAKE_VER}-macos-universal.tar.gz
sudo rm -f /usr/local/bin/cmake /usr/local/bin/cpack
sudo ln -s ${{runner.workspace}}/cmake-${CMAKE_VER}-macos-universal/CMake.app/Contents/bin/cmake /usr/local/bin/cmake
sudo ln -s ${{runner.workspace}}/cmake-${CMAKE_VER}-macos-universal/CMake.app/Contents/bin/cpack /usr/local/bin/cpack
working-directory: ${{runner.workspace}}
- name: Install macdeployqtfix - name: Install macdeployqtfix
run: | run: |
@ -56,17 +77,15 @@ jobs:
uses: actions/cache@v1 # not v2! uses: actions/cache@v1 # not v2!
with: with:
path: ../Qt path: ../Qt
key: ${{ runner.os }}-QtCache-${{ matrix.config.qt }} key: ${{ runner.os }}-QtCache-6.5
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
with: with:
version: ${{ matrix.config.qt }} version: 6.5.3
target: desktop target: desktop
modules: qtwebengine modules: 'qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat qtserialport'
cached: ${{ steps.cache-qt.outputs.cache-hit }} cache: 'true'
setup-python: 'false'
- name: Create Build Dir - name: Create Build Dir
run: mkdir build run: mkdir build
@ -75,77 +94,28 @@ jobs:
- name: Configure Project - name: Configure Project
run: | run: |
qmake -v qmake -v
qmake CONFIG+=release ${GITHUB_WORKSPACE}/vnote.pro cmake --version
cmake -DMACDEPLOYQTFIX_EXECUTABLE=${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ${GITHUB_WORKSPACE}
working-directory: ${{runner.workspace}}/build working-directory: ${{runner.workspace}}/build
- name: Build Project - name: Build Project
run: make -j4
working-directory: ${{runner.workspace}}/build
- name: Deploy VSyntaxHighlighting Framework
run: | run: |
my_lib_name=VSyntaxHighlighting cmake --build . --target pack
my_lib_framework=${my_lib_name}.framework ls -ls .
my_lib_dir=./libs/vtextedit/src/libs/syntax-highlighting ls -ls src
frameworks_dir=./src/vnote.app/Contents/Frameworks mv src/vnote.dmg VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg
mkdir -p ${frameworks_dir}
cp -R ${my_lib_dir}/${my_lib_framework} ${frameworks_dir}
working-directory: ${{runner.workspace}}/build working-directory: ${{runner.workspace}}/build
- name: Deploy VTextEdit Framework # Enable tmate debugging of manually-triggered workflows if the input option was provided
run: | - name: Setup tmate session
my_lib_name=VTextEdit uses: mxschmitt/action-tmate@v3
my_lib_framework=${my_lib_name}.framework if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
my_lib_dir=./libs/vtextedit/src/editor
frameworks_dir=./src/vnote.app/Contents/Frameworks
mkdir -p ${frameworks_dir}
cp -R ${my_lib_dir}/${my_lib_framework} ${frameworks_dir}
working-directory: ${{runner.workspace}}/build
- name: Cleanup rpath
run: |
app_target=./src/vnote.app/Contents/MacOS/vnote
install_name_tool -delete_rpath ${PWD}/src/../libs/vtextedit/src/editor ${app_target}
install_name_tool -delete_rpath ${PWD}/src/../libs/vtextedit/src/libs/syntax-highlighting ${app_target}
working-directory: ${{runner.workspace}}/build
- name: Mac Deploy
run: |
pushd src
macdeployqt vnote.app
# Remove unused sql drivers
rm vnote.app/Contents/Plugins/sqldrivers/libqsqlodbc.dylib
rm vnote.app/Contents/Plugins/sqldrivers/libqsqlpsql.dylib
python ${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py vnote.app/Contents/MacOS/vnote $Qt5_Dir
# Fix Helpers/QtWebEngineProcess.app
pushd vnote.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/5/Helpers
python ${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess $Qt5_Dir
popd
popd
tree ./
working-directory: ${{runner.workspace}}/build
- name: Package Project
run: |
mkdir -p distrib/vnote
pushd distrib/vnote
mv ../../src/vnote.app ./
ln -s /Applications ./Applications
popd
sleep 60
hdiutil create -srcfolder ./distrib/vnote -format UDBZ vnote-mac-x64_v${{env.VNOTE_VER}}.dmg
cp vnote-mac-x64_v${{env.VNOTE_VER}}.dmg vnote-mac-x64-qt${{matrix.config.qt}}.dmg
mv vnote-mac-x64_v${{env.VNOTE_VER}}.dmg vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.dmg
working-directory: ${{runner.workspace}}/build
- name: Archive Artifacts - name: Archive Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}} name: VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}
path: ${{runner.workspace}}/build/vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.dmg path: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg
- name: Update Tag - name: Update Tag
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
@ -158,7 +128,7 @@ jobs:
uses: johnwbyrd/update-release@v1.0.0 uses: johnwbyrd/update-release@v1.0.0
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
files: ${{runner.workspace}}/build/vnote-mac-x64-qt${{matrix.config.qt}}.dmg files: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg
release: Continuous Build release: Continuous Build
tag: continuous-build tag: continuous-build
@ -167,7 +137,7 @@ jobs:
uses: ncipollo/release-action@v1.11.0 uses: ncipollo/release-action@v1.11.0
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ${{runner.workspace}}/build/vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.dmg artifacts: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg
commit: master commit: master
tag: v${{env.VNOTE_VER}} tag: v${{env.VNOTE_VER}}
allowUpdates: true allowUpdates: true

View File

@ -28,14 +28,14 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
config: config:
- name: "Build On Win64 Qt 5.15" - name: "Build on Win64 Qt 5.15"
arch: win64_msvc2019_64 arch: win64_msvc2019_64
qt: 5.15.2 qt: 5.15.2
qt_modules: qtwebengine qt_modules: qtwebengine
qt_tools: tools_opensslv3_x64 qt_tools: tools_opensslv3_x64
qt_major: 5 qt_major: 5
suffix: "-windows7" suffix: "-windows7"
- name: "Build On Win64 Qt 6.5" - name: "Build on Win64 Qt 6.5"
arch: win64_msvc2019_64 arch: win64_msvc2019_64
qt: 6.5.3 qt: 6.5.3
qt_modules: "qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat" qt_modules: "qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat"

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ aqtinstall.log
tags tags
CMakeLists.txt.user CMakeLists.txt.user
build build
.DS_Store

View File

@ -1,4 +1,7 @@
cmake_minimum_required (VERSION 3.20) cmake_minimum_required (VERSION 3.20)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.1" CACHE STRING "Minimum OS X deployment version")
project(VNote project(VNote
VERSION 3.17.0 VERSION 3.17.0
DESCRIPTION "A pleasant note-taking platform" DESCRIPTION "A pleasant note-taking platform"

View File

@ -19,8 +19,11 @@ endif()
# Application icon on Windows # Application icon on Windows
set(VX_APP_ICON_RC_WIN data/core/icons/vnote.rc) set(VX_APP_ICON_RC_WIN data/core/icons/vnote.rc)
# Application icon on macOS # The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist
# generated by CMake. This variable contains the .icns file name,
# without the path.
set(MACOSX_BUNDLE_ICON_FILE vnote.icns) set(MACOSX_BUNDLE_ICON_FILE vnote.icns)
# And the following tells CMake where to find and install the file itself.
set(VX_APP_ICON_MACOS data/core/icons/vnote.icns) set(VX_APP_ICON_MACOS data/core/icons/vnote.icns)
set_source_files_properties(${VX_APP_ICON_MACOS} PROPERTIES set_source_files_properties(${VX_APP_ICON_MACOS} PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources") MACOSX_PACKAGE_LOCATION "Resources")
@ -39,19 +42,18 @@ add_custom_target(lrelease DEPENDS ${VX_QM_FILES})
# TODO: VTextEdit translations # TODO: VTextEdit translations
list(APPEND VX_QM_FILES list(APPEND VX_QM_FILES
data/core/translations/qdialogbuttonbox_zh_CN.qm ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qdialogbuttonbox_zh_CN.qm
data/core/translations/qtbase_ja.qm ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qtbase_ja.qm
data/core/translations/qtbase_zh_CN.qm ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qtbase_zh_CN.qm
data/core/translations/qtv_ja.qm ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qtv_ja.qm
data/core/translations/qtv_zh_CN.qm ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qtv_zh_CN.qm
data/core/translations/qwebengine_zh_CN.qm ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qwebengine_zh_CN.qm
) )
install(FILES ${VX_QM_FILES} DESTINATION "${CMAKE_INSTALL_BINDIR}/translations" OPTIONAL)
# Resources # Resources
set(VX_RESOURCE_FILES data/core/core.qrc) set(VX_RESOURCE_FILES data/core/core.qrc)
qt_add_binary_resources(VX_EXTRA_RESOURCE data/extra/extra.qrc DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/vnote_extra.rcc set(VX_EXTRA_RESOURCE_FILES_RCC ${CMAKE_CURRENT_BINARY_DIR}/vnote_extra.rcc)
OPTIONS -compress 9) qt_add_binary_resources(VX_EXTRA_RESOURCE data/extra/extra.qrc DESTINATION ${VX_EXTRA_RESOURCE_FILES_RCC} OPTIONS -compress 9)
add_executable(vnote WIN32 MACOSX_BUNDLE add_executable(vnote WIN32 MACOSX_BUNDLE
application.cpp application.h application.cpp application.h
@ -115,18 +117,37 @@ if(WIN32)
endif() endif()
# Installation # Installation
install(TARGETS vnote
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vnote_extra.rcc"
DESTINATION ${CMAKE_INSTALL_BINDIR})
if (WIN32) if (WIN32)
install(FILES "${PROJECT_SOURCE_DIR}/package/qt.conf" install(TARGETS vnote RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES "${PROJECT_SOURCE_DIR}/package/qt.conf" DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${VX_EXTRA_RESOURCE_FILES_RCC} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${VX_QM_FILES} DESTINATION "${CMAKE_INSTALL_BINDIR}/translations" OPTIONAL)
elseif(APPLE) elseif(APPLE)
set(CMAKE_MACOSX_RPATH ON)
# TODO: declare install for macOS if necessary. For packing, we will manually copy files into
# the src/vnote.app bundle.
# The generated Info.plist will be overridden.
set_target_properties(vnote
PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}"
MACOSX_BUNDLE_INFO_STRING "${PROJECT_DESCRIPTION}"
MACOSX_BUNDLE_GUI_IDENTIFIER "fun.vnote.app"
MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}"
MACOSX_BUNDLE_COPYRIGHT "Distributed under LGPL-3.0 license. Copyright (c) 2024 app.vnote.fun"
)
else() else()
install(TARGETS vnote
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# TODO: move them to data dir
install(FILES ${VX_EXTRA_RESOURCE_FILES_RCC} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${VX_QM_FILES} DESTINATION "${CMAKE_INSTALL_BINDIR}/translations" OPTIONAL)
set(desktop.path applications) set(desktop.path applications)
set(desktop.files data/core/vnote.desktop) set(desktop.files data/core/vnote.desktop)
set(icon16.path icons/hicolor/16x16/apps) set(icon16.path icons/hicolor/16x16/apps)
@ -143,9 +164,9 @@ else()
set(icon256.files data/core/logo/256x256/vnote.png) set(icon256.files data/core/logo/256x256/vnote.png)
set(iconsvg.path icons/hicolor/scalable/apps) set(iconsvg.path icons/hicolor/scalable/apps)
set(iconsvg.files data/core/logo/vnote.svg) set(iconsvg.files data/core/logo/vnote.svg)
foreach(items IN ITEMS desktop icon16 icon32 icon48 icon64 icon128 icon256 iconsvg) foreach(item IN ITEMS desktop icon16 icon32 icon48 icon64 icon128 icon256 iconsvg)
install(FILES ${CMAKE_CURRENT_LIST_DIR}/${${items}.files} install(FILES ${CMAKE_CURRENT_LIST_DIR}/${${item}.files}
DESTINATION share/${${items}.path} DESTINATION share/${${item}.path}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
endforeach() endforeach()
endif() endif()

View File

@ -0,0 +1,4 @@
execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}/vnote.app -dmg
-always-overwrite -verbose=1
WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}
)

View File

@ -46,10 +46,9 @@ function(windeployqt target)
COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/winqt/styles/" COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/winqt/styles/"
COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/winqt/qmltooling/" COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/winqt/qmltooling/"
COMMENT "Deploying Qt..." COMMENT "Deploying Qt..."
DEPENDS vnote DEPENDS vnote lrelease
) )
add_dependencies(deploy lrelease)
add_dependencies(pack deploy) add_dependencies(pack deploy)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/winqt/" DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/winqt/" DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
@ -102,13 +101,15 @@ set(CPACK_WIX_UI_DIALOG "${PROJECT_SOURCE_DIR}/package/wix_dialog.png")
set(CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/BundleConfig.cmake") set(CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/BundleConfig.cmake")
add_custom_target(pack add_custom_target(pack
COMMAND ${CMAKE_CPACK_COMMAND} "--config" "${CMAKE_BINARY_DIR}/BundleConfig.cmake" COMMAND ${CMAKE_CPACK_COMMAND} "--config" "${CMAKE_BINARY_DIR}/BundleConfig.cmake" "--verbose"
COMMENT "Running CPACK. Please wait..." COMMENT "Running CPACK. Please wait..."
DEPENDS vnote) DEPENDS vnote)
add_dependencies(pack lrelease) add_dependencies(pack lrelease)
set(CPACK_GENERATOR) set(CPACK_GENERATOR)
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/logo/64x64/vnote.png")
if(WIN32) if(WIN32)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}" DOC "Path to the windeployqt utility") find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}" DOC "Path to the windeployqt utility")
@ -124,19 +125,41 @@ if(WIN32)
windeployqt(vnote) windeployqt(vnote)
elseif(APPLE) elseif(APPLE)
# Manually copy resources.
set(VX_BUNDLE_CONTENTS_DIR $<TARGET_FILE_DIR:vnote>/..)
add_custom_target(deploy
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_LIST_DIR}/data/core/Info.plist" ${VX_BUNDLE_CONTENTS_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${VX_EXTRA_RESOURCE_FILES_RCC} ${VX_BUNDLE_CONTENTS_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E make_directory ${VX_BUNDLE_CONTENTS_DIR}/Resources/translations
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${VX_QM_FILES} ${VX_BUNDLE_CONTENTS_DIR}/Resources/translations
COMMENT "Copying resources into bundle Contents ${VX_BUNDLE_CONTENTS_DIR}"
DEPENDS vnote lrelease
)
add_dependencies(pack deploy)
message(STATUS "MACDeployQtExecutable: ${MACDEPLOYQT_EXECUTABLE}")
if (MACDEPLOYQT_EXECUTABLE)
message(STATUS "Package generation - MacOS - DMG")
list(APPEND CPACK_GENERATOR External)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CPackMacDeployQt.cmake.in "${CMAKE_BINARY_DIR}/CPackExternal.cmake")
set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_BINARY_DIR}/CPackExternal.cmake")
include(InstallRequiredSystemLibraries)
endif()
else() else()
message(STATUS "LinuxDeployExecutable: ${LINUXDEPLOY_EXECUTABLE}") message(STATUS "LinuxDeployExecutable: ${LINUXDEPLOY_EXECUTABLE}")
if(LINUXDEPLOY_EXECUTABLE) if(LINUXDEPLOY_EXECUTABLE)
message(STATUS "Package generation - Linux - AppImage") message(STATUS "Package generation - Linux - AppImage")
set(CPACK_GENERATOR "External;${CPACK_GENERATOR}") list(APPEND CPACK_GENERATOR External)
set(VX_APPIMAGE_DEST_DIR "${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/Linux/External/AppImage") 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") 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") configure_file(${CMAKE_CURRENT_LIST_DIR}/CPackLinuxDeployQt.cmake.in "${CMAKE_BINARY_DIR}/CPackExternal.cmake")
set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_BINARY_DIR}/CPackExternal.cmake") set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_BINARY_DIR}/CPackExternal.cmake")
endif() endif()
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/logo/64x64/vnote.png")
endif() endif()
include(CPack) include(CPack)

View File

@ -575,14 +575,21 @@ void ConfigMgr::initAppPrefixPath()
// Support QFile("app:abc.txt"). // Support QFile("app:abc.txt").
QStringList potential_dirs; QStringList potential_dirs;
auto app_dir_path = QCoreApplication::applicationDirPath(); auto app_dir_path = QCoreApplication::applicationDirPath();
qInfo() << "executable dir: " << app_dir_path; qInfo() << "app prefix path: " << app_dir_path;
potential_dirs << app_dir_path; potential_dirs << app_dir_path;
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
QDir localBinDir(app_dir_path); QDir localBinDir(app_dir_path);
if (localBinDir.exists("../local/bin/vnote")) { if (localBinDir.exists("../local/bin/vnote")) {
auto app_dir_path2 = localBinDir.cleanPath(localBinDir.filePath("../local/bin")); auto app_dir_path2 = localBinDir.cleanPath(localBinDir.filePath("../local/bin"));
qInfo() << "executable dir: " << app_dir_path2; qInfo() << "app prefix path: " << app_dir_path2;
potential_dirs << app_dir_path2;
}
#elif defined(Q_OS_MACOS)
QDir localBinDir(app_dir_path);
if (localBinDir.exists("../Resources")) {
auto app_dir_path2 = localBinDir.cleanPath(localBinDir.filePath("../Resources"));
qInfo() << "app prefix path: " << app_dir_path2;
potential_dirs << app_dir_path2; potential_dirs << app_dir_path2;
} }
#endif #endif

View File

@ -18,26 +18,26 @@
</array> </array>
</dict> </dict>
</array> </array>
<key>CFBundleName</key>
<string>VNote</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>vnote</string> <string>vnote</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.17.0</string> <string>3.17</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>3.17.0.1</string> <string>3.17.0</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Created by VNoteX</string> <string>Distributed under LGPL-3.0 license. Copyright (c) 2024 app.vnote.fun</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>vnote.icns</string> <string>vnote.icns</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.vnotex.vnote</string> <string>fun.vnote.app</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>10.12</string> <string>12.1</string>
<key>NOTE</key> <key>NOTE</key>
<string>Visit [GitHub VNote](https://github.com/vnotex/vnote) for details.</string> <string>A pleasant note-taking platform</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string>NSApplication</string> <string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key> <key>NSSupportsAutomaticGraphicsSwitching</key>