diff --git a/docs/building.md b/docs/building.md index 9939add..155679b 100644 --- a/docs/building.md +++ b/docs/building.md @@ -7,6 +7,16 @@ This doc explains what each CMake preset in [`CMakePresets.json`](../CMakePreset the missing middle: *how the presets relate to each other*, *which platform each targets*, and *how to drive the binaries by hand*. +**Quick navigation:** + +| What you want to build | Section | Key command | +|------------------------|---------|-------------| +| Server + `vccli` + tests (all platforms) | [§3](#3-build--test-the-loop-youll-run-constantly) | `cmake --preset dev && cmake --build --preset dev && ctest --preset dev` | +| Production server (stripped, no tests) | [§5](#5-server-release-production-shaped-build) | `cmake --preset server-release && cmake --build --preset server-release` | +| Windows client (C# / WinForms) | [§7](#7-windows-client-c--winforms) | `dotnet build clients/windows/VoiceCat.slnx` | +| macOS client (AppKit) | [§8](#8-macos-client-appkit) | `xcodebuild -project clients/apple/macOS/VoiceCatMac.xcodeproj -scheme VoiceCatMac build` | +| Swift core + tests | [§8](#8-macos-client-appkit) | `cd clients/apple && swift test` | + ## 1. What each preset is for | Preset | Binary dir | Deps | Build type | Server | Tools | Tests | Strip | Platform | What it's for | @@ -234,3 +244,106 @@ The three `.a` files are then stitched into an XCFramework via `xcodebuild planned workflow). Actual XCFramework stitching, `AVAudioSession` integration, and iOS UI work are tracked as follow-up tasks — the presets exist so the build entry point is ready when that work starts. + +## 7. Windows client (C# / WinForms) + +The Windows client is a .NET 10 WinForms app that loads `voicecat.dll` (the MinGW-built +shared library from the `windows-client` preset) via P/Invoke. Full details in +[`clients/windows/README.md`](../clients/windows/README.md). + +**Prerequisites:** .NET SDK 10, MinGW-w64 / MSYS2 UCRT64 (GCC 13+), vcpkg. + +### Build the DLL + +```powershell +cmake --preset windows-client +cmake --build --preset windows-client +# → build/windows-client/bin/voicecat.dll +``` + +### Build the C# solution + +```powershell +cd clients/windows +dotnet build VoiceCat.slnx +``` + +`Directory.Build.props` copies `voicecat.dll` into the output directory automatically. + +### Run the app + +```powershell +# Terminal 1 — start the server (built with the dev preset) +./build/dev/bin/voicecat-server.exe --name "My Server" + +# Terminal 2 — launch the client +dotnet run --project clients/windows/VoiceCat.App/VoiceCat.App.csproj +``` + +### Run the C# interop tests + +```powershell +dotnet test clients/windows/VoiceCat.slnx +``` + +## 8. macOS client (AppKit) + +The macOS client is an Xcode project (AppKit / Swift) that links `libvoicecat` via the +`VoiceCatCore` Swift Package, which consumes a binary XCFramework target. Full details in +[`clients/apple/README.md`](../clients/apple/README.md). + +**Prerequisites:** Xcode, vcpkg (`VCPKG_ROOT` set), macOS 14+ (deployment target). + +### Build the XCFramework + +The XCFramework is a local build artifact (gitignored, like the Windows DLL). It bundles +`libvoicecat.a` + all vcpkg static deps into a single fat `.a` per slice, plus staged +headers with a module map so Swift gets `import VoiceCatC`. + +```bash +# macOS slice only (default, validated) +clients/apple/scripts/build-xcframework.sh +# → clients/apple/VoiceCatCore.xcframework/ + +# All 3 slices (macOS + iOS device + iOS sim — iOS still scaffolding) +clients/apple/scripts/build-xcframework.sh --all +``` + +The script runs `cmake --preset apple-dev` + `cmake --build --preset apple-dev` internally, +then merges vcpkg's static deps with `libtool -static` and stitches the XCFramework with +`xcodebuild -create-xcframework`. + +### Build the Swift core (SPM) + +```bash +cd clients/apple +swift build # builds VoiceCatCore library +swift test # 6 smoke tests against a real voicecat-server +``` + +`swift test` requires the `dev` CMake preset to be built +(`build/dev/bin/voicecat-server` + `voicecat-admin`). + +### Build the macOS app (Xcode) + +```bash +xcodebuild -project clients/apple/macOS/VoiceCatMac.xcodeproj \ + -scheme VoiceCatMac -configuration Debug build +# → ~/Library/Developer/Xcode/DerivedData/VoiceCatMac-*/Build/Products/Debug/VoiceCatMac.app +``` + +Or open the project in Xcode and build from the UI: + +```bash +open clients/apple/macOS/VoiceCatMac.xcodeproj +``` + +### Run the app + +```bash +# Terminal 1 — start the server (built with the dev preset) +./build/dev/bin/voicecat-server --name "My Server" + +# Terminal 2 — launch the client +open ~/Library/Developer/Xcode/DerivedData/VoiceCatMac-*/Build/Products/Debug/VoiceCatMac.app +```