Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e6d9c86
Better code comments
wysaid Aug 7, 2025
9244005
Add pixel convert for c
wysaid Aug 7, 2025
6a72360
Better C interface export
wysaid Aug 7, 2025
1e51736
Add demo for C
wysaid Aug 7, 2025
e430ef8
Fix callback handlding err in C interface
wysaid Aug 7, 2025
319229c
Add accelerated implementation with NEON version
wysaid May 29, 2025
cb37a83
Fix NEON version compilation issues
wysaid May 29, 2025
7a4c17b
add build scripts
wysaid May 29, 2025
ee291d3
support windows arm64
wysaid May 29, 2025
7fd69ba
Add YUYV and UYVY format conversion to NEON backend
wysaid Aug 7, 2025
ca1bd70
Add corresponding enum types for NEON backend
wysaid Aug 7, 2025
02d418d
Optimize iOS Demo, support more options
wysaid Aug 7, 2025
fc86f36
Better support for high frame rate (60/120) mode on Apple devices
wysaid Aug 7, 2025
9269627
better comments
wysaid Aug 7, 2025
073af5d
Fix compile err
wysaid Aug 7, 2025
0dd27e4
Fix invalid backend checking
wysaid Aug 8, 2025
96cea16
Add missing tests
wysaid Aug 8, 2025
3bff10d
try fix neon acc
wysaid Aug 9, 2025
ee966cc
Bugfix: pass all tests of neon acc
wysaid Aug 11, 2025
f177f41
better comments
wysaid Aug 11, 2025
e908e86
Fix demo compile err
wysaid Aug 11, 2025
a01f0ed
Small fix
wysaid Aug 11, 2025
889b63f
better release tasks
wysaid Aug 11, 2025
1e252fc
Fix tests compile error when cross compiling
wysaid Aug 11, 2025
7a69741
Run arm64 linux unit tests in PRs
wysaid Aug 11, 2025
5c2a306
Fix critical issues from AI code review comments
Copilot Aug 12, 2025
8211772
Address cross-platform compatibility and exception handling issues
Copilot Aug 12, 2025
170a691
Fix duplicate headings in scripts README.md
Copilot Aug 12, 2025
31db9ea
Simplify the overall design of the example to make the structure clea…
wysaid Aug 13, 2025
6df9632
When compiling for arm64, fix the restriction on the latest system ve…
wysaid Aug 13, 2025
271f821
Small fix
wysaid Aug 13, 2025
a143475
Simplify the examples
wysaid Aug 13, 2025
8ca622d
Fix compile err
wysaid Aug 13, 2025
4a12d2a
Initial plan for optimizing CcapDeviceInfo structure
Copilot Aug 13, 2025
9d156bf
Optimize CcapDeviceInfo structure with fixed-size arrays
Copilot Aug 13, 2025
7c44b74
Add optimized device names API and update all examples
Copilot Aug 13, 2025
ad67e02
Complete API optimization - remove legacy functions completely
Copilot Aug 13, 2025
8ebac50
Add workflow
wysaid Aug 13, 2025
d7a46ad
better examples
wysaid Aug 13, 2025
6ee3042
Use user context instead of global vars
wysaid Aug 13, 2025
470bf4e
Add more tasks
wysaid Aug 13, 2025
7977aab
Fix some bad practices and compilation warnings
wysaid Aug 13, 2025
fcfb85b
Add interface description
wysaid Aug 13, 2025
000062a
Remove trailing commas in tasks.json
wysaid Aug 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ jobs:
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'
# Run clang builds on push to main and on pull requests
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')

strategy:
matrix:
Expand Down Expand Up @@ -183,11 +183,41 @@ jobs:
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
-DCMAKE_CROSSCOMPILING=ON \
-DCCAP_BUILD_EXAMPLES=ON \
-DCCAP_BUILD_TESTS=OFF
-DCCAP_BUILD_TESTS=ON

- name: Build ARM64
run: cmake --build build/arm64/${{ matrix.build_type }} --config ${{ matrix.build_type }} --parallel $(nproc)


- name: Build ARM64 test target (Release only)
if: matrix.build_type == 'Release'
run: |
cmake --build build/arm64/${{ matrix.build_type }} --config ${{ matrix.build_type }} --target ccap_convert_test --parallel $(nproc)

