Skip to content

Commit b400f05

Browse files
authored
Merge pull request #17 from labstreaminglayer/cboulay/apple_framework
Attempt to modernize build
2 parents a9da5a8 + 78e3713 commit b400f05

13 files changed

Lines changed: 794 additions & 275 deletions

.github/workflows/build.yml

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
# =============================================================================
2+
# AudioCapture Build Workflow
3+
# =============================================================================
4+
# This workflow builds, tests, and packages AudioCapture for all
5+
# supported platforms.
6+
#
7+
# Features:
8+
# - Multi-platform builds (Linux, macOS, Windows)
9+
# - Qt6 integration
10+
# - Automatic liblsl fetch via FetchContent
11+
# - CPack packaging
12+
# - macOS code signing and notarization (on release)
13+
# =============================================================================
14+
15+
name: Build
16+
17+
on:
18+
push:
19+
branches: [main, master]
20+
tags: ['v*']
21+
pull_request:
22+
branches: [main, master]
23+
release:
24+
types: [published]
25+
workflow_dispatch:
26+
27+
env:
28+
BUILD_TYPE: Release
29+
30+
jobs:
31+
# ===========================================================================
32+
# Build Job - Multi-platform builds
33+
# ===========================================================================
34+
build:
35+
name: ${{ matrix.config.name }}
36+
runs-on: ${{ matrix.config.os }}
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
config:
41+
- { name: "Ubuntu 22.04", os: ubuntu-22.04 }
42+
- { name: "Ubuntu 24.04", os: ubuntu-24.04 }
43+
- { name: "macOS", os: macos-14, cmake_extra: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
44+
- { name: "Windows", os: windows-latest }
45+
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
# -----------------------------------------------------------------------
51+
# Install CMake 3.28+ (Ubuntu 22.04 ships with 3.22)
52+
# -----------------------------------------------------------------------
53+
- name: Install CMake
54+
if: runner.os == 'Linux'
55+
uses: lukka/get-cmake@latest
56+
57+
# -----------------------------------------------------------------------
58+
# Install Qt6 (6.8 LTS across all platforms)
59+
# -----------------------------------------------------------------------
60+
- name: Install Linux dependencies
61+
if: runner.os == 'Linux'
62+
run: |
63+
sudo apt-get update
64+
sudo apt-get install -y libgl1-mesa-dev libxkbcommon-dev libxcb-cursor0 \
65+
libasound2-dev libpulse-dev
66+
67+
- name: Install Qt
68+
uses: jurplel/install-qt-action@v4
69+
with:
70+
version: '6.8.*'
71+
modules: 'qtmultimedia'
72+
cache: true
73+
74+
# -----------------------------------------------------------------------
75+
# Configure
76+
# -----------------------------------------------------------------------
77+
- name: Configure CMake
78+
run: >
79+
cmake -S . -B build
80+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
81+
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
82+
-DLSL_FETCH_IF_MISSING=ON
83+
${{ matrix.config.cmake_extra }}
84+
85+
# -----------------------------------------------------------------------
86+
# Build
87+
# -----------------------------------------------------------------------
88+
- name: Build
89+
run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
90+
91+
# -----------------------------------------------------------------------
92+
# Install
93+
# -----------------------------------------------------------------------
94+
- name: Install
95+
run: cmake --install build --config ${{ env.BUILD_TYPE }}
96+
97+
# -----------------------------------------------------------------------
98+
# Package
99+
# -----------------------------------------------------------------------
100+
- name: Package
101+
run: cpack -C ${{ env.BUILD_TYPE }}
102+
working-directory: build
103+
104+
# -----------------------------------------------------------------------
105+
# Upload Artifacts
106+
# -----------------------------------------------------------------------
107+
- name: Upload Artifacts
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: package-${{ matrix.config.os }}
111+
path: |
112+
build/*.zip
113+
build/*.tar.gz
114+
build/*.deb
115+
if-no-files-found: ignore
116+
117+
# ===========================================================================
118+
# macOS Signing and Notarization (Release only)
119+
# ===========================================================================
120+
sign-macos:
121+
name: Sign & Notarize (macOS)
122+
needs: build
123+
if: github.event_name == 'release'
124+
runs-on: macos-14
125+
126+
steps:
127+
- name: Checkout
128+
uses: actions/checkout@v4
129+
130+
- name: Download macOS Artifact
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: package-macos-14
134+
path: packages
135+
136+
- name: Extract Package
137+
run: |
138+
cd packages
139+
tar -xzf *.tar.gz
140+
# Move contents out of versioned subdirectory to packages/
141+
SUBDIR=$(ls -d AudioCapture-*/ | head -1)
142+
mv "$SUBDIR"/* .
143+
rmdir "$SUBDIR"
144+
ls -la
145+
146+
# -----------------------------------------------------------------------
147+
# Install Apple Certificates
148+
# -----------------------------------------------------------------------
149+
- name: Install Apple Certificates
150+
env:
151+
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
152+
MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
153+
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
154+
run: |
155+
# Create temporary keychain
156+
KEYCHAIN_PATH=$RUNNER_TEMP/build.keychain
157+
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" $KEYCHAIN_PATH
158+
security default-keychain -s $KEYCHAIN_PATH
159+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
160+
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" $KEYCHAIN_PATH
161+
162+
# Import certificate
163+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
164+
echo -n "$MACOS_CERTIFICATE" | base64 --decode -o $CERTIFICATE_PATH
165+
security import $CERTIFICATE_PATH -P "$MACOS_CERTIFICATE_PWD" -k $KEYCHAIN_PATH -A -t cert -f pkcs12
166+
rm $CERTIFICATE_PATH
167+
168+
# Allow codesign to access keychain
169+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" $KEYCHAIN_PATH
170+
security list-keychain -d user -s $KEYCHAIN_PATH
171+
172+
# Extract identity name and export to environment
173+
IDENTITY=$(security find-identity -v -p codesigning $KEYCHAIN_PATH | grep "Developer ID Application" | head -1 | awk -F'"' '{print $2}')
174+
echo "APPLE_CODE_SIGN_IDENTITY_APP=$IDENTITY" >> $GITHUB_ENV
175+
176+
# -----------------------------------------------------------------------
177+
# Setup Notarization Credentials
178+
# -----------------------------------------------------------------------
179+
- name: Setup Notarization
180+
env:
181+
NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
182+
NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
183+
NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
184+
run: |
185+
xcrun notarytool store-credentials "notarize-profile" \
186+
--apple-id "$NOTARIZATION_APPLE_ID" \
187+
--password "$NOTARIZATION_PWD" \
188+
--team-id "$NOTARIZATION_TEAM_ID"
189+
echo "APPLE_NOTARIZE_KEYCHAIN_PROFILE=notarize-profile" >> $GITHUB_ENV
190+
191+
# -----------------------------------------------------------------------
192+
# Sign and Notarize
193+
# -----------------------------------------------------------------------
194+
- name: Sign and Notarize
195+
env:
196+
ENTITLEMENTS_FILE: ${{ github.workspace }}/app.entitlements
197+
run: |
198+
APP_PATH=$(find packages -name "*.app" -type d | head -1)
199+
if [[ -n "$APP_PATH" ]]; then
200+
./scripts/sign_and_notarize.sh "$APP_PATH" --notarize
201+
fi
202+
203+
# -----------------------------------------------------------------------
204+
# Repackage
205+
# -----------------------------------------------------------------------
206+
- name: Repackage
207+
run: |
208+
cd packages
209+
210+
echo "Contents of packages directory:"
211+
ls -la
212+
213+
rm -f *.tar.gz
214+
215+
VERSION=$(grep -A1 'project(AudioCapture' ../CMakeLists.txt | grep VERSION | sed 's/.*VERSION \([0-9.]*\).*/\1/')
216+
echo "Detected version: $VERSION"
217+
218+
tar -cvzf "AudioCapture-${VERSION}-macOS_universal-signed.tar.gz" \
219+
AudioCapture.app
220+
221+
echo "Created package:"
222+
ls -la *.tar.gz
223+
224+
- name: Upload Signed Package
225+
uses: actions/upload-artifact@v4
226+
with:
227+
name: package-macos-signed
228+
path: packages/*-signed.tar.gz
229+
230+
- name: Upload to Release
231+
if: github.event_name == 'release'
232+
uses: softprops/action-gh-release@v2
233+
with:
234+
files: packages/*-signed.tar.gz
235+
236+
# ===========================================================================
237+
# Upload unsigned packages to release
238+
# ===========================================================================
239+
release:
240+
name: Upload to Release
241+
needs: build
242+
if: github.event_name == 'release'
243+
runs-on: ubuntu-latest
244+
245+
steps:
246+
- name: Download All Artifacts
247+
uses: actions/download-artifact@v4
248+
with:
249+
path: artifacts
250+
251+
- name: Upload to Release
252+
uses: softprops/action-gh-release@v2
253+
with:
254+
files: |
255+
artifacts/**/*.zip
256+
artifacts/package-ubuntu-*/*.tar.gz
257+
artifacts/**/*.deb

.github/workflows/cppcmake.yml

Lines changed: 0 additions & 103 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ui_*.h
22
/build*/
3+
/install*/
34
/CMakeLists.txt.user
45
/CMakeLists.json
56
/CMakeSettings.json
@@ -8,4 +9,4 @@ out/
89
.DS_Store
910
LSL/
1011
liblsl.tar.bz2
11-
12+
.idea/

0 commit comments

Comments
 (0)