-
Notifications
You must be signed in to change notification settings - Fork 4
feat(rust): Add high-performance Rust bindings with SIMD acceleration #44
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 all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b271932
Add rust support
wysaid 9ad9a83
Fix demo error
wysaid a631e56
fix(rust): enable convert module and fix lifetime issues in frame.rs
wysaid 5957af3
feat(rust): add build-source feature for distribution
wysaid c5b74d3
fix(rust): support both repo and packaged directory structures in bui…
wysaid 1091a64
ci(rust): add comprehensive workflow for static-link and build-source
wysaid daa7738
fix(rust): Address PR review comments and fix critical issues
wysaid 8e3437c
fix(rust): Fix convert module API mismatches with C library
wysaid 7504426
fix(rust): Add file playback source files to build-source mode
wysaid 905dbef
fix(ci): Fix LIBCLANG_PATH escaping in GitHub Actions workflow
wysaid fee62d8
fix(rust,build,core): Align Rust version to 1.5.0, improve build safe…
wysaid c916c36
feat(rust): Complete Rust crate publication automation
wysaid 368658a
add tests
wysaid 43f02ba
rust: simplify async feature and tighten frame safety
wysaid b969240
refactor(rust): fix Provider lifecycle, improve cross-platform script…
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
Some comments aren't visible on the classic Files Changed page.
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,164 @@ | ||
| name: Rust CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| paths: | ||
| - 'bindings/rust/**' | ||
| - 'src/**' | ||
| - 'include/**' | ||
| - 'CMakeLists.txt' | ||
| - '.github/workflows/rust.yml' | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| paths: | ||
| - 'bindings/rust/**' | ||
| - 'src/**' | ||
| - 'include/**' | ||
| - 'CMakeLists.txt' | ||
| - '.github/workflows/rust.yml' | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| CCAP_SKIP_CAMERA_TESTS: 1 | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # Job 1: Static Linking (Development Mode) | ||
| # Verifies that the crate links correctly against a pre-built C++ library. | ||
| static-link: | ||
| name: Static Link (Dev) | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install system dependencies (Ubuntu) | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake build-essential pkg-config libclang-dev | ||
|
|
||
| - name: Install system dependencies (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| run: | | ||
| choco install cmake llvm -y | ||
|
|
||
| - name: Configure LIBCLANG_PATH (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| shell: pwsh | ||
| run: echo "LIBCLANG_PATH=C:\\Program Files\\LLVM\\bin" >> $env:GITHUB_ENV | ||
|
|
||
| - name: Install system dependencies (macOS) | ||
| if: matrix.os == 'macos-latest' | ||
| run: | | ||
| brew install cmake llvm | ||
| echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> $GITHUB_ENV | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| components: clippy, rustfmt | ||
| cache: false | ||
|
|
||
| # Build C++ Library (Linux/macOS) | ||
| # We build in build/Debug to match build.rs expectations for Unix Makefiles | ||
| - name: Build C library (Unix) | ||
| if: runner.os != 'Windows' | ||
| run: | | ||
| mkdir -p build/Debug | ||
| cd build/Debug | ||
| cmake -DCMAKE_BUILD_TYPE=Debug -DCCAP_BUILD_EXAMPLES=OFF -DCCAP_BUILD_TESTS=OFF ../.. | ||
| cmake --build . --config Debug --parallel | ||
|
|
||
| # Build C++ Library (Windows) | ||
| # Build both Debug and Release versions | ||
| # MSVC is a multi-config generator, so we build to build/ and specify config at build time | ||
| - name: Build C library (Windows) | ||
| if: runner.os == 'Windows' | ||
| run: | | ||
| mkdir build | ||
| cd build | ||
| cmake -DCCAP_BUILD_EXAMPLES=OFF -DCCAP_BUILD_TESTS=OFF .. | ||
| cmake --build . --config Debug --parallel | ||
| cmake --build . --config Release --parallel | ||
|
|
||
| - name: Check formatting | ||
| if: matrix.os == 'ubuntu-latest' | ||
| working-directory: bindings/rust | ||
| run: cargo fmt -- --check | ||
|
|
||
| - name: Run clippy | ||
| if: matrix.os == 'ubuntu-latest' | ||
| working-directory: bindings/rust | ||
| run: cargo clippy --all-targets --no-default-features --features static-link -- -D warnings | ||
|
|
||
| - name: Build Rust bindings | ||
| working-directory: bindings/rust | ||
| run: cargo build --verbose --no-default-features --features static-link | ||
|
|
||
| - name: Run tests | ||
| working-directory: bindings/rust | ||
| run: cargo test --verbose --no-default-features --features static-link | ||
|
|
||
| # Job 2: Source Build (Distribution Mode) | ||
| # Verifies that the crate builds correctly from source using the cc crate. | ||
| # This is crucial for crates.io distribution. | ||
| build-source: | ||
| name: Build Source (Dist) | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install system dependencies (Ubuntu) | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential pkg-config | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Install system dependencies (macOS) | ||
| if: matrix.os == 'macos-latest' | ||
| run: brew install llvm | ||
|
|
||
| - name: Install system dependencies (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| run: | | ||
| choco install llvm -y | ||
| refreshenv | ||
|
|
||
| - name: Configure LIBCLANG_PATH (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| shell: pwsh | ||
| run: echo "LIBCLANG_PATH=C:\\Program Files\\LLVM\\bin" >> $env:GITHUB_ENV | ||
|
|
||
| - name: Configure LIBCLANG_PATH (macOS) | ||
| if: matrix.os == 'macos-latest' | ||
| run: echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> $GITHUB_ENV | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| cache: false | ||
| # The build.rs script should handle it via the 'build-source' feature. | ||
|
|
||
| - name: Build Rust bindings (Source) | ||
| working-directory: bindings/rust | ||
| # Disable default features (static-link) and enable build-source | ||
| run: cargo build --verbose --no-default-features --features build-source | ||
|
|
||
| - name: Run tests (Source) | ||
| working-directory: bindings/rust | ||
| run: cargo test --verbose --no-default-features --features build-source | ||
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
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
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
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.