- name: Install QEMU for ARM64 test emulation (PRs and main push, Release only)
if: (github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && matrix.build_type == 'Release'
run: |
sudo apt-get update
sudo apt-get install -y qemu-user qemu-user-static
qemu-aarch64 --version

- name: Run ARM64 Unit Tests (PRs and main push, Release only)
if: (github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && matrix.build_type == 'Release'
run: |
TEST_BIN="build/arm64/${{ matrix.build_type }}/tests/ccap_convert_test"
if [ ! -x "$TEST_BIN" ]; then
echo "Test binary not found: $TEST_BIN" >&2
ls -la "build/arm64/${{ matrix.build_type }}" || true
exit 1
fi
echo "Verifying test binary architecture:"
file "$TEST_BIN" || true
echo "Running ARM64 unit tests via QEMU..."
# Use the ARM64 sysroot provided by the cross toolchain for dynamic libs
qemu-aarch64 -L /usr/aarch64-linux-gnu "$TEST_BIN" \
--gtest_fail_fast \
--gtest_output=xml:build/arm64/${{ matrix.build_type }}/arm64_results.xml
echo "✓ ARM64 unit tests finished"

- name: Verify build outputs
working-directory: build/arm64/${{ matrix.build_type }}
run: |
Expand Down Expand Up @@ -252,7 +282,7 @@ jobs:
run: |
cd scripts
./run_tests.sh --functional --exit-when-failed

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
112 changes: 109 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,94 @@ on:
default: false

jobs:
# Run comprehensive tests before building release packages
test:
name: Run Full Test Suite
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true # Stop all jobs if any test fails
matrix:
include:
- os: windows-latest
name: Windows Tests
test_type: both

- os: ubuntu-latest
name: Linux Tests
test_type: both

- os: ubuntu-latest
name: Linux ARM64 Tests
test_type: functional
arch: arm64

- os: macos-latest
name: macOS Tests
test_type: both

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup cross-compilation for ARM64
if: matrix.arch == 'arm64'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user qemu-user-static

- name: Setup Visual Studio (Windows)
if: matrix.os == 'windows-latest'
uses: microsoft/setup-msbuild@v1.1

- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential gcc
if [ "${{ matrix.test_type }}" = "both" ]; then
sudo apt-get install -y libglfw3-dev
fi

- name: Run Tests
shell: bash
run: |
cd scripts
echo "=== Running ${{ matrix.name }} ==="

if [ "${{ matrix.arch }}" = "arm64" ]; then
# ARM64 cross-compilation tests
echo "Running ARM64 functional tests..."
./run_tests.sh --functional --exit-when-failed
elif [ "${{ matrix.test_type }}" = "both" ]; then
# Full test suite (functional + performance)
echo "Running full test suite..."
./run_tests.sh --functional --exit-when-failed
./run_tests.sh --performance --exit-when-failed
else
# Functional tests only
echo "Running functional tests..."
./run_tests.sh --functional --exit-when-failed
fi

echo "✅ ${{ matrix.name }} completed successfully!"

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.name }}-${{ github.run_id }}
path: |
build/**/test_results.xml
build/**/*_results.xml
retention-days: 7
if-no-files-found: ignore

build:
name: Build Release Packages
needs: test
strategy:
fail-fast: false
matrix:
Expand All @@ -34,6 +121,7 @@ jobs:
- os: windows-latest
name: Windows
artifact_name: ccap-msvc-x86_64
build_type: Release

- os: ubuntu-latest
name: Linux
Expand Down Expand Up @@ -238,7 +326,7 @@ jobs:
retention-days: 5

release:
needs: build
needs: [test, build]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -296,6 +384,16 @@ jobs:
cat > release_notes.md << 'EOF'
## 🚀 ccap ${{ steps.release_type.outputs.tag_name }}

### ✅ Quality Assurance

**All packages have passed comprehensive unit tests before release:**
- ✅ **Windows Tests**: Functional and performance tests on Windows platform
- ✅ **Linux x86_64 Tests**: Functional and performance tests on Linux
- ✅ **Linux ARM64 Tests**: Cross-compiled functional tests with QEMU validation
- ✅ **macOS Tests**: Functional and performance tests on macOS platform

> **Note**: This release was only created after ALL platform tests passed successfully. Any test failure would have prevented the release.

### 📦 Downloads

