Skip to content

Commit

Permalink
Deploy: Fix MacOS Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Feb 22, 2025
1 parent 3722312 commit 6b10ba1
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/workflows/docker-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
with:
submodules: recursive
fetch-tags: true
fetch-depth: 0

- run: chmod a+x ./deploy/docker/run-docker-ubuntu.sh

Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/docker-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker-MacOS

on:
push:
branches:
- master
- 'Stable*'
tags:
- 'v*'
pull_request:
paths:
- '.github/workflows/docker-macos.yml'
- 'deploy/docker/**'
- 'deploy/macos/**'
- 'src/**'
- 'CMakeLists.txt'
- 'cmake/**'

# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
shell: bash

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

- run: chmod a+x ./deploy/docker/run-docker-macos.sh

- name: Run Docker Build
run: ./deploy/docker/run-docker-macos.sh
9 changes: 4 additions & 5 deletions deploy/docker/Dockerfile-build-macos
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ ENV QT_DESKTOP=$QT_PATH/${QT_VERSION}/clang_64

ENV PATH=$QT_DESKTOP/bin:/usr/local/bin:$PATH

COPY tools/setup/macos-dependencies.sh /tmp/qt/
RUN /tmp/qt/macos-dependencies.sh
COPY tools/setup/install-dependencies-osx.sh /tmp/qt/
RUN /tmp/qt/install-dependencies-osx.sh

# Install Qt using Homebrew
RUN brew install qt@${QT_VERSION} \
&& brew link --force qt@${QT_VERSION}
COPY tools/setup/install-qt-macos.sh /tmp/qt/
RUN /tmp/qt/install-qt-macos.sh

# Set up Qt environment
RUN mkdir -p $QT_PATH \
Expand Down
2 changes: 1 addition & 1 deletion tools/setup/install-dependencies-osx.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ sudo installer -pkg "$GST_PKG" -target /
sudo installer -pkg "$GST_DEV_PKG" -target /
rm $TMPDIR/$GST_DEV_PKG
rm $TMPDIR/$GST_PKG
popd
popd
46 changes: 46 additions & 0 deletions tools/setup/install-qt-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

# Set defaults appropriate for macOS.
QT_VERSION="${QT_VERSION:-6.8.2}"
QT_PATH="${QT_PATH:-/opt/Qt}"
QT_HOST="${QT_HOST:-mac}"
QT_TARGET="${QT_TARGET:-desktop}"
QT_ARCH="${QT_ARCH:-mac}"
QT_MODULES="${QT_MODULES:-qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors}"

set -e

echo "QT_VERSION: $QT_VERSION"
echo "QT_PATH: $QT_PATH"
echo "QT_HOST: $QT_HOST"
echo "QT_TARGET: $QT_TARGET"
echo "QT_ARCH: $QT_ARCH"
echo "QT_MODULES: $QT_MODULES"

# Update Homebrew and install Python 3 (if needed)
brew update
brew install python3

# Install required Python packages, including aqtinstall.
pip3 install --upgrade setuptools wheel py7zr ninja cmake aqtinstall

# Use aqtinstall to download and install Qt.
aqt install-qt ${QT_HOST} ${QT_TARGET} ${QT_VERSION} ${QT_ARCH} -O ${QT_PATH} -m ${QT_MODULES}

# macOS does not support GNU readlink -e.
# We use realpath instead (or substitute with greadlink -f if needed).
# Note: On macOS, dynamic libraries are resolved using DYLD_LIBRARY_PATH.
export PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/bin):$PATH"
export PKG_CONFIG_PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/lib/pkgconfig):$PKG_CONFIG_PATH"
export DYLD_LIBRARY_PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/lib):$DYLD_LIBRARY_PATH"
export QT_ROOT_DIR="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH})"
export QT_PLUGIN_PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/plugins)"
export QML2_IMPORT_PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/qml)"

echo "Updated environment variables:"
echo "PATH: $PATH"
echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH"
echo "QT_ROOT_DIR: $QT_ROOT_DIR"
echo "QT_PLUGIN_PATH: $QT_PLUGIN_PATH"
echo "QML2_IMPORT_PATH: $QML2_IMPORT_PATH"

0 comments on commit 6b10ba1

Please sign in to comment.