-
Notifications
You must be signed in to change notification settings - Fork 353
feat(v2): bootstrap RunAnywhere v2 architecture — C++20 core, 5 frontends, proto3 IDL #485
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
base: main
Are you sure you want to change the base?
Changes from 12 commits
549f365
c768c20
83b62bf
1d66434
64df64e
a3fc998
d4f886b
938f2e5
025cca9
c3060a0
4bc75c7
83d605c
8489032
ca7a929
ae752a0
1a6e569
77f6bcd
786d171
faa737e
00db21a
f687470
be6bc88
288b742
241b404
b6f37c1
67d36a7
5794515
239a08e
7e15d31
cab2a5e
d109a64
b43a742
15e66c5
b0d8aa6
0982919
ce5462f
5af6b18
9c28256
6a22dd2
efe65aa
667602c
e3b410a
c94097f
7459ef5
97b0ea7
54b8694
c3e095f
25fd767
a949c03
5485984
7c154a2
7b25b16
e2e1279
e0e1675
5fc1110
266cd70
262058d
cf3e928
bac5446
8562808
8e10111
f08e363
52a989e
b388b6d
9e69a44
9ad9a56
dca3d3e
e8f9b40
2411147
33c6664
e1a1a6d
452a78a
040b890
26c96b3
9dfde09
1ffed7e
83c415e
f853e0b
c830dbf
0535eb7
5df7d4e
acd334e
73d9431
ae16a13
e7ced33
e710720
93d5ef5
4432020
aa21aa8
2633497
a2dbe20
46c3182
c8ffe3b
bccaf4e
55c6eab
b0ce18f
686c4d8
e42760d
fbb112c
afc34bb
14b6549
a14cc89
2207ed8
b65a480
9959abc
10b9f68
9a0fe89
25c6cfd
0f5cf20
4e14a1d
63b3701
e712c4a
9b55b48
39c18a0
6248ef9
bf15e6b
e5093b9
ea57669
45004af
b8f3be5
9a3111e
a6f4305
1a7a99f
62ce760
46885d7
ecbd717
3528d7e
f52b4ac
9ac4611
cafc539
ad3f6bc
27b0a18
b46790a
2690024
0d813b4
d638f70
852d8c7
fda1bc0
8f5b6c3
a63285c
fb040c6
1d4a387
a1410bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # clangd config — used by IDEs until CMake produces compile_commands.json. | ||
| # After running `cmake --preset macos-debug`, clangd picks up the full flags | ||
| # from build/macos-debug/compile_commands.json. | ||
|
|
||
| CompileFlags: | ||
| Add: | ||
| - "-std=c++20" | ||
| - "-xc++" | ||
| - "-Wall" | ||
| - "-Wextra" | ||
| - "-Wpedantic" | ||
| - "-I${workspaceFolder}/core" | ||
| - "-I${workspaceFolder}/core/abi" | ||
| CompilationDatabase: build/macos-debug | ||
|
|
||
| Diagnostics: | ||
| UnusedIncludes: Strict | ||
| ClangTidy: | ||
| Add: | ||
| - modernize-* | ||
| - performance-* | ||
| - bugprone-* | ||
| - cppcoreguidelines-* | ||
| Remove: | ||
| - modernize-use-trailing-return-type | ||
| - modernize-avoid-c-arrays | ||
| - cppcoreguidelines-avoid-c-arrays | ||
| - cppcoreguidelines-pro-type-union-access | ||
| - cppcoreguidelines-pro-bounds-array-to-pointer-decay | ||
| - cppcoreguidelines-pro-bounds-pointer-arithmetic | ||
|
|
||
| Index: | ||
| Background: Build | ||
|
|
||
| InlayHints: | ||
| Enabled: Yes | ||
| ParameterNames: Yes | ||
| DeducedTypes: Yes | ||
|
|
||
| --- | ||
| # C/ABI headers are plain C — exclude C++ flags. | ||
| If: | ||
| PathMatch: [ "core/abi/.*\\.h", "core/abi/.*\\.c" ] | ||
| CompileFlags: | ||
| Add: | ||
| - "-xc" | ||
| - "-std=c11" | ||
| Remove: | ||
| - "-std=c++20" | ||
| - "-xc++" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| name: v2 core | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'core/**' | ||
| - 'engines/**' | ||
| - 'solutions/**' | ||
| - 'frontends/**' | ||
| - 'idl/**' | ||
| - 'cmake/**' | ||
| - 'tools/**' | ||
| - 'CMakeLists.txt' | ||
| - 'CMakePresets.json' | ||
| - 'vcpkg.json' | ||
| - '.github/workflows/v2-core.yml' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'core/**' | ||
| - 'engines/**' | ||
| - 'solutions/**' | ||
| - 'frontends/**' | ||
| - 'idl/**' | ||
| - 'cmake/**' | ||
| - 'tools/**' | ||
| - 'CMakeLists.txt' | ||
| - 'CMakePresets.json' | ||
| - 'vcpkg.json' | ||
| - '.github/workflows/v2-core.yml' | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: v2-core-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # C++ core + engines + solutions — macOS Debug (ASan + UBSan). | ||
| # --------------------------------------------------------------------------- | ||
| cpp-macos: | ||
| runs-on: macos-14 | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install build deps | ||
| run: | | ||
| brew install cmake ninja protobuf | ||
| - name: Configure (macOS Debug, sanitizers ON) | ||
| run: | | ||
| cmake --preset macos-debug -DRA_BUILD_ENGINES=ON -DRA_BUILD_SOLUTIONS=ON | ||
| - name: Build | ||
| run: cmake --build --preset macos-debug | ||
| - name: Test | ||
| run: ctest --preset macos-debug --output-on-failure | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # C++ core + engines + solutions — Linux Debug (ASan + UBSan). | ||
| # --------------------------------------------------------------------------- | ||
| cpp-linux: | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install build deps | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends \ | ||
| cmake ninja-build g++ protobuf-compiler libprotobuf-dev libgtest-dev | ||
| - name: Configure (Linux Debug, sanitizers ON) | ||
| run: | | ||
| cmake --preset linux-debug -DRA_BUILD_ENGINES=ON -DRA_BUILD_SOLUTIONS=ON | ||
| - name: Build | ||
| run: cmake --build --preset linux-debug | ||
| - name: Test | ||
| run: ctest --preset linux-debug --output-on-failure | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Proto codegen — verify checked-in generated files are up-to-date. | ||
| # --------------------------------------------------------------------------- | ||
| proto-codegen-swift: | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
|
||
| runs-on: macos-14 | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install protoc + swift-protobuf | ||
| run: brew install protobuf swift-protobuf | ||
| - name: Regenerate Swift bindings | ||
| run: ./idl/codegen/generate_swift.sh | ||
| - name: Verify no drift (only when generated files are already committed) | ||
| run: | | ||
| # Phase 0 bootstrap: Generated/ only contains .gitkeep. After the | ||
| # first real landing of generated files (tracked under | ||
| # Generated/*.pb.swift), the drift check becomes strict. | ||
| TRACKED_PB=$(git ls-files 'frontends/swift/Sources/RunAnywhere/Generated/*.pb.swift') | ||
| if [[ -z "$TRACKED_PB" ]]; then | ||
| echo "No generated .pb.swift files tracked yet — drift check skipped until first codegen PR." | ||
| exit 0 | ||
| fi | ||
| if [[ -n "$(git status --porcelain frontends/swift/Sources/RunAnywhere/Generated)" ]]; then | ||
| echo "Generated Swift files are stale. Run ./idl/codegen/generate_swift.sh and commit." >&2 | ||
| git --no-pager diff frontends/swift/Sources/RunAnywhere/Generated >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Swift frontend — SwiftPM build + test (macOS). Generated/ stays empty in | ||
| # this PR so SwiftPM falls back to adapter-only compilation. | ||
| # --------------------------------------------------------------------------- | ||
| swift-frontend: | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
| runs-on: macos-14 | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: swift-actions/setup-swift@v2 | ||
| with: | ||
| swift-version: '5.9' | ||
| - name: Build RunAnywhereV2 (SwiftPM) | ||
| working-directory: frontends/swift | ||
| run: swift build -v | ||
| - name: Run tests | ||
| working-directory: frontends/swift | ||
| run: swift test -v | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Kotlin frontend — Gradle build + unit tests. | ||
| # --------------------------------------------------------------------------- | ||
| kotlin-frontend: | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment on lines
+85
to
+169
|
||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '17' | ||
| - name: Build frontends/kotlin | ||
| working-directory: frontends/kotlin | ||
| run: gradle --no-daemon build | ||
| - name: Test frontends/kotlin | ||
| working-directory: frontends/kotlin | ||
| run: gradle --no-daemon test | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Dart frontend — analyze + test. | ||
| # --------------------------------------------------------------------------- | ||
| dart-frontend: | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment on lines
+170
to
+201
|
||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dart-lang/setup-dart@v1 | ||
| with: | ||
| sdk: stable | ||
| - name: Pub get | ||
| working-directory: frontends/dart | ||
| run: dart pub get | ||
| - name: Analyze | ||
| working-directory: frontends/dart | ||
| run: dart analyze | ||
| - name: Test | ||
| working-directory: frontends/dart | ||
| run: dart test | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # TS / RN frontend — tsc + vitest. | ||
| # --------------------------------------------------------------------------- | ||
| ts-frontend: | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment on lines
+202
to
+235
|
||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - name: Install TS deps | ||
| working-directory: frontends/ts | ||
| run: npm install --no-save | ||
| - name: Typecheck TS | ||
| working-directory: frontends/ts | ||
| run: npm run typecheck | ||
| - name: Test TS | ||
| working-directory: frontends/ts | ||
| run: npm test | ||
| - name: Install Web deps | ||
| working-directory: frontends/web | ||
| run: npm install --no-save | ||
| - name: Typecheck Web | ||
| working-directory: frontends/web | ||
| run: npm run typecheck | ||
| - name: Test Web | ||
| working-directory: frontends/web | ||
| run: npm test | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| # RunAnywhere v2 — top-level CMake entry point. | ||
| # | ||
| # This file is the entry point for the v2 monorepo build. It does NOT replace | ||
| # the legacy `sdk/runanywhere-commons/CMakeLists.txt` during the migration — v1 | ||
| # and v2 coexist until Phase 3 flips the default. | ||
| # | ||
| # Build the v2 core only: | ||
| # cmake --preset macos-debug | ||
| # cmake --build --preset macos-debug | ||
| # | ||
| # Build a specific frontend (e.g. Swift XCFramework): | ||
| # cmake --preset ios-release | ||
| # cmake --build --preset ios-release --target RunAnywhereCore | ||
| # | ||
| # See cmake/presets.json and docs/v2_build.md for the full matrix. | ||
|
|
||
| cmake_minimum_required(VERSION 3.22) | ||
|
|
||
| # Silence CMP0077 — option() honors normal vars. Required for vcpkg overlay. | ||
| if(POLICY CMP0077) | ||
| cmake_policy(SET CMP0077 NEW) | ||
| endif() | ||
|
|
||
| project(RunAnywhereV2 | ||
| VERSION 2.0.0 | ||
| DESCRIPTION "RunAnywhere v2 — C++20 core + codegen'd frontends for on-device AI" | ||
| LANGUAGES C CXX | ||
| ) | ||
|
|
||
| # Enable Objective-C++ only on Apple platforms where we need CoreML/AVFoundation bridges. | ||
| if(APPLE) | ||
| enable_language(OBJCXX) | ||
| endif() | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Global C++ settings | ||
| # --------------------------------------------------------------------------- | ||
| set(CMAKE_CXX_STANDARD 20) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| set(CMAKE_CXX_EXTENSIONS OFF) | ||
| set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
|
||
| # Default to Release if the user did not specify a build type. | ||
| if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
| set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) | ||
| endif() | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Options | ||
| # --------------------------------------------------------------------------- | ||
| option(RA_BUILD_TESTS "Build unit tests" ON) | ||
| option(RA_BUILD_TOOLS "Build tools/benchmark and pipeline-validator" ON) | ||
| option(RA_BUILD_FRONTENDS "Build frontends/*" OFF) | ||
| option(RA_BUILD_ENGINES "Build engines/*" ON) | ||
| option(RA_BUILD_SOLUTIONS "Build solutions/*" ON) | ||
| option(RA_ENABLE_SANITIZERS "Enable ASan/UBSan (Debug only)" ON) | ||
| option(RA_ENABLE_TSAN "Enable TSan (separate from ASan/UBSan)" OFF) | ||
| option(RA_ENABLE_LTO "Enable Link-Time Optimization on Release" OFF) | ||
|
|
||
| # Plugin discovery mode — mutually exclusive with the legacy commons tree. | ||
| option(RA_USE_LEGACY_COMMONS "Fall back to sdk/runanywhere-commons for engines" OFF) | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Platform detection + compiler flags | ||
| # --------------------------------------------------------------------------- | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/platform.cmake) | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/sanitizers.cmake) | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/plugins.cmake) | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.cmake) | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Subprojects | ||
| # --------------------------------------------------------------------------- | ||
| add_subdirectory(core) | ||
|
|
||
| if(RA_BUILD_ENGINES) | ||
| add_subdirectory(engines/llamacpp) | ||
| add_subdirectory(engines/sherpa) | ||
| add_subdirectory(engines/wakeword) | ||
| endif() | ||
|
|
||
| if(RA_BUILD_SOLUTIONS) | ||
| add_subdirectory(solutions/voice-agent) | ||
| add_subdirectory(solutions/rag) | ||
| endif() | ||
|
|
||
| if(RA_BUILD_FRONTENDS) | ||
| # Each frontend opts in via its own CMakeLists.txt — Swift uses XCFramework | ||
| # packaging; Kotlin uses Gradle (not CMake); Dart/TS use npm/pub. | ||
| if(RA_PLATFORM STREQUAL "IOS" OR RA_PLATFORM STREQUAL "MACOS") | ||
| add_subdirectory(frontends/swift) | ||
| endif() | ||
| if(RA_PLATFORM STREQUAL "WASM") | ||
| add_subdirectory(frontends/web/wasm) | ||
| endif() | ||
| endif() | ||
|
|
||
| if(RA_BUILD_TOOLS) | ||
| add_subdirectory(tools/benchmark) | ||
| add_subdirectory(tools/pipeline-validator) | ||
| endif() | ||
|
|
||
| if(RA_BUILD_TESTS AND NOT RA_PLATFORM STREQUAL "IOS" AND NOT RA_PLATFORM STREQUAL "WASM") | ||
| enable_testing() | ||
| add_subdirectory(core/tests) | ||
| endif() | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Summary | ||
| # --------------------------------------------------------------------------- | ||
| message(STATUS "") | ||
| message(STATUS "========================================================") | ||
| message(STATUS " RunAnywhere v2 build configuration") | ||
| message(STATUS "========================================================") | ||
| message(STATUS " Platform : ${RA_PLATFORM}") | ||
| message(STATUS " CXX : ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") | ||
| message(STATUS " Build type : ${CMAKE_BUILD_TYPE}") | ||
| message(STATUS " Sanitizers : ASan=${RA_ENABLE_SANITIZERS} TSan=${RA_ENABLE_TSAN}") | ||
| message(STATUS " Plugin mode : ${RA_PLUGIN_MODE} (iOS=static, others=dlopen)") | ||
| message(STATUS " Build engines : ${RA_BUILD_ENGINES}") | ||
| message(STATUS " Build solutions : ${RA_BUILD_SOLUTIONS}") | ||
| message(STATUS " Build frontends : ${RA_BUILD_FRONTENDS}") | ||
| message(STATUS " Build tests : ${RA_BUILD_TESTS}") | ||
| message(STATUS " Build tools : ${RA_BUILD_TOOLS}") | ||
| message(STATUS "========================================================") | ||
| message(STATUS "") |
Uh oh!
There was an error while loading. Please reload this page.