From 4f1c67efd0650ffc9eeaa428d3860229fe0151e5 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sun, 12 May 2024 23:22:49 +0800 Subject: [PATCH 01/21] try fix macOS CI --- .github/workflows/ci-macos.yml | 95 +++++++--------------------------- src/CMakeLists.txt | 27 +++++++--- src/CPackMacDeployQt.cmake.in | 4 ++ src/Packaging.cmake | 20 +++++-- src/data/core/Info.plist | 2 +- 5 files changed, 61 insertions(+), 87 deletions(-) create mode 100644 src/CPackMacDeployQt.cmake.in diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index e55ffaf80f..5cecd83035 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -11,6 +11,7 @@ on: env: VNOTE_VER: 3.17.0 + CMAKE_VER: 3.24.3 jobs: build: @@ -18,18 +19,6 @@ jobs: runs-on: macos-latest timeout-minutes: 120 - strategy: - matrix: - config: - # - { - # name: "Build Qt 5.12", - # qt: 5.12.12 - # } - - { - name: "Build Qt 5.15", - qt: 5.15.2 - } - steps: # Checks-out your repository under $GITHUB_WORKSPACE. - uses: actions/checkout@v2 @@ -46,6 +35,15 @@ jobs: run: | brew install tree + - name: Install a fresh CMake + run: | + wget --no-verbose https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Darwin-x86_64.tar.gz + tar xzf cmake-${CMAKE_VER}-Darwin-x86_64.tar.gz + sudo rm -f /usr/local/bin/cmake /usr/local/bin/cpack + sudo ln -s ${{runner.workspace}}/cmake-${CMAKE_VER}-Darwin-x86_64/CMake.app/Contents/bin/cmake /usr/local/bin/cmake + sudo ln -s ${{runner.workspace}}/cmake-${CMAKE_VER}-Darwin-x86_64/CMake.app/Contents/bin/cpack /usr/local/bin/cpack + working-directory: ${{runner.workspace}} + - name: Install macdeployqtfix run: | git clone https://github.com/tamlok/macdeployqtfix.git macdeployqtfix --depth=1 @@ -56,18 +54,18 @@ jobs: uses: actions/cache@v1 # not v2! with: path: ../Qt - key: ${{ runner.os }}-QtCache-${{ matrix.config.qt }} + key: ${{ runner.os }}-QtCache-6.5 - name: Install Qt uses: jurplel/install-qt-action@v3 with: - version: ${{ matrix.config.qt }} + version: 6.5.3 target: desktop - modules: qtwebengine - cached: ${{ steps.cache-qt.outputs.cache-hit }} + modules: 'qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat qtserialport' + tools: 'tools_opensslv3_src' + cache: 'true' setup-python: 'false' - - name: Create Build Dir run: mkdir build working-directory: ${{runner.workspace}} @@ -75,70 +73,13 @@ jobs: - name: Configure Project run: | qmake -v - qmake CONFIG+=release ${GITHUB_WORKSPACE}/vnote.pro + cmake --version + cmake -DMACDEPLOYQTFIX_EXECUTABLE=${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py ${GITHUB_WORKSPACE} working-directory: ${{runner.workspace}}/build - name: Build Project - run: make -j4 - working-directory: ${{runner.workspace}}/build - - - name: Deploy VSyntaxHighlighting Framework - run: | - my_lib_name=VSyntaxHighlighting - my_lib_framework=${my_lib_name}.framework - my_lib_dir=./libs/vtextedit/src/libs/syntax-highlighting - 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: Deploy VTextEdit Framework - run: | - my_lib_name=VTextEdit - my_lib_framework=${my_lib_name}.framework - 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 + cmake --build . --target pack working-directory: ${{runner.workspace}}/build - name: Archive Artifacts diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1ea5eeee00..3b5de67489 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -115,18 +115,33 @@ if(WIN32) endif() # 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) - install(FILES "${PROJECT_SOURCE_DIR}/package/qt.conf" - DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vnote RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(FILES "${PROJECT_SOURCE_DIR}/package/qt.conf" DESTINATION ${CMAKE_INSTALL_BINDIR}) elseif(APPLE) - + set(CMAKE_MACOSX_BUNDLE ON) + set(CMAKE_MACOSX_RPATH ON) + install(TARGETS vnote BUNDLE DESTINATION . RUNTIME DESTINATION .) + set_target_properties(vnote + PROPERTIES + MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}" + MACOSX_BUNDLE_INFO_STRING "${PROJECT_DESCRIPTION}" + MACOSX_BUNDLE_ICON_FILE "${VX_APP_ICON_MACOS}" + 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() + install(TARGETS vnote + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + set(desktop.path applications) set(desktop.files data/core/vnote.desktop) set(icon16.path icons/hicolor/16x16/apps) diff --git a/src/CPackMacDeployQt.cmake.in b/src/CPackMacDeployQt.cmake.in new file mode 100644 index 0000000000..40656bf928 --- /dev/null +++ b/src/CPackMacDeployQt.cmake.in @@ -0,0 +1,4 @@ +execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app -dmg + --always-overwirte + WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY} +) diff --git a/src/Packaging.cmake b/src/Packaging.cmake index f314c3eacf..37ae68df1f 100644 --- a/src/Packaging.cmake +++ b/src/Packaging.cmake @@ -109,6 +109,8 @@ add_dependencies(pack lrelease) set(CPACK_GENERATOR) +set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/logo/64x64/vnote.png") + if(WIN32) find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}" DOC "Path to the windeployqt utility") @@ -124,19 +126,31 @@ if(WIN32) windeployqt(vnote) elseif(APPLE) + message(STATUS "MACDeployQtExecutable: ${MACDEPLOYQT_EXECUTABLE}") + if (MACDEPLOYQT_EXECUTABLE) + message(STATUS "Package generation - MacOS - DMG") + + list(APPEND CPACK_GENERATOR External) + set(CPACK_BUNDLE_NAME "${PROJECT_NAME}" ) + set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_LIST_DIR}/data/core/Info.plist") + set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/icons/vnote.icns") + set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}") + set(CPACK_DMG_FORMAT "UDBZ") + 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() message(STATUS "LinuxDeployExecutable: ${LINUXDEPLOY_EXECUTABLE}") if(LINUXDEPLOY_EXECUTABLE) 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_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() - - set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/logo/64x64/vnote.png") endif() include(CPack) diff --git a/src/data/core/Info.plist b/src/data/core/Info.plist index d8e6ca65dd..0e9609b914 100644 --- a/src/data/core/Info.plist +++ b/src/data/core/Info.plist @@ -29,7 +29,7 @@ CFBundleIconFile vnote.icns CFBundleIdentifier - com.vnotex.vnote + fun.vnote.app CFBundlePackageType APPL CFBundleSignature From 85ca72071cedd169e7d8c6651bf8c70acc5ce844 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sun, 12 May 2024 23:25:39 +0800 Subject: [PATCH 02/21] fix --- .github/workflows/ci-linux.yml | 1 + .github/workflows/ci-macos.yml | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index b2747da59e..47bf58d711 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -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 tree 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 id: cache-qt diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 5cecd83035..34023462d9 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -37,11 +37,11 @@ jobs: - name: Install a fresh CMake run: | - wget --no-verbose https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Darwin-x86_64.tar.gz - tar xzf cmake-${CMAKE_VER}-Darwin-x86_64.tar.gz + 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}-Darwin-x86_64/CMake.app/Contents/bin/cmake /usr/local/bin/cmake - sudo ln -s ${{runner.workspace}}/cmake-${CMAKE_VER}-Darwin-x86_64/CMake.app/Contents/bin/cpack /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 From ba0f93a8bd7aa007d301c678744c9792a6dcbd55 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 14 May 2024 14:49:06 +0800 Subject: [PATCH 03/21] fix --- .github/workflows/ci-macos.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 34023462d9..70283d2861 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -63,8 +63,6 @@ jobs: target: desktop modules: 'qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat qtserialport' tools: 'tools_opensslv3_src' - cache: 'true' - setup-python: 'false' - name: Create Build Dir run: mkdir build From 9fd58262ffe87c0f4d6ab0a8792f42cf07b07a31 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 14 May 2024 15:26:32 +0800 Subject: [PATCH 04/21] fix --- .github/workflows/ci-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 70283d2861..23e7dec266 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -62,7 +62,7 @@ jobs: version: 6.5.3 target: desktop modules: 'qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat qtserialport' - tools: 'tools_opensslv3_src' + cache: 'true' - name: Create Build Dir run: mkdir build From 642e9a0ffb6724d9986796de9f65de5cc779c6e6 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 14 May 2024 16:54:53 +0800 Subject: [PATCH 05/21] fix --- src/Packaging.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Packaging.cmake b/src/Packaging.cmake index 37ae68df1f..5fba3f18a5 100644 --- a/src/Packaging.cmake +++ b/src/Packaging.cmake @@ -131,7 +131,7 @@ elseif(APPLE) message(STATUS "Package generation - MacOS - DMG") list(APPEND CPACK_GENERATOR External) - set(CPACK_BUNDLE_NAME "${PROJECT_NAME}" ) + set(CPACK_BUNDLE_NAME "vnote" ) set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_LIST_DIR}/data/core/Info.plist") set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/icons/vnote.icns") set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}") From 57bcb074c9f33e4780be965bd91248d965c39314 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 14 May 2024 20:12:21 +0800 Subject: [PATCH 06/21] fix --- .github/workflows/ci-macos.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 23e7dec266..0f758f1bea 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -8,6 +8,12 @@ on: # Allows you to run this workflow manually from the Actions tab. workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: 'Run the build with tmate debugging enabled' + required: false + default: false env: VNOTE_VER: 3.17.0 @@ -80,6 +86,11 @@ jobs: cmake --build . --target pack working-directory: ${{runner.workspace}}/build + # Enable tmate debugging of manually-triggered workflows if the input option was provided + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + - name: Archive Artifacts uses: actions/upload-artifact@v2 with: From e1c0b35acc04f4a284072eb612e8b0ba445daeee Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 14 May 2024 23:06:26 +0800 Subject: [PATCH 07/21] fix --- .github/workflows/ci-macos.yml | 2 +- src/CMakeLists.txt | 2 +- src/CPackMacDeployQt.cmake.in | 4 ++-- src/Packaging.cmake | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 0f758f1bea..24a182b586 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -39,7 +39,7 @@ jobs: - name: Install Dependencies run: | - brew install tree + brew install tree libiodbc - name: Install a fresh CMake run: | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b5de67489..c2bfa6f7a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,7 +124,7 @@ if (WIN32) elseif(APPLE) set(CMAKE_MACOSX_BUNDLE ON) set(CMAKE_MACOSX_RPATH ON) - install(TARGETS vnote BUNDLE DESTINATION . RUNTIME DESTINATION .) + install(TARGETS vnote BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) set_target_properties(vnote PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}" diff --git a/src/CPackMacDeployQt.cmake.in b/src/CPackMacDeployQt.cmake.in index 40656bf928..86a9e73b62 100644 --- a/src/CPackMacDeployQt.cmake.in +++ b/src/CPackMacDeployQt.cmake.in @@ -1,4 +1,4 @@ -execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app -dmg - --always-overwirte +execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}/vnote.app -dmg + -always-overwrite WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY} ) diff --git a/src/Packaging.cmake b/src/Packaging.cmake index 5fba3f18a5..37ae68df1f 100644 --- a/src/Packaging.cmake +++ b/src/Packaging.cmake @@ -131,7 +131,7 @@ elseif(APPLE) message(STATUS "Package generation - MacOS - DMG") list(APPEND CPACK_GENERATOR External) - set(CPACK_BUNDLE_NAME "vnote" ) + set(CPACK_BUNDLE_NAME "${PROJECT_NAME}" ) set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_LIST_DIR}/data/core/Info.plist") set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/icons/vnote.icns") set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}") From e078546733e650a17f258985623c1a35e06768b1 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Mon, 20 May 2024 21:52:44 +0800 Subject: [PATCH 08/21] fix --- .github/workflows/ci-macos.yml | 5 ++++- src/CPackMacDeployQt.cmake.in | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 24a182b586..6ff08bcd4b 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -39,7 +39,10 @@ jobs: - name: Install Dependencies run: | - brew install tree libiodbc + brew install tree libiodbc libpq + sudo ln -s /opt/homebrew/opt/libiodbc/lib/libiodbc.2.dylib /usr/local/opt/libiodbc/lib/libiodbc.2.dylib + 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: | diff --git a/src/CPackMacDeployQt.cmake.in b/src/CPackMacDeployQt.cmake.in index 86a9e73b62..2c56af6ba0 100644 --- a/src/CPackMacDeployQt.cmake.in +++ b/src/CPackMacDeployQt.cmake.in @@ -1,4 +1,4 @@ execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}/vnote.app -dmg - -always-overwrite + -always-overwrite -verbose=2 WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY} ) From 90a5ecf38925e585378683fec7572505cf74d120 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Mon, 20 May 2024 22:12:48 +0800 Subject: [PATCH 09/21] fix --- .github/workflows/ci-macos.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 6ff08bcd4b..79b1016d1f 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -40,6 +40,7 @@ jobs: - name: Install Dependencies run: | brew install tree libiodbc libpq + 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 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 From 4e15e3907d0ac9cc9fbc5b7b278ab15481b53afc Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 21 May 2024 14:26:52 +0800 Subject: [PATCH 10/21] fix --- .github/workflows/ci-macos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 79b1016d1f..8ecdfa5e9e 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -40,9 +40,9 @@ jobs: - name: Install Dependencies run: | brew install tree libiodbc libpq - mkdir -p /usr/local/opt/libiodbc/lib + 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 - mkdir -p /Applications/Postgres.app/Contents/Versions/14/lib + 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 From d3f36bc3254fc312e8b46fc2cb6e6404ef4eba97 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 21 May 2024 14:46:44 +0800 Subject: [PATCH 11/21] fix --- .github/workflows/ci-macos.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 8ecdfa5e9e..c1d3bf36cb 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -88,6 +88,7 @@ jobs: - name: Build Project run: | cmake --build . --target pack + mv src/vnote.dmg ../VNote-${{env.VNOTE_VER}}-mac.dmg working-directory: ${{runner.workspace}}/build # Enable tmate debugging of manually-triggered workflows if the input option was provided @@ -98,8 +99,8 @@ jobs: - name: Archive Artifacts uses: actions/upload-artifact@v2 with: - name: vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}} - path: ${{runner.workspace}}/build/vnote-mac-x64-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.dmg + name: VNote-${{env.VNOTE_VER}}-mac + path: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac.dmg - name: Update Tag if: github.ref == 'refs/heads/master' @@ -112,7 +113,7 @@ jobs: uses: johnwbyrd/update-release@v1.0.0 with: 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.dmg release: Continuous Build tag: continuous-build @@ -121,7 +122,7 @@ jobs: uses: ncipollo/release-action@v1.11.0 with: 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.dmg commit: master tag: v${{env.VNOTE_VER}} allowUpdates: true From da25d097945cc9fa579e3e42ca4bdc6c5dd392cb Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 21 May 2024 14:57:47 +0800 Subject: [PATCH 12/21] fix --- .github/workflows/ci-macos.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index c1d3bf36cb..b55699329f 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -88,7 +88,9 @@ jobs: - name: Build Project run: | cmake --build . --target pack - mv src/vnote.dmg ../VNote-${{env.VNOTE_VER}}-mac.dmg + ls -ls . + ls -ls src + mv src/vnote.dmg VNote-${{env.VNOTE_VER}}-mac.dmg working-directory: ${{runner.workspace}}/build # Enable tmate debugging of manually-triggered workflows if the input option was provided From 0fddcebc9dd40783eaf63f21cc094898bcc6f5bb Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 21 May 2024 15:41:13 +0800 Subject: [PATCH 13/21] fix --- .github/workflows/ci-macos.yml | 24 ++++++++++++++++++------ .github/workflows/ci-win.yml | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index b55699329f..d2e102099e 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -22,9 +22,21 @@ env: jobs: build: name: Build On MacOS - runs-on: macos-latest timeout-minutes: 120 + strategy: + fail-fast: false + matrix: + config: + - name: "Build on x64" + os: macos-latest-large + arch: x64 + - name: "Build on Arm64" + os: macos-latest + arch: arm64 + + runs-on: ${{matrix.config.os}} + steps: # Checks-out your repository under $GITHUB_WORKSPACE. - uses: actions/checkout@v2 @@ -90,7 +102,7 @@ jobs: cmake --build . --target pack ls -ls . ls -ls src - mv src/vnote.dmg VNote-${{env.VNOTE_VER}}-mac.dmg + mv src/vnote.dmg VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg working-directory: ${{runner.workspace}}/build # Enable tmate debugging of manually-triggered workflows if the input option was provided @@ -101,8 +113,8 @@ jobs: - name: Archive Artifacts uses: actions/upload-artifact@v2 with: - name: VNote-${{env.VNOTE_VER}}-mac - path: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac.dmg + name: VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}} + path: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg - name: Update Tag if: github.ref == 'refs/heads/master' @@ -115,7 +127,7 @@ jobs: uses: johnwbyrd/update-release@v1.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} - files: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac.dmg + files: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg release: Continuous Build tag: continuous-build @@ -124,7 +136,7 @@ jobs: uses: ncipollo/release-action@v1.11.0 with: token: ${{ secrets.GITHUB_TOKEN }} - artifacts: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac.dmg + artifacts: ${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg commit: master tag: v${{env.VNOTE_VER}} allowUpdates: true diff --git a/.github/workflows/ci-win.yml b/.github/workflows/ci-win.yml index 33321eea75..1ef07933fc 100644 --- a/.github/workflows/ci-win.yml +++ b/.github/workflows/ci-win.yml @@ -28,14 +28,14 @@ jobs: fail-fast: false matrix: config: - - name: "Build On Win64 Qt 5.15" + - name: "Build on Win64 Qt 5.15" arch: win64_msvc2019_64 qt: 5.15.2 qt_modules: qtwebengine qt_tools: tools_opensslv3_x64 qt_major: 5 suffix: "-windows7" - - name: "Build On Win64 Qt 6.5" + - name: "Build on Win64 Qt 6.5" arch: win64_msvc2019_64 qt: 6.5.3 qt_modules: "qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat" From 261faf3c60f7ef0c991fd152b1ec4bf7b0045192 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 21 May 2024 16:03:34 +0800 Subject: [PATCH 14/21] fix --- .github/workflows/ci-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index d2e102099e..e0442519e4 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -29,7 +29,7 @@ jobs: matrix: config: - name: "Build on x64" - os: macos-latest-large + os: macos-13 arch: x64 - name: "Build on Arm64" os: macos-latest From fad62892d0b364f58becfe81d2397fd52d5553b7 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 21 May 2024 16:22:52 +0800 Subject: [PATCH 15/21] fix --- .github/workflows/ci-macos.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index e0442519e4..d0ef158bd1 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -52,6 +52,10 @@ jobs: - name: Install Dependencies run: | brew install tree libiodbc libpq + + - name: Fix SQL + if: ${{matrix.config.arch == 'arm64'}} + 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 From 80824d9cb2a0cf3fb32524adb3a0bca127ab6c2f Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 21 May 2024 21:17:42 +0800 Subject: [PATCH 16/21] fix --- .github/workflows/ci-macos.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index d0ef158bd1..99965b653e 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -28,12 +28,12 @@ jobs: fail-fast: false matrix: config: - - name: "Build on x64" - os: macos-13 - arch: x64 + # - name: "Build on X64" + # os: macos-13 + # arch: x64 - name: "Build on Arm64" os: macos-latest - arch: arm64 + arch: universal runs-on: ${{matrix.config.os}} @@ -54,7 +54,7 @@ jobs: brew install tree libiodbc libpq - name: Fix SQL - if: ${{matrix.config.arch == 'arm64'}} + 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 @@ -98,7 +98,7 @@ jobs: run: | qmake -v cmake --version - cmake -DMACDEPLOYQTFIX_EXECUTABLE=${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py ${GITHUB_WORKSPACE} + cmake -DMACDEPLOYQTFIX_EXECUTABLE=${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ${GITHUB_WORKSPACE} working-directory: ${{runner.workspace}}/build - name: Build Project From 8cb9b4511da992a120019cab70b7b70ed9adff8b Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 21 May 2024 22:40:10 +0800 Subject: [PATCH 17/21] fix mac --- CMakeLists.txt | 3 +++ src/CMakeLists.txt | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9be2e30ca..21ed75d5b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required (VERSION 3.20) + +set(CMAKE_OSX_DEPLOYMENT_TARGET 13.6 FORCE) + project(VNote VERSION 3.17.0 DESCRIPTION "A pleasant note-taking platform" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c2bfa6f7a8..71d0dab326 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -129,7 +129,6 @@ elseif(APPLE) PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}" MACOSX_BUNDLE_INFO_STRING "${PROJECT_DESCRIPTION}" - MACOSX_BUNDLE_ICON_FILE "${VX_APP_ICON_MACOS}" 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}" From d46c1143b8f78f61885b011ec54e4b4ac84bd931 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 22 May 2024 10:43:20 +0800 Subject: [PATCH 18/21] fix --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21ed75d5b3..2ef0a55710 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.20) -set(CMAKE_OSX_DEPLOYMENT_TARGET 13.6 FORCE) +set(CMAKE_OSX_DEPLOYMENT_TARGET "13.6" CACHE STRING "Minimum OS X deployment version" FORCE) project(VNote VERSION 3.17.0 From 7c3461a2495e16efb10b0a960d8d98c72380f662 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 22 May 2024 11:50:11 +0800 Subject: [PATCH 19/21] fix --- .github/workflows/ci-macos.yml | 3 --- CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 99965b653e..64bdd65ec4 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -28,9 +28,6 @@ jobs: fail-fast: false matrix: config: - # - name: "Build on X64" - # os: macos-13 - # arch: x64 - name: "Build on Arm64" os: macos-latest arch: universal diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ef0a55710..bb1aa80540 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.20) -set(CMAKE_OSX_DEPLOYMENT_TARGET "13.6" CACHE STRING "Minimum OS X deployment version" FORCE) +set(CMAKE_OSX_DEPLOYMENT_TARGET "12.1" CACHE STRING "Minimum OS X deployment version") project(VNote VERSION 3.17.0 From 827af10db84687cd4145ef049a8d408374f9c699 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 22 May 2024 22:55:07 +0800 Subject: [PATCH 20/21] fix --- src/CMakeLists.txt | 14 ++------------ src/CPackMacDeployQt.cmake.in | 2 +- src/Packaging.cmake | 2 +- src/data/core/Info.plist | 14 +++++++------- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 71d0dab326..0d06c9024d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,7 +53,7 @@ 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 OPTIONS -compress 9) -add_executable(vnote WIN32 MACOSX_BUNDLE +add_executable(vnote WIN32 application.cpp application.h commandlineoptions.cpp commandlineoptions.h fakeaccessible.cpp fakeaccessible.h @@ -122,19 +122,9 @@ if (WIN32) install(TARGETS vnote RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES "${PROJECT_SOURCE_DIR}/package/qt.conf" DESTINATION ${CMAKE_INSTALL_BINDIR}) elseif(APPLE) - set(CMAKE_MACOSX_BUNDLE ON) + set(CMAKE_MACOSX_BUNDLE OFF) set(CMAKE_MACOSX_RPATH ON) install(TARGETS vnote BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - 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() install(TARGETS vnote LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/src/CPackMacDeployQt.cmake.in b/src/CPackMacDeployQt.cmake.in index 2c56af6ba0..dde001a2b3 100644 --- a/src/CPackMacDeployQt.cmake.in +++ b/src/CPackMacDeployQt.cmake.in @@ -1,4 +1,4 @@ execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}/vnote.app -dmg - -always-overwrite -verbose=2 + -always-overwrite -verbose=1 WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY} ) diff --git a/src/Packaging.cmake b/src/Packaging.cmake index 37ae68df1f..b93669226b 100644 --- a/src/Packaging.cmake +++ b/src/Packaging.cmake @@ -102,7 +102,7 @@ set(CPACK_WIX_UI_DIALOG "${PROJECT_SOURCE_DIR}/package/wix_dialog.png") set(CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/BundleConfig.cmake") 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..." DEPENDS vnote) add_dependencies(pack lrelease) diff --git a/src/data/core/Info.plist b/src/data/core/Info.plist index 0e9609b914..7f39ee999d 100644 --- a/src/data/core/Info.plist +++ b/src/data/core/Info.plist @@ -18,26 +18,26 @@ + CFBundleName + VNote CFBundleExecutable vnote CFBundleShortVersionString - 3.17.0 + 3.17 CFBundleVersion - 3.17.0.1 + 3.17.0 NSHumanReadableCopyright - Created by VNoteX + Distributed under LGPL-3.0 license. Copyright (c) 2024 app.vnote.fun CFBundleIconFile vnote.icns CFBundleIdentifier fun.vnote.app CFBundlePackageType APPL - CFBundleSignature - ???? LSMinimumSystemVersion - 10.12 + 12.1 NOTE - Visit [GitHub VNote](https://github.com/vnotex/vnote) for details. + A pleasant note-taking platform NSPrincipalClass NSApplication NSSupportsAutomaticGraphicsSwitching From d2de7e2b9cfe078a2ef102f3958d237054983e35 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 23 May 2024 07:53:06 -0700 Subject: [PATCH 21/21] fix --- .gitignore | 1 + src/CMakeLists.txt | 55 +++++++++++++++++++++++++++--------------- src/Packaging.cmake | 23 ++++++++++++------ src/core/configmgr.cpp | 11 +++++++-- 4 files changed, 62 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 2a5e9bc31d..50258e8d0f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ aqtinstall.log tags CMakeLists.txt.user build +.DS_Store diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d06c9024d..b0cde80b36 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,8 +19,11 @@ endif() # Application icon on Windows 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) +# And the following tells CMake where to find and install the file itself. set(VX_APP_ICON_MACOS data/core/icons/vnote.icns) set_source_files_properties(${VX_APP_ICON_MACOS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") @@ -39,21 +42,20 @@ add_custom_target(lrelease DEPENDS ${VX_QM_FILES}) # TODO: VTextEdit translations list(APPEND VX_QM_FILES - data/core/translations/qdialogbuttonbox_zh_CN.qm - data/core/translations/qtbase_ja.qm - data/core/translations/qtbase_zh_CN.qm - data/core/translations/qtv_ja.qm - data/core/translations/qtv_zh_CN.qm - data/core/translations/qwebengine_zh_CN.qm + ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qdialogbuttonbox_zh_CN.qm + ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qtbase_ja.qm + ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qtbase_zh_CN.qm + ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qtv_ja.qm + ${CMAKE_CURRENT_LIST_DIR}/data/core/translations/qtv_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 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 - OPTIONS -compress 9) +set(VX_EXTRA_RESOURCE_FILES_RCC ${CMAKE_CURRENT_BINARY_DIR}/vnote_extra.rcc) +qt_add_binary_resources(VX_EXTRA_RESOURCE data/extra/extra.qrc DESTINATION ${VX_EXTRA_RESOURCE_FILES_RCC} OPTIONS -compress 9) -add_executable(vnote WIN32 +add_executable(vnote WIN32 MACOSX_BUNDLE application.cpp application.h commandlineoptions.cpp commandlineoptions.h fakeaccessible.cpp fakeaccessible.h @@ -115,21 +117,36 @@ if(WIN32) endif() # Installation -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vnote_extra.rcc" - DESTINATION ${CMAKE_INSTALL_BINDIR}) - if (WIN32) install(TARGETS vnote RUNTIME 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) - set(CMAKE_MACOSX_BUNDLE OFF) set(CMAKE_MACOSX_RPATH ON) - install(TARGETS vnote BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + + # 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() 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.files data/core/vnote.desktop) @@ -147,9 +164,9 @@ else() 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} + foreach(item IN ITEMS desktop icon16 icon32 icon48 icon64 icon128 icon256 iconsvg) + install(FILES ${CMAKE_CURRENT_LIST_DIR}/${${item}.files} + DESTINATION share/${${item}.path} PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) endforeach() endif() diff --git a/src/Packaging.cmake b/src/Packaging.cmake index b93669226b..2f590a737a 100644 --- a/src/Packaging.cmake +++ b/src/Packaging.cmake @@ -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/qmltooling/" COMMENT "Deploying Qt..." - DEPENDS vnote + DEPENDS vnote lrelease ) - add_dependencies(deploy lrelease) add_dependencies(pack deploy) install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/winqt/" DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) @@ -126,16 +125,26 @@ if(WIN32) windeployqt(vnote) elseif(APPLE) + # Manually copy resources. + set(VX_BUNDLE_CONTENTS_DIR $/..) + 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) - set(CPACK_BUNDLE_NAME "${PROJECT_NAME}" ) - set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_LIST_DIR}/data/core/Info.plist") - set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_LIST_DIR}/data/core/icons/vnote.icns") - set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}") - set(CPACK_DMG_FORMAT "UDBZ") 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) diff --git a/src/core/configmgr.cpp b/src/core/configmgr.cpp index 047f7ffe98..104da66cbe 100644 --- a/src/core/configmgr.cpp +++ b/src/core/configmgr.cpp @@ -575,14 +575,21 @@ void ConfigMgr::initAppPrefixPath() // Support QFile("app:abc.txt"). QStringList potential_dirs; auto app_dir_path = QCoreApplication::applicationDirPath(); - qInfo() << "executable dir: " << app_dir_path; + qInfo() << "app prefix path: " << app_dir_path; potential_dirs << app_dir_path; #if defined(Q_OS_LINUX) QDir localBinDir(app_dir_path); if (localBinDir.exists("../local/bin/vnote")) { 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; } #endif