Skip to content

Commit

Permalink
Externalize dmg building
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jan 3, 2025
1 parent ba5bd62 commit 9c23565
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 28 deletions.
70 changes: 54 additions & 16 deletions .github/workflows/build-macos-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ concurrency:

jobs:
build:
outputs:
artifact-x64-url: ${{ steps.artifact-url.outputs.x64-osx-dynamic-release }}
artifact-arm64-url: ${{ steps.artifact-url.outputs.arm64-osx-dynamic-release }}
strategy:
matrix:
include:
Expand Down Expand Up @@ -52,7 +49,7 @@ jobs:

- name: 🔨 Prepare build env
run: |
brew install automake bison flex gnu-sed create-dmg autoconf-archive nasm libtool fdupes
brew install automake bison flex gnu-sed autoconf-archive nasm libtool fdupes
echo $(brew --prefix bison)/bin >> $GITHUB_PATH
echo $(brew --prefix flex)/bin >> $GITHUB_PATH
echo $(brew --prefix libtool)/bin >> $GITHUB_PATH
Expand Down Expand Up @@ -133,34 +130,75 @@ jobs:
cmake --build build
cmake --build build --target bundle
- name: 📤 Upload dmg
- name: 📤 Upload app
uses: actions/upload-artifact@v4
id: artifact-dmg-upload
with:
name: qgis-dmg-${{steps.workflow-artifact-ids.outputs.display-name}}-${{ matrix.triplet }}
name: qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-${{ matrix.triplet }}
path: |
build/*.dmg
build/_CPack_Packages/Darwin/External/*.app
- name: Export artifact url
id: artifact-url
run: |
echo "${{ matrix.triplet }}=${{ steps.artifact-dmg-upload.outputs.artifact-url }}" >> $GITHUB_OUTPUT
- name: Upload release assets
uses: AButler/upload-release-assets@v3.0
if: ${{ github.event_name == 'release' }}
with:
files: build/*.dmg
repo-token: ${{ secrets.GITHUB_TOKEN }}

schedule_download_comment:
name: Comment pull request
name: Create dmg
runs-on: ubuntu-24.04
needs: build
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4

- name: 🔨 Prepare build env
run: |
brew install create-dmg
- name: 📤 Download app
uses: actions/download-artifact@v4
with:
name: qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-x64-osx-dynamic-release
path: |
x64
- name: 📤 Download app
uses: actions/download-artifact@v4
with:
name: qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-arm64-osx-dynamic-release
path: |
arm64
- name: 🎲 Get artifact ids
id: workflow-artifact-ids
uses: ./.github/actions/get-workflow-artifact-ids

- name: Create universal app
run: |
wget https://raw.githubusercontent.com/faaxm/lipo-dir-merge/refs/heads/main/lipo-dir-merge.py
python lipo-dir-merge.py x64 arm64 universal
- name: Create dmg
run: |
QGIS_APP_NAME=QGIS-"${{steps.workflow-artifact-ids.outputs.display-name}}"
create-dmg --volname "${QGIS_APP_NAME} Installer" \
--hide-extension ${QGIS_APP_NAME}.app \
--volicon "./images/icons/mac/qgis.icns \
--background "./platform/macos/installer_background.png" \
--window-pos 200 120 \
--window-size 512 320 \
--icon-size 100 \
--icon "${QGIS_APP_NAME}.app" 130 160 \
--app-drop-link 400 155 \
${QGIS_APP_NAME}-Installer.dmg \
universal/${QGIS_APP_NAME}.app
- name: Upload release assets
uses: AButler/upload-release-assets@v3.0
if: ${{ github.event_name == 'release' }}
with:
files: '*.dmg'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Schedule download comment
uses: ./.github/actions/post_sticky_comment
if: github.event_name == 'pull_request'
Expand Down
5 changes: 3 additions & 2 deletions cmake/Bundle.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ endif()


if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND QGIS_MAC_BUNDLE)
set(CREATE_DMG FALSE CACHE BOOL "Create a dmg bundle")
# TODO HINT relative to VCPKG_HOST_DIR
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "../../macdeployqt-standalone/build/bin/" NO_DEFAULT_PATH)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt NO_DEFAULT_PATH)

configure_file("${CMAKE_SOURCE_DIR}/platform/macos/Info.plist.in" "${CMAKE_BINARY_DIR}/platform//macos/Info.plist" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/platform//macos/Info.plist" DESTINATION "${APP_CONTENTS_DIR}")
install(FILES "${CMAKE_BINARY_DIR}/platform/macos/Info.plist" DESTINATION "${APP_CONTENTS_DIR}")

set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}")
set(CPACK_DMG_FORMAT "UDBZ")
Expand Down
22 changes: 12 additions & 10 deletions platform/macos/CPackMacDeployQt.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ if(NOT "$ENV{MACOS_CODE_SIGN_IDENTITY}" STREQUAL "")
COMMAND_ERROR_IS_FATAL ANY
)

execute_process(COMMAND create-dmg --volname "@QGIS_APP_NAME@ Installer" --hide-extension @QGIS_APP_NAME@.app --volicon "@CMAKE_SOURCE_DIR@/images/icons/mac/qgis.icns" --background "@CMAKE_SOURCE_DIR@/platform/macos/installer_background.png" --window-pos 200 120 --window-size 512 320 --icon-size 100 --icon "@QGIS_APP_NAME@.app" 130 160 --app-drop-link 400 155 --codesign "${MACOS_CODE_SIGN_IDENTITY}" @CMAKE_BINARY_DIR@/@QGIS_APP_NAME@-Installer.dmg ${CPACK_TEMPORARY_DIRECTORY}/@QGIS_APP_NAME@.app
RESULT_VARIABLE CREATE_DMG_FAILURE)
if (@CREATE_DMG@)
execute_process(COMMAND create-dmg --volname "@QGIS_APP_NAME@ Installer" --hide-extension @QGIS_APP_NAME@.app --volicon "@CMAKE_SOURCE_DIR@/images/icons/mac/qgis.icns" --background "@CMAKE_SOURCE_DIR@/platform/macos/installer_background.png" --window-pos 200 120 --window-size 512 320 --icon-size 100 --icon "@QGIS_APP_NAME@.app" 130 160 --app-drop-link 400 155 --codesign "${MACOS_CODE_SIGN_IDENTITY}" @CMAKE_BINARY_DIR@/@QGIS_APP_NAME@-Installer.dmg ${CPACK_TEMPORARY_DIRECTORY}/@QGIS_APP_NAME@.app
RESULT_VARIABLE CREATE_DMG_FAILURE)

if(CREATE_DMG_FAILURE)
message(STATUS "Creating dmg failed. Retrying ...")
execute_process(COMMAND create-dmg --volname "@QGIS_APP_NAME@ Installer" --hide-extension @QGIS_APP_NAME@.app --volicon "@CMAKE_SOURCE_DIR@/images/icons/mac/qgis.icns" --background "@CMAKE_SOURCE_DIR@/platform/macos/installer_background.png" --window-pos 200 120 --window-size 512 320 --icon-size 100 --icon "@QGIS_APP_NAME@.app" 130 160 --app-drop-link 400 155 --codesign "${MACOS_CODE_SIGN_IDENTITY}" @CMAKE_BINARY_DIR@/@QGIS_APP_NAME@-Installer.dmg ${CPACK_TEMPORARY_DIRECTORY}/@QGIS_APP_NAME@.app
COMMAND_ERROR_IS_FATAL ANY)
if(CREATE_DMG_FAILURE)
message(STATUS "Creating dmg failed.")
endif()
endif()
else()
# -appstore-compliant will strip away odbc, psql and webengine plugins
Expand All @@ -25,10 +25,12 @@ else()
COMMAND_ERROR_IS_FATAL ANY
)

execute_process(COMMAND create-dmg --volname "@QGIS_APP_NAME@ Installer" --hide-extension @QGIS_APP_NAME@.app --volicon "@CMAKE_SOURCE_DIR@/images/icons/mac/qgis.icns" --background "@CMAKE_SOURCE_DIR@/platform/macos/installer_background.png" --window-pos 200 120 --window-size 512 320 --icon-size 100 --icon "@QGIS_APP_NAME@.app" 130 160 --app-drop-link 400 155 @CMAKE_BINARY_DIR@/@QGIS_APP_NAME@-Installer.dmg ${CPACK_TEMPORARY_DIRECTORY}/@QGIS_APP_NAME@.app
RESULT_VARIABLE CREATE_DMG_FAILURE)
if (@CREATE_DMG@)
execute_process(COMMAND create-dmg --volname "@QGIS_APP_NAME@ Installer" --hide-extension @QGIS_APP_NAME@.app --volicon "@CMAKE_SOURCE_DIR@/images/icons/mac/qgis.icns" --background "@CMAKE_SOURCE_DIR@/platform/macos/installer_background.png" --window-pos 200 120 --window-size 512 320 --icon-size 100 --icon "@QGIS_APP_NAME@.app" 130 160 --app-drop-link 400 155 @CMAKE_BINARY_DIR@/@QGIS_APP_NAME@-Installer.dmg ${CPACK_TEMPORARY_DIRECTORY}/@QGIS_APP_NAME@.app
RESULT_VARIABLE CREATE_DMG_FAILURE)

if(CREATE_DMG_FAILURE)
message(STATUS "Creating dmg failed.")
if(CREATE_DMG_FAILURE)
message(STATUS "Creating dmg failed.")
endif()
endif()
endif()

0 comments on commit 9c23565

Please sign in to comment.