Skip to content

Commit 08166ac

Browse files
committed
Add linux arm64 release jobs
1 parent dabbde5 commit 08166ac

2 files changed

Lines changed: 118 additions & 44 deletions

File tree

.github/workflows/linux-build.yml

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -99,38 +99,24 @@ jobs:
9999
if-no-files-found: warn
100100

101101
build-ubuntu-clang:
102-
name: "Build (${{ matrix.build_type }}-clang-${{ matrix.glfw_desc }})"
102+
name: "Build (${{ matrix.build_type }}-clang)"
103103
runs-on: ubuntu-latest
104104
# Only run clang builds on push to main branch
105105
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
106106

107107
strategy:
108108
matrix:
109109
build_type: [Debug, Release]
110-
glfw_mode: [with_glfw, without_glfw]
111-
include:
112-
- glfw_mode: with_glfw
113-
glfw_install: true
114-
glfw_desc: "with system GLFW"
115-
- glfw_mode: without_glfw
116-
glfw_install: false
117-
glfw_desc: "without system GLFW (bundled)"
118110

119111
steps:
120112
- uses: actions/checkout@v4
121113
with:
122114
submodules: recursive
123115

124-
- name: Install base dependencies
116+
- name: Install dependencies
125117
run: |
126118
sudo apt-get update
127-
sudo apt-get install -y cmake build-essential clang
128-
129-
- name: Install GLFW (conditional)
130-
if: matrix.glfw_install == true
131-
run: |
132-
sudo apt-get install -y libglfw3-dev
133-
echo "GLFW_INSTALLED=true" >> $GITHUB_ENV
119+
sudo apt-get install -y cmake build-essential clang libglfw3-dev
134120
135121
- name: Setup compiler
136122
run: |
@@ -139,7 +125,7 @@ jobs:
139125
140126
- name: Configure CMake
141127
run: |
142-
echo "Configuring build ${{ matrix.build_type }} with clang ${{ matrix.glfw_desc }}"
128+
echo "Configuring build ${{ matrix.build_type }} with clang (with system GLFW)"
143129
cmake -B build/${{ matrix.build_type }} \
144130
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
145131
-DCCAP_BUILD_EXAMPLES=ON \
@@ -148,28 +134,12 @@ jobs:
148134
- name: Build
149135
run: cmake --build build/${{ matrix.build_type }} --config ${{ matrix.build_type }} --parallel $(nproc)
150136

