Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX CI using cmake, DMG creation support #11323

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 35 additions & 30 deletions .github/workflows/macos_release.yml → .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,64 @@
name: MacOS Release
name: MacOS Build

on:
push:
branches:
- 'master'
- master
- 'Stable*'
tags:
- 'v*'
paths-ignore:
- 'docs/**'
- 'android/**'
pull_request:
branches:
- '*'
paths-ignore:
- 'docs/**'
- 'android/**'

defaults:
run:
shell: bash

env:
SOURCE_DIR: ${{ github.workspace }}
QT_VERSION: 6.6.*
ARTIFACT: QGroundControl.dmg
BUILD_TYPE: ${{ fromJSON('["DailyBuild", "StableBuild"]')[ github.ref_type == 'tag' || contains(github.ref, 'Stable_' ) ] }}

jobs:
build:
runs-on: macos-latest
runs-on: macos-latest

strategy:
matrix:
BuildType: [Debug, Release]

steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true

- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
key: ${{ runner.os }}-Release
restore-keys: ${{ runner.os }}-Release
max-size: "2G"
create-symlink: true
key: ${{ runner.os }}-${{ matrix.BuildType }}
restore-keys: ${{ runner.os }}-${{ matrix.BuildType }}
max-size: 2G
append-timestamp: false
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'

- name: Get all tags for correct version determination
working-directory: ${{ github.workspace }}
run: |
git fetch --all --tags -f --depth 1

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
version: 6.6.3
aqtversion: ==3.1.*
host: mac
target: desktop
dir: ${{ runner.temp }}
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d
modules: qtcharts qtlocation qtpositioning qtspeech qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qt5compat
setup-python: false
cache: true
cache: true

- name: Install Dependencies
run: |
brew update
brew install ninja

- name: Install Gstreamer
run: |
Expand All @@ -69,20 +67,27 @@ jobs:
for package in *.pkg ;
do sudo installer -verbose -pkg "$package" -target /
done

- name: Create build directory
run: mkdir ${{ runner.temp }}/shadow_build_dir

- name: Configure
working-directory: ${{ runner.temp }}/shadow_build_dir
run: cmake -S ${{ github.workspace }} -B . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} -DQGC_STABLE_BUILD=${{ github.ref_type == 'tag' || contains(github.ref, 'Stable') && 'ON' || 'OFF' }}

- name: Build
working-directory: ${{ runner.temp }}/shadow_build_dir
run: |
export JOBS=$((`sysctl -n hw.ncpu`+1))
qmake -r ${SOURCE_DIR}/qgroundcontrol.pro CONFIG+=installer CONFIG+=${BUILD_TYPE}
make -j$JOBS
run: cmake --build . --target all --config ${{ matrix.BuildType }}

- name: Create DMG
working-directory: ${{ runner.temp }}/shadow_build_dir
run: cmake --install . --config ${{ matrix.BuildType }}
if: matrix.BuildType == 'Release'

- name: Upload Build File
uses: ./.github/actions/upload
if: matrix.BuildType == 'Release'
with:
artifact_name: ${{ env.ARTIFACT }}
artifact_name: QGroundControl.dmg
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
84 changes: 0 additions & 84 deletions .github/workflows/macos_debug.yml

This file was deleted.

12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,15 @@ if(LINUX)
)
install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/CreateAppImage.cmake")
endif()
if (MACOS)
DonLakeFlyer marked this conversation as resolved.
Show resolved Hide resolved
install(CODE "execute_process(COMMAND rsync -a --delete /Library/Frameworks/GStreamer.framework staging/QGroundControl.app/Contents/Frameworks)")
install(CODE "execute_process(COMMAND ln -sf staging/QGroundControl.app/Contents/Frameworks staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/libexec/Frameworks)")
install(CODE "execute_process(COMMAND install_name_tool -change /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer @executable_path/../Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer staging/QGroundControl.app/Contents/MacOS/QGroundControl)")
install(CODE "execute_process(COMMAND rm -rf staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/{bin,etc,share,Headers,include,Commands})")
install(CODE "execute_process(COMMAND rm -rf staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/{*.a,*.la,glib-2.0,gst-validate-launcher,pkgconfig})")
install(CODE "execute_process(COMMAND rsync -a --delete QGroundControl.app package)")
install(CODE "file(REMOVE /tmp/tmp.dmg package/QGroundControl.dmg)")
install(CODE "execute_process(COMMAND hdiutil create /tmp/tmp.dmg -ov -volname QGroundControl -fs HFS+ -srcfolder staging)")
install(CODE "execute_process(COMMAND hdiutil convert /tmp/tmp.dmg -format UDBZ -o package/QGroundControl.dmg)")
install(CODE "file(REMOVE /tmp/tmp.dmg)")
endif()