Skip to content

Commit 57b5a49

Browse files
committed
Deploy: Fix MacOS Docker
1 parent 0c8dddc commit 57b5a49

File tree

4 files changed

+91
-6
lines changed

4 files changed

+91
-6
lines changed

.github/workflows/docker-linux.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
with:
3535
submodules: recursive
3636
fetch-tags: true
37-
fetch-depth: 0
3837

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

.github/workflows/docker-macos.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Docker-MacOS
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'Stable*'
8+
tags:
9+
- 'v*'
10+
pull_request:
11+
paths:
12+
- '.github/workflows/docker-macos.yml'
13+
- 'deploy/docker/**'
14+
- 'deploy/macos/**'
15+
- 'src/**'
16+
- 'CMakeLists.txt'
17+
- 'cmake/**'
18+
19+
# concurrency:
20+
# group: ${{ github.workflow }}-${{ github.ref }}
21+
# cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
27+
defaults:
28+
run:
29+
shell: bash
30+
31+
steps:
32+
- name: Checkout repo
33+
uses: actions/checkout@v4
34+
with:
35+
submodules: recursive
36+
fetch-tags: true
37+
38+
- run: chmod a+x ./deploy/docker/run-docker-macos.sh
39+
40+
- name: Run Docker Build
41+
run: ./deploy/docker/run-docker-macos.sh

deploy/docker/Dockerfile-build-macos

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ ENV QT_DESKTOP=$QT_PATH/${QT_VERSION}/clang_64
88

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

11-
COPY tools/setup/macos-dependencies.sh /tmp/qt/
12-
RUN /tmp/qt/macos-dependencies.sh
11+
COPY tools/setup/install-dependencies-osx.sh /tmp/qt/
12+
RUN /tmp/qt/install-dependencies-osx.sh
1313

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

1817
# Set up Qt environment
1918
RUN mkdir -p $QT_PATH \

tools/setup/install-qt-macos.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
# Set defaults appropriate for macOS.
4+
QT_VERSION="${QT_VERSION:-6.8.1}"
5+
QT_PATH="${QT_PATH:-/opt/Qt}"
6+
QT_HOST="${QT_HOST:-mac}"
7+
QT_TARGET="${QT_TARGET:-desktop}"
8+
QT_ARCH="${QT_ARCH:-mac}"
9+
QT_MODULES="${QT_MODULES:-qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors}"
10+
11+
set -e
12+
13+
echo "QT_VERSION: $QT_VERSION"
14+
echo "QT_PATH: $QT_PATH"
15+
echo "QT_HOST: $QT_HOST"
16+
echo "QT_TARGET: $QT_TARGET"
17+
echo "QT_ARCH: $QT_ARCH"
18+
echo "QT_MODULES: $QT_MODULES"
19+
20+
# Update Homebrew and install Python 3 (if needed)
21+
brew update
22+
brew install python3
23+
24+
# Install required Python packages, including aqtinstall.
25+
pip3 install --upgrade setuptools wheel py7zr ninja cmake aqtinstall
26+
27+
# Use aqtinstall to download and install Qt.
28+
aqt install-qt ${QT_HOST} ${QT_TARGET} ${QT_VERSION} ${QT_ARCH} -O ${QT_PATH} -m ${QT_MODULES}
29+
30+
# macOS does not support GNU readlink -e.
31+
# We use realpath instead (or substitute with greadlink -f if needed).
32+
# Note: On macOS, dynamic libraries are resolved using DYLD_LIBRARY_PATH.
33+
export PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/bin):$PATH"
34+
export PKG_CONFIG_PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/lib/pkgconfig):$PKG_CONFIG_PATH"
35+
export DYLD_LIBRARY_PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/lib):$DYLD_LIBRARY_PATH"
36+
export QT_ROOT_DIR="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH})"
37+
export QT_PLUGIN_PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/plugins)"
38+
export QML2_IMPORT_PATH="$(realpath ${QT_PATH}/${QT_VERSION}/${QT_ARCH}/qml)"
39+
40+
echo "Updated environment variables:"
41+
echo "PATH: $PATH"
42+
echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
43+
echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH"
44+
echo "QT_ROOT_DIR: $QT_ROOT_DIR"
45+
echo "QT_PLUGIN_PATH: $QT_PLUGIN_PATH"
46+
echo "QML2_IMPORT_PATH: $QML2_IMPORT_PATH"

0 commit comments

Comments
 (0)