commit dfb7c93cfbead78ce1d4d9753ec56a972390252f
parent 3062522ae6403425949e387c26169b2edd43a852
Author: triesap <tyson@radroots.org>
Date: Sun, 26 Jul 2026 22:41:02 +0000
ffi: inherit Cargo target directory
- Honor CARGO_TARGET_DIR across device, simulator, host, and UniFFI builds.
- Preserve TARGET_DIR as the explicit normalized Make override.
- Retain the deterministic repository-local standalone fallback.
- Document the public target and generated-output contract.
Diffstat:
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/RadrootsFFI/Makefile b/RadrootsFFI/Makefile
@@ -20,7 +20,11 @@ GENERATED_SWIFT_DIR := $(APP_ROOT)/Generated
BUILD_ROOT := $(CURDIR)/.build
SOURCE_ROOT := $(BUILD_ROOT)/source
+TARGET_DIR ?= $(CARGO_TARGET_DIR)
+ifeq ($(strip $(TARGET_DIR)),)
TARGET_DIR := $(BUILD_ROOT)/target
+endif
+override TARGET_DIR := $(abspath $(TARGET_DIR))
OUT_DIR := $(BUILD_ROOT)/out
GENERATED_DIR := $(OUT_DIR)/generated
HEADERS_DIR := $(OUT_DIR)/headers
@@ -74,6 +78,7 @@ print-config:
@echo "UNIFFI_CONFIG=$(UNIFFI_CONFIG)"
@echo "ARTIFACTS_DIR=$(ARTIFACTS_DIR)"
@echo "GENERATED_SWIFT_DIR=$(GENERATED_SWIFT_DIR)"
+ @echo "TARGET_DIR=$(TARGET_DIR)"
@echo "IPHONEOS_DEPLOYMENT_TARGET=$(IPHONEOS_DEPLOYMENT_TARGET)"
@echo "RUSTUP_TOOLCHAIN=$(RUSTUP_TOOLCHAIN)"
@echo "RUSTC_BIN=$(RUSTC_BIN)"
diff --git a/RadrootsFFI/README.md b/RadrootsFFI/README.md
@@ -1,32 +1,37 @@
# RadrootsFFI
-`ios/RadrootsFFI` is the source resolver and build workspace for the Rust FFI
-artifact consumed by `ios/RadrootsKit`.
+`RadrootsFFI` is the source resolver and build workspace for the Rust FFI
+artifact consumed by the Radroots iOS app.
## Goals
- keep the iOS project openable and buildable in Xcode for OSS developers
-- keep `radroots-app-ffi-swift` reusable for other Apple clients
+- keep `radroots_app_ffi` reusable for other Apple clients
- support three source modes from one Makefile: `git`, `crates`, and `local`
## Quick start
-- build everything: `make -C ios all`
-- print current config: `make -C ios print-config`
-- rebuild from scratch: `make -C ios distclean all`
+- build everything: `make all`
+- print current config: `make print-config`
+- rebuild from scratch: `make distclean all`
## Source modes
- `SOURCE_MODE=git` (default)
- - clones `RADROOTS_CRATES_GIT_URL` at `RADROOTS_CRATES_GIT_REV`
- - builds `app-ffi-swift` from the checked out workspace
+ - clones `RADROOTS_FIELD_LIB_GIT_URL` at `RADROOTS_FIELD_LIB_GIT_REV`
+ - builds `radroots_app_ffi` from the checked out workspace
- `SOURCE_MODE=crates`
- - downloads `radroots-app-ffi-swift` from crates.io by version
+ - downloads `radroots_app_ffi` from crates.io by version
- `SOURCE_MODE=local`
- - requires `LOCAL_FFI_MANIFEST=/absolute/path/to/app-ffi-swift/Cargo.toml`
+ - requires `LOCAL_FFI_MANIFEST=/absolute/path/to/radroots_app_ffi/Cargo.toml`
## Configuration
Configuration is read from:
- `RadrootsFFI/source.lock` for pinned defaults
- `RadrootsFFI/Config/ffi-build.env` for optional local overrides
+Cargo output defaults to `RadrootsFFI/.build/target` for standalone use. An
+inherited `CARGO_TARGET_DIR` relocates the complete device, simulator, host, and
+UniFFI build graph. `TARGET_DIR=/absolute/path` is the equivalent explicit Make
+override; when both are present, `TARGET_DIR` takes precedence.
+
## Outputs
-- xcframework: `ios/RadrootsKit/Artifacts/RadrootsFFI.xcframework`
-- generated swift bindings: `ios/RadrootsKit/Sources/RadrootsKit/Generated`
+- xcframework: `Radroots/Frameworks/RadrootsFFI.xcframework`
+- generated Swift bindings: `Radroots/Generated`