-
Notifications
You must be signed in to change notification settings - Fork 29
Support linux via v4l2, and add some build tests. #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 28 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
4ad6ca4
Add linux imp
wysaid e11d35f
Fix tests on linux
wysaid 61bd673
Enable avx2 on linux x86_64
wysaid 72553b8
Further optimize lifecycle, adapt to conversion failure cases
wysaid 8919681
Support YUYV/UYVY
wysaid 087d344
Refactor linux implementation, fix zeroCopy issue
wysaid 3b6b739
Fallback to zeroCopy mode after format conversion failure
wysaid 5293c54
Improve format conversion
wysaid 70e91ee
Fix some lifecycle issues
wysaid bc53edd
Add avx2 acceleration support for YUYV and UYVY formats
wysaid d573128
Improve avx2 backend implementation
wysaid b4d1423
Remove duplicate declarations
wysaid be9b4d5
Further improve avx2 implementation
wysaid 8d47c22
Complete avx2 acceleration for yuyv and uyuv formats
wysaid 826a86f
Optimize logging on linux
wysaid 69360bb
Improve unit tests for new yuv formats
wysaid df7afe9
New avx2 implementation passes unit tests
wysaid becf1ec
Fix orientation handling on linux
wysaid 24292e8
Add a detach method for flexible use of VideoFrame externally
wysaid 0224e4c
Improve the documentation and add descriptions related to Linux adapt…
wysaid a3ee309
code format
wysaid 4f0f914
Fix linux ci build error
wysaid a44a968
better linux build ci, support ubuntu & fedora
wysaid 74f5fbd
fix ci error of fedora
wysaid dabbde5
Add linux release jobs
wysaid 08166ac
Add linux arm64 release jobs
wysaid 3bae543
Fix ci error of linux-arm64
wysaid df7cc04
Simplify build tasks
wysaid 444b2ef
Better comments
wysaid c3ca8eb
Fix arg passing
wysaid 90a6b62
Fix tests
wysaid 8576284
fix: avoid extra compute
wysaid 6c892b8
Enhance compatibility for building on Linux
wysaid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,267 @@ | ||
| name: Linux Build | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop, support_linux ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
|
|
||
| jobs: | ||
| build-ubuntu: | ||
| name: "Build (${{ matrix.build_type }}-gcc)" | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| build_type: [Debug, Release] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install base dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake build-essential gcc | ||
|
|
||
| - name: Install GLFW (for Release builds only) | ||
| if: matrix.build_type == 'Release' | ||
| run: | | ||
| sudo apt-get install -y libglfw3-dev | ||
| echo "GLFW_INSTALLED=true" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup compiler | ||
| run: | | ||
| echo "CC=gcc" >> $GITHUB_ENV | ||
| echo "CXX=g++" >> $GITHUB_ENV | ||
|
|
||
| - name: Configure CMake | ||
| run: | | ||
| echo "Configuring build ${{ matrix.build_type }} with gcc" | ||
| cmake -B build/${{ matrix.build_type }} \ | ||
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | ||
| -DCCAP_BUILD_EXAMPLES=ON \ | ||
| -DCCAP_BUILD_TESTS=ON | ||
|
|
||
| - name: Build | ||
| run: cmake --build build/${{ matrix.build_type }} --config ${{ matrix.build_type }} --parallel $(nproc) | ||
|
|
||
| - name: Verify GLFW examples build status | ||
| working-directory: build/${{ matrix.build_type }} | ||
| run: | | ||
| echo "Checking built examples:" | ||
| ls -la | grep -E "(glfw|example)" || echo "No GLFW examples found" | ||
|
wysaid marked this conversation as resolved.
|
||
|
|
||
| if [ "${{ matrix.build_type }}" = "Release" ]; then | ||
| echo "Release build - checking if GLFW examples were built with system GLFW:" | ||
| if [ -f "4-example_with_glfw" ]; then | ||
| echo "✓ GLFW example successfully built with system GLFW" | ||
| else | ||
| echo "✗ GLFW example not found - this might indicate a build issue" | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "Debug build - checking if bundled GLFW was used:" | ||
| if [ -f "4-example_with_glfw" ]; then | ||
| echo "✓ GLFW example successfully built with bundled GLFW" | ||
| else | ||
| echo "ℹ GLFW example not built - using bundled GLFW or GLFW disabled" | ||
| fi | ||
| fi | ||
|
|
||
| - name: Run Unit Tests | ||
| if: matrix.build_type == 'Release' | ||
| run: | | ||
| cd scripts | ||
| ./run_tests.sh --functional --exit-when-failed | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ccap-linux-gcc-${{ matrix.build_type }} | ||
| path: | | ||
| build/${{ matrix.build_type }}/libccap.a | ||
| build/${{ matrix.build_type }}/0-print_camera | ||
| build/${{ matrix.build_type }}/1-minimal_example | ||
| build/${{ matrix.build_type }}/2-capture_grab | ||
| build/${{ matrix.build_type }}/3-capture_callback | ||
| build/${{ matrix.build_type }}/4-example_with_glfw | ||
| build/${{ matrix.build_type }}/*_results.xml | ||
| if-no-files-found: warn | ||
|
|
||
| build-ubuntu-clang: | ||
| name: "Build (${{ matrix.build_type }}-clang)" | ||
| runs-on: ubuntu-latest | ||
| # Only run clang builds on push to main branch | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
|
|
||
| strategy: | ||
| matrix: | ||
| build_type: [Debug, Release] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake build-essential clang libglfw3-dev | ||
|
|
||
| - name: Setup compiler | ||
| run: | | ||
| echo "CC=clang" >> $GITHUB_ENV | ||
| echo "CXX=clang++" >> $GITHUB_ENV | ||
|
|
||
| - name: Configure CMake | ||
| run: | | ||
| echo "Configuring build ${{ matrix.build_type }} with clang (with system GLFW)" | ||
| cmake -B build/${{ matrix.build_type }} \ | ||
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | ||
| -DCCAP_BUILD_EXAMPLES=ON \ | ||
| -DCCAP_BUILD_TESTS=ON | ||
|
|
||
| - name: Build | ||
| run: cmake --build build/${{ matrix.build_type }} --config ${{ matrix.build_type }} --parallel $(nproc) | ||
|
|
||
| - name: Verify build outputs | ||
| working-directory: build/${{ matrix.build_type }} | ||
| run: | | ||
| echo "Checking built examples:" | ||
| ls -la | grep -E "(glfw|example)" || echo "No examples found" | ||
| echo "✓ Build completed successfully" | ||
|
|
||
| - name: Run Unit Tests | ||
| if: matrix.build_type == 'Release' | ||
| run: | | ||
| cd scripts | ||
| ./run_tests.sh --functional --exit-when-failed | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ccap-linux-clang-${{ matrix.build_type }} | ||
| path: | | ||
| build/${{ matrix.build_type }}/libccap.a | ||
| build/${{ matrix.build_type }}/0-print_camera | ||
| build/${{ matrix.build_type }}/1-minimal_example | ||
| build/${{ matrix.build_type }}/2-capture_grab | ||
| build/${{ matrix.build_type }}/3-capture_callback | ||
| build/${{ matrix.build_type }}/4-example_with_glfw | ||
| build/${{ matrix.build_type }}/*_results.xml | ||
| if-no-files-found: warn | ||
|
|
||
| build-ubuntu-arm64: | ||
| name: "Build ARM64 (${{ matrix.build_type }}-gcc)" | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| build_type: [Debug, Release] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install cross-compilation toolchain | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake build-essential gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
| echo "Cross-compilation toolchain installed" | ||
|
|
||
| - name: Configure CMake for ARM64 | ||
| run: | | ||
| echo "Configuring build ${{ matrix.build_type }} for ARM64 (cross-compilation)" | ||
| cmake -B build/arm64/${{ matrix.build_type }} \ | ||
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | ||
| -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ | ||
| -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ | ||
| -DCMAKE_SYSTEM_NAME=Linux \ | ||
| -DCMAKE_SYSTEM_PROCESSOR=aarch64 \ | ||
| -DCMAKE_CROSSCOMPILING=ON \ | ||
| -DCCAP_BUILD_EXAMPLES=ON \ | ||
| -DCCAP_BUILD_TESTS=OFF | ||
|
|
||
| - name: Build ARM64 | ||
| run: cmake --build build/arm64/${{ matrix.build_type }} --config ${{ matrix.build_type }} --parallel $(nproc) | ||
|
|
||
| - name: Verify build outputs | ||
| working-directory: build/arm64/${{ matrix.build_type }} | ||
| run: | | ||
| echo "Checking built ARM64 binaries:" | ||
| ls -la | grep -E "(ccap|example)" || echo "No examples found" | ||
| echo "Verifying ARM64 architecture:" | ||
| file libccap.a | grep -q "aarch64" && echo "✓ Library is ARM64" || echo "⚠ Library architecture verification failed" | ||
| if [ -f "0-print_camera" ]; then | ||
| file 0-print_camera | grep -q "aarch64" && echo "✓ Binary is ARM64" || echo "⚠ Binary architecture verification failed" | ||
| fi | ||
| echo "✓ ARM64 cross-compilation completed successfully" | ||
|
|
||
| - name: Upload ARM64 artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ccap-linux-arm64-gcc-${{ matrix.build_type }} | ||
| path: | | ||
| build/arm64/${{ matrix.build_type }}/libccap.a | ||
| build/arm64/${{ matrix.build_type }}/0-print_camera | ||
| build/arm64/${{ matrix.build_type }}/1-minimal_example | ||
| build/arm64/${{ matrix.build_type }}/2-capture_grab | ||
| build/arm64/${{ matrix.build_type }}/3-capture_callback | ||
| build/arm64/${{ matrix.build_type }}/4-example_with_glfw | ||
| build/arm64/${{ matrix.build_type }}/*_results.xml | ||
| if-no-files-found: warn | ||
|
|
||
| build-fedora: | ||
| name: "Build Fedora (${{ matrix.build_type }})" | ||
| runs-on: ubuntu-latest | ||
| container: fedora:latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| build_type: [Debug, Release] | ||
|
|
||
| steps: | ||
| - name: Install Git first | ||
| run: | | ||
| dnf update -y | ||
| dnf install -y git | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| dnf install -y cmake gcc-c++ make | ||
|
|
||
| - name: Configure CMake | ||
| run: | | ||
| cmake -B build/${{ matrix.build_type }} \ | ||
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | ||
| -DCCAP_BUILD_EXAMPLES=ON \ | ||
| -DCCAP_BUILD_TESTS=ON | ||
|
|
||
| - name: Build | ||
| run: cmake --build build/${{ matrix.build_type }} --config ${{ matrix.build_type }} --parallel $(nproc) | ||
|
|
||
| - name: Run Unit Tests | ||
| if: matrix.build_type == 'Release' | ||
| run: | | ||
| cd scripts | ||
| ./run_tests.sh --functional --exit-when-failed | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ccap-fedora-${{ matrix.build_type }} | ||
| path: | | ||
| build/${{ matrix.build_type }}/libccap.a | ||
| build/${{ matrix.build_type }}/0-print_camera | ||
| build/${{ matrix.build_type }}/1-minimal_example | ||
| build/${{ matrix.build_type }}/2-capture_grab | ||
| build/${{ matrix.build_type }}/3-capture_callback | ||
| build/${{ matrix.build_type }}/*_results.xml | ||
| if-no-files-found: warn | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.