sdk/runanywhere-electron/docs/DEVELOPMENT.md
Contributor guide for building and testing @runanywhere/electron from source on Windows.
private: true, os: win32 only)windows-release presetnpm install)From sdk/runanywhere-electron:
npm install
npm run build # TypeScript -> dist/
npm run bundle:native # copy the built .node + DLLs into prebuilds/
npm test # unit tests (hermetic, no native addon needed)
Integration tests need the addon and downloaded models:
$env:RUNANYWHERE_NATIVE_PATH = '<path>/runanywhere_native.node'
npm run test:integration
See native/CMakeLists.txt and the commons build docs for compiling the native addon against runanywhere-commons.
The default build is CPU-only. To offload inference to an NVIDIA GPU, build commons with -DRAC_GPU_CUDA=ON (CUDA toolkit ≥ 12.4 and MSVC). At load time, llama.cpp auto-offloads layers that fit VRAM.
# From the repo root. Set CMAKE_CUDA_ARCHITECTURES to your GPU (86 = RTX 30-series).
$env:NVCC_PREPEND_FLAGS = '-allow-unsupported-compiler' # only if MSVC is newer than the CUDA toolkit officially supports
cmake -S . -B build/windows-cuda -G "Visual Studio 17 2022" -A x64 `
-T cuda="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6" `
-DRAC_GPU_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 `
-DRAC_BUILD_ELECTRON_ADDON=ON -DRAC_BUILD_BACKENDS=ON -DRAC_STATIC_PLUGINS=ON -DRAC_BUILD_SHARED=OFF
cmake --build build/windows-cuda --config Release --target runanywhere_native --parallel
Place the built runanywhere_native.node in prebuilds/win32-x64-cuda/ beside its DLLs: cudart64_12.dll, cublas64_12.dll, cublasLt64_12.dll (from the CUDA bin/) plus onnxruntime.dll, onnxruntime_providers_shared.dll, sherpa-onnx-c-api.dll.
Then run npm run bundle:native or copy manually. The demo's examples/electron/RunAnywhereAI/run-demo-gpu.cmd launches against that prebuild.
From the repo root:
examples\electron\RunAnywhereAI\run-demo.cmd
Or manually:
set RUNANYWHERE_NATIVE_PATH=sdk\runanywhere-electron\prebuilds\win32-x64\runanywhere_native.node
npx electron examples/electron/RunAnywhereAI
When bundling into an Electron app, unpack native artifacts from the asar:
// electron-builder config
"asarUnpack": ["**/node_modules/@runanywhere/electron/prebuilds/**"]