151-
- name: Verify GLFW examples build status
137+
- name: Verify build outputs
152138
working-directory: build/${{ matrix.build_type }}
153139
run: |
154140
echo "Checking built examples:"
155-
ls -la | grep -E "(glfw|example)" || echo "No GLFW examples found"
156-
157-
if [ "${{ matrix.glfw_install }}" = "true" ]; then
158-
echo "With system GLFW - checking if GLFW examples were built:"
159-
if [ -f "4-example_with_glfw" ]; then
160-
echo "✓ GLFW example successfully built with system GLFW"
161-
else
162-
echo "✗ GLFW example not found - this might indicate a build issue"
163-
exit 1
164-
fi
165-
else
166-
echo "Without system GLFW - checking if bundled GLFW was used:"
167-
if [ -f "4-example_with_glfw" ]; then
168-
echo "✓ GLFW example successfully built with bundled GLFW"
169-
else
170-
echo "ℹ GLFW example not built - using bundled GLFW or GLFW disabled"
171-
fi
172-
fi
141+
ls -la | grep -E "(glfw|example)" || echo "No examples found"
142+
echo "✓ Build completed successfully"
173143
174144
- name: Run Unit Tests
175145
if: matrix.build_type == 'Release'
@@ -180,7 +150,7 @@ jobs:
180150
- name: Upload artifacts
181151
uses: actions/upload-artifact@v4
182152
with:
183-
name: ccap-linux-clang-${{ matrix.build_type }}-${{ matrix.glfw_mode }}
153+
name: ccap-linux-clang-${{ matrix.build_type }}
184154
path: |
185155
build/${{ matrix.build_type }}/libccap.a
186156
build/${{ matrix.build_type }}/0-print_camera
@@ -191,6 +161,64 @@ jobs:
191161
build/${{ matrix.build_type }}/*_results.xml
192162
if-no-files-found: warn
193163

164+
build-ubuntu-arm64:
165+
name: "Build ARM64 (${{ matrix.build_type }}-gcc)"
166+
runs-on: ubuntu-latest
167+
168+
strategy:
169+
matrix:
170+
build_type: [Debug, Release]
171+
172+
steps:
173+
- uses: actions/checkout@v4
174+
with:
175+
submodules: recursive
176+
177+
- name: Install cross-compilation toolchain and GLFW
178+
run: |
179+
sudo apt-get update
180+
sudo apt-get install -y cmake build-essential gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
181+
# Add ARM64 architecture and install cross-compiled GLFW
182+
sudo dpkg --add-architecture arm64
183+
sudo apt-get update
184+
sudo apt-get install -y libglfw3-dev:arm64 || echo "ARM64 GLFW not available, will use bundled version"
185+
186+
- name: Configure CMake for ARM64
187+
run: |
188+
echo "Configuring build ${{ matrix.build_type }} for ARM64 (with system GLFW)"
189+
cmake -B build/arm64/${{ matrix.build_type }} \
190+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
191+
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
192+
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
193+
-DCMAKE_SYSTEM_NAME=Linux \
194+
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
195+
-DCCAP_BUILD_EXAMPLES=ON \
196+
-DCCAP_BUILD_TESTS=ON
197+
198+
- name: Build ARM64
199+
run: cmake --build build/arm64/${{ matrix.build_type }} --config ${{ matrix.build_type }} --parallel $(nproc)
200+
201+
- name: Verify build outputs
202+
working-directory: build/arm64/${{ matrix.build_type }}
203+
run: |
204+
echo "Checking built examples:"
205+
ls -la | grep -E "(glfw|example)" || echo "No examples found"
206+
echo "✓ ARM64 build completed successfully"
207+
208+
- name: Upload ARM64 artifacts
209+
uses: actions/upload-artifact@v4
210+
with:
211+
name: ccap-linux-arm64-gcc-${{ matrix.build_type }}
212+
path: |
213+
build/arm64/${{ matrix.build_type }}/libccap.a
214+
build/arm64/${{ matrix.build_type }}/0-print_camera
215+
build/arm64/${{ matrix.build_type }}/1-minimal_example
216+
build/arm64/${{ matrix.build_type }}/2-capture_grab
217+
build/arm64/${{ matrix.build_type }}/3-capture_callback
218+
build/arm64/${{ matrix.build_type }}/4-example_with_glfw
219+
build/arm64/${{ matrix.build_type }}/*_results.xml
220+
if-no-files-found: warn
221+
194222
build-fedora:
195223
name: "Build Fedora (${{ matrix.build_type }})"
196224
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,25 @@ jobs:
4040
artifact_name: ccap-linux-x86_64
4141
build_type: Release
4242

43+
- os: ubuntu-latest
44+
name: Linux ARM64
45+
artifact_name: ccap-linux-arm64
46+
build_type: Release
47+
arch: arm64
48+
4349
runs-on: ${{ matrix.os }}
4450

4551
steps:
4652
- name: Checkout code
4753
uses: actions/checkout@v4
4854

55+
- name: Setup cross-compilation for ARM64
56+
if: matrix.arch == 'arm64'
57+
shell: bash
58+
run: |
59+
sudo apt-get update
60+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
61+
4962
- name: Setup Visual Studio (Windows)
5063
if: matrix.os == 'windows-latest'
5164
uses: microsoft/setup-msbuild@v1.1
@@ -58,7 +71,18 @@ jobs:
5871
cmake -B build -G "Visual Studio 17 2022" -A x64 -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
5972
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
6073
# Linux: Use single-config generator
61-
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
74+
if [ "${{ matrix.arch }}" = "arm64" ]; then
75+
# ARM64 cross-compilation
76+
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
77+
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
78+
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
79+
-DCMAKE_SYSTEM_NAME=Linux \
80+
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
81+
-DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
82+
else
83+
# Regular Linux x86_64
84+
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
85+
fi
6286
else
6387
# macOS: Use single-config generator with universal binary
6488
cmake -B build -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
@@ -131,7 +155,7 @@ jobs:
131155
find build -name "*-example_with_glfw" -exec cp {} package/examples/ \; || echo "Examples not found"
132156
133157
- name: Copy libraries (Linux)
134-
if: matrix.os == 'ubuntu-latest'
158+
if: matrix.os == 'ubuntu-latest' && matrix.arch != 'arm64'
135159
shell: bash
136160
run: |
137161
# Copy static library
@@ -147,6 +171,23 @@ jobs:
147171
find build -name "3-capture_callback" -exec cp {} package/examples/ \; || echo "Examples not found"
148172
find build -name "4-example_with_glfw" -exec cp {} package/examples/ \; || echo "Examples not found"
149173
174+
- name: Copy libraries (Linux ARM64)
175+
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64'
176+
shell: bash
177+
run: |
178+
# Copy static library
179+
cp build/libccap.a package/lib/ || echo "Static library not found"
180+
181+
# Copy dynamic library (if exists)
182+
cp build/libccap.so package/lib/ || echo "Dynamic library not found"
183+
184+
# Copy example programs (ARM64 cross-compiled)
185+
find build -name "0-print_camera" -exec cp {} package/examples/ \; || echo "Examples not found"
186+
find build -name "1-minimal_example" -exec cp {} package/examples/ \; || echo "Examples not found"
187+
find build -name "2-capture_grab" -exec cp {} package/examples/ \; || echo "Examples not found"
188+
find build -name "3-capture_callback" -exec cp {} package/examples/ \; || echo "Examples not found"
189+
find build -name "4-example_with_glfw" -exec cp {} package/examples/ \; || echo "Examples not found"
190+
150191
- name: Copy headers and other files
151192
shell: bash
152193
run: |
@@ -260,19 +301,22 @@ jobs:
260301
**Supported Platforms:**
261302
- **macOS** (Universal Binary - supports Intel & Apple Silicon): `ccap-macos-universal.tar.gz`
262303
- **Windows** (MSVC x64 - includes Debug and Release versions): `ccap-msvc-x86_64.zip`
263-
- **Linux** (x86_64 - compatible with most distributions): `ccap-linux-x86_64.tar.gz`
304+
- **Linux x86_64** (compatible with most distributions): `ccap-linux-x86_64.tar.gz`
305+
- **Linux ARM64** (compatible with Raspberry Pi, ARM servers, and other ARM64 boards): `ccap-linux-arm64.tar.gz`
264306
265307
### 📁 Package Contents
266308
267309
- **Library Files**: Static library files for linking
268310
- Windows: `lib/ccap.lib` (Release version) and `lib/ccapd.lib` (Debug version)
269311
- macOS: `lib/libccap.a` (Universal Binary)
270-
- Linux: `lib/libccap.a` (x86_64)
312+
- Linux x86_64: `lib/libccap.a` (x86_64)
313+
- Linux ARM64: `lib/libccap.a` (ARM64)
271314
- **Header Files**: Complete C++ API header files
272315
- **Example Programs**: 5 complete usage examples
273316
- Windows: `examples/Release/` and `examples/Debug/` directories contain corresponding versions
274317
- macOS: `examples/` directory contains executable files
275-
- Linux: `examples/` directory contains executable files
318+
- Linux x86_64: `examples/` directory contains executable files
319+
- Linux ARM64: `examples/` directory contains executable files
276320
- **Example Source Code**: Ready-to-compile example code
277321
- **Documentation**: README and build instructions
278322
- **CMake Configuration**: Easy integration with other CMake projects
@@ -286,7 +330,8 @@ jobs:
286330
- **Windows Debug**: Link `lib/ccapd.lib`
287331
- **Windows Release**: Link `lib/ccap.lib`
288332
- **macOS**: Link `lib/libccap.a`
289-
- **Linux**: Link `lib/libccap.a`
333+
- **Linux x86_64**: Link `lib/libccap.a`
334+
- **Linux ARM64**: Link `lib/libccap.a`
290335
5. Refer to example code in the `examples` directory
291336
292337
### 📋 System Requirements
@@ -331,5 +376,6 @@ jobs:
331376
echo "- ccap-macos-universal.tar.gz" >> $GITHUB_STEP_SUMMARY
332377
echo "- ccap-msvc-x86_64.zip (includes Debug and Release versions)" >> $GITHUB_STEP_SUMMARY
333378
echo "- ccap-linux-x86_64.tar.gz" >> $GITHUB_STEP_SUMMARY
379+
echo "- ccap-linux-arm64.tar.gz" >> $GITHUB_STEP_SUMMARY
334380
echo "" >> $GITHUB_STEP_SUMMARY
335381
echo "Release page: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)