build qt for arm64 and cache it #13
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Qt Open Source | |
on: | |
push: | |
branches: | |
- 'feature/**' | |
paths: | |
- .github/workflows/build_qt.yml | |
pull_request: | |
branches: | |
- 'feature/**' | |
paths: | |
- .github/workflows/build_qt.yml | |
jobs: | |
macos: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-14] | |
build: [1] | |
include: | |
- build: 1 | |
qt-version: "5.15.15" | |
python3-version: "3.11.9" | |
python2-version: "2.7.18" | |
steps: | |
- name: Install Homebrew dependencies | |
run: | | |
brew install --quiet --formula libiconv libpng libpq libtool libuv libxau libxcb libxdmcp | |
brew install --quiet --formula autoconf automake cmake pcre2 harfbuzz freetype node@18 nspr nss | |
brew install --quiet --formula xcb-proto xcb-util xcb-util-cursor xcb-util-image xcb-util-keysyms xcb-util-renderutil xcb-util-wm | |
brew install --quiet --formula brotli bzip2 dbus glew icu4c jpeg md4c [email protected] pkg-config sqlite xorgproto zlib zstd | |
brew list [email protected] | |
- name: Prepare list of depdencies for the compiler | |
run: | | |
# Initialize an empty array to store the paths | |
paths=() | |
# Find all directories in /opt/homebrew/opt | |
find "/opt/homebrew/opt" -mindepth 1 -maxdepth 1 -type d | while read dir; do | |
# Construct the include and lib paths | |
include_path="-I $dir/include" | |
lib_path="-L $dir/lib" | |
# Combine the paths | |
combined_path="$include_path $lib_path" | |
# Add the combined path to our array | |
paths+=("$combined_path") | |
done | |
# Print the result | |
printf '%s\n' "${paths[@]}" | |
# Use Ninja 1.11.1 because Qt need to be patched for Ninja 1.12.1. | |
- name: Install Ninja 1.11.1 | |
run: | | |
wget https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-mac.zip | |
unzip ninja-mac.zip -d ./ninja | |
echo "$(pwd)/ninja" >> $GITHUB_PATH | |
- name: Display ninja version | |
run: | | |
ninja --version | |
- name: Install pyenv | |
run: | | |
curl https://pyenv.run | bash | |
export PYENV_ROOT="$HOME/.pyenv" | |
echo "$PYENV_ROOT/shims" >> $GITHUB_PATH | |
echo "$PYENV_ROOT/bin" >> $GITHUB_PATH | |
- name: Setup pyenv | |
run: | | |
echo $PATH | |
pyenv install ${{ matrix.python3-version }} ${{ matrix.python2-version }} | |
pyenv global ${{ matrix.python3-version }} ${{ matrix.python2-version }} | |
- name: Display Python installation location | |
run: | | |
python -c "import sys; print(sys.executable)" | |
python2 -c "import sys; print(sys.executable)" | |
- name: Download Qt ${{ matrix.qt-version }} source | |
run: | | |
git clone git://code.qt.io/qt/qt5.git | |
cd qt5 | |
git checkout 5.15 | |
./init-repository | |
- name: Create directory for build | |
run: | | |
mkdir -p qt-build | |
- name: Configure Qt ${{ matrix.qt-version }} | |
run: | | |
../qt5/configure -release -prefix ./release -nomake examples -nomake tests QMAKE_APPLE_DEVICE_ARCHS=arm64 \ | |
-opensource -confirm-license -c++std c++14 -openssl-linked -opengl desktop -release -skip qtlocation \ | |
-I /opt/homebrew/Cellar/[email protected]/1.1.1w/include -L //opt/homebrew/Cellar/[email protected]/1.1.1w/lib \ | |
-I /opt/homebrew/opt/zlib/include -L/opt/homebrew/opt/zlib/lib | |
env: | |
OPENSSL_LIBS: '-L/opt/homebrew/Cellar/[email protected]/1.1.1w/lib -lssl -lcrypto' | |
working-directory: ${{ github.workspace }}/qt-build | |
- name: Build Qt | |
run: | | |
make -j$(python -c 'import os; print(os.cpu_count())') | |
working-directory: ${{ github.workspace }}/qt-build | |
- name: Display release folder | |
run: | | |
ls -al ./release | |
working-directory: ${{ github.workspace }}/qt-build |