**Supported Platforms:**
Expand Down Expand Up @@ -369,13 +467,21 @@ jobs:
echo "## 🎉 Release Created Successfully!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Release**: ${{ steps.release_type.outputs.release_name }}" >> $GITHUB_STEP_SUMMARY
echo "**Tag**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "**Tag**: ${{ steps.release_type.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY
echo "**Prerelease**: ${{ steps.release_type.outputs.prerelease }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### ✅ Quality Assurance" >> $GITHUB_STEP_SUMMARY
echo "- ✅ **Windows Tests**: All functional and performance tests passed" >> $GITHUB_STEP_SUMMARY
echo "- ✅ **Linux x86_64 Tests**: All functional and performance tests passed" >> $GITHUB_STEP_SUMMARY
echo "- ✅ **Linux ARM64 Tests**: Cross-compilation and functional tests passed" >> $GITHUB_STEP_SUMMARY
echo "- ✅ **macOS Tests**: All functional and performance tests passed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "> 🛡️ **This release was only created after ALL tests passed successfully!**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📦 Included Files:" >> $GITHUB_STEP_SUMMARY
echo "- ccap-macos-universal.tar.gz" >> $GITHUB_STEP_SUMMARY
echo "- ccap-msvc-x86_64.zip (includes Debug and Release versions)" >> $GITHUB_STEP_SUMMARY
echo "- ccap-linux-x86_64.tar.gz" >> $GITHUB_STEP_SUMMARY
echo "- ccap-linux-arm64.tar.gz" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Release page: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "Release page: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.release_type.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build/
.idea/
dev.cmake
/install
build-*
31 changes: 31 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,37 @@
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "Run Shuffle Tests",
"type": "shell",
"command": "bash",
"args": [
"-l",
"run_tests.sh",
"--shuffle"
],
"options": {
"cwd": "${workspaceFolder}/scripts"
},
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "Run Shuffle Tests (Fast)",
"type": "shell",
"command": "bash",
"args": [
"-l",
"run_tests.sh",
"--shuffle",
"--exit-when-failed"
],
"options": {
"cwd": "${workspaceFolder}/scripts"
},
"group": "build",
"problemMatcher": "$gcc"
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
{
"label": "Run All Tests",
"type": "shell",
Expand Down
39 changes: 39 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,45 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OS X deployment version")

# Unified ARM64 force compilation option, supports both macOS and Windows
option(CCAP_FORCE_ARM64 "Force ARM64 architecture compilation" OFF)

if(CCAP_FORCE_ARM64)
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Build architectures for Mac OS X" FORCE)
message(STATUS "ccap: Forcing ARM64 architecture compilation for macOS")
elseif(WIN32)
Comment thread
wysaid marked this conversation as resolved.
set(CMAKE_GENERATOR_PLATFORM "ARM64" CACHE STRING "Generator platform for Windows" FORCE)
message(STATUS "ccap: Forcing ARM64 architecture compilation for Windows")
endif()
endif()

# Detect ARM64 architecture and set corresponding compile flags
if(CMAKE_SYSTEM_PROCESSOR MATCHES "[Aa][Rr][Mm]64|[Aa][Aa][Rr][Cc]h64" OR
CMAKE_GENERATOR_PLATFORM MATCHES "[Aa][Rr][Mm]64" OR
CMAKE_OSX_ARCHITECTURES MATCHES "[Aa][Rr][Mm]64" OR
Comment thread
wysaid marked this conversation as resolved.
CCAP_FORCE_ARM64)

message(STATUS "ccap: Building for ARM64 architecture")

# Windows ARM64 特定设置
if(WIN32 AND MSVC)
# MSVC 在 ARM64 上自动启用 NEON,添加预处理器定义
add_compile_definitions(_M_ARM64=1)
message(STATUS "ccap: NEON support enabled for Windows ARM64")
endif()

# macOS ARM64 特定设置
if(APPLE)
# Ensure a valid deployment target for macOS arm64
if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "11.0")
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version" FORCE)
message(STATUS "ccap: Bumping macOS deployment target to 11.0 for ARM64")
endif()
message(STATUS "ccap: NEON support enabled for macOS ARM64")
endif()
endif()

if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
endif()
Expand Down
7 changes: 6 additions & 1 deletion examples/desktop.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ endif()

message(STATUS "ccap: GLFW available: ${GLFW_AVAILABLE}")

add_library(common_utils STATIC ${DESKTOP_EXAMPLES_DIR}/utils/helper.cpp)
target_include_directories(common_utils PRIVATE ${DESKTOP_EXAMPLES_DIR}/utils)
target_link_libraries(common_utils PUBLIC ccap)

file(GLOB EXAMPLE_SOURCE ${DESKTOP_EXAMPLES_DIR}/*.cpp ${DESKTOP_EXAMPLES_DIR}/*.c)

foreach(EXAMPLE ${EXAMPLE_SOURCE})
Expand All @@ -48,7 +52,8 @@ foreach(EXAMPLE ${EXAMPLE_SOURCE})
endif()

add_executable(${EXAMPLE_NAME} ${EXAMPLE})
target_link_libraries(${EXAMPLE_NAME} PRIVATE ccap)
target_compile_definitions(${EXAMPLE_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS=1)
target_link_libraries(${EXAMPLE_NAME} PRIVATE common_utils)

if(APPLE)
target_link_options(${EXAMPLE_NAME} PRIVATE
Expand Down
23 changes: 2 additions & 21 deletions examples/desktop/1-minimal_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,11 @@
*
*/

#include "utils/helper.h"

Comment thread
wysaid marked this conversation as resolved.
#include <ccap.h>
#include <iostream>

int selectCamera(ccap::Provider& provider) {
if (auto names = provider.findDeviceNames(); names.size() > 1) {
std::cout << "Multiple devices found, please select one:" << std::endl;
for (size_t i = 0; i < names.size(); ++i) {
std::cout << " " << i << ": " << names[i] << std::endl;
}
int selectedIndex;
std::cout << "Enter the index of the device you want to use: ";
std::cin >> selectedIndex;
if (selectedIndex < 0 || selectedIndex >= static_cast<int>(names.size())) {
selectedIndex = 0;
std::cerr << "Invalid index, using the first device:" << names[0] << std::endl;
} else {
std::cout << "Using device: " << names[selectedIndex] << std::endl;
}
return selectedIndex;
}

return -1; // One or no device, use default.
}

int main() {
ccap::Provider cameraProvider;
cameraProvider.open(selectCamera(cameraProvider), true);
Expand Down
Loading
Loading