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