Repository navigation
Description
Goal
Always compile the Rust ports, in one CMake configure. Choose at link time which libobs gets them, and stop treating ENABLE_RUST_LIBOBS ON/OFF as two build configurations.
For now, the packaged artifact is the C libobs. The Rust-linked libobs is built and tested on every build, but nothing ships it.
Today
option(ENABLE_RUST_LIBOBS ... OFF)picks sources at configure time:- 48
$<$<NOT:$<BOOL:${ENABLE_RUST_LIBOBS}>>:...>generator expressions inlibobs/CMakeLists.txt; - more in
libobs/cmake/os-{windows,macos,linux,freebsd}.cmake; plugins/obs-nvenc(cuda-load.cvscuda-load-rust.c).
- 48
- Tier 2 configures and builds libobs twice, OFF then ON (
rust/tools/linux-validate/validate.shandrust/tools/tier2-validate/*). - The default build (OFF) never compiles the Rust, so a contributor can break the ON build without noticing.
Target
One configure, Rust always built:
| Target | Contents | Built | Packaged |
|---|---|---|---|
libobs-common (OBJECT) |
every libobs source that has no Rust port | always, once | (part of both) |
libobs |
common + the original C of each ported unit | always | yes: the product, for now |
libobs-rust linked variant (name TBD, e.g. libobs-with-rust) |
common + the libobs-rust staticlib |
always | no |
- One list of ported units. The ported C files (
util/bmem.c,obs-data.c,util/platform-nix.c, ...) are named in one place, which replaces the scattered generator expressions. The list shrinks as each C file is deleted after its port. - Tier 2 runs twice from one build tree. The unchanged cmocka tests are registered twice, linked against
libobsand against the Rust-linked variant (e.g. ctest labelscandrust). Shared objects compile once, so this is roughly half of today's OFF + ON time. obs-nvencgets the same treatment: both loaders are built, and the packaged plugin links the C one.ENABLE_RUST_LIBOBSstays as a deprecated no-op for one release, then is removed.- Rust becomes a hard build requirement for every build (Flatpak, AppImage, from-source). Document it in the build docs and
docs/ci-tooling.md. obs-c-oracleis unchanged. It serves the Rust-side differential tests (Tier 3), which this does not replace.
Open point: the OBS-Studio-Rust daily beta
.github/workflows/release-rust.yaml and .github/scripts/.build.zsh / .package.zsh currently package an ENABLE_RUST_LIBOBS=ON build as the OBS-Studio-Rust beta. Under "the packaged artifact is the C libobs", that beta would package libobs, the C one. Decide before landing: either the beta keeps a Rust-linked package as its own explicit packaging step, or it ships C until the switch.
Done when
- A plain configure (no options) builds the Rust staticlib and both libobs link targets on Linux, Windows and macOS.
- The packaged app and AppImage contain only the C
libobs;build-aux/appimage/test-appimage.shchecks it. - Tier 2 runs the cmocka suite against both from one build, on all three OSes.
- No
ENABLE_RUST_LIBOBSgenerator expression is left inlibobs/orplugins/.
Related: #140 (full app with ENABLE_RUST_LIBOBS=ON), #444 (Phase 6 libobs core migration), #1051.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
build: Cross-compile libobs for Windows and macOS from any host via s…
build: Cross-compile libobs for Windows and macOS from any host via s…
ci: Update Tier 2 and rust.cmake tests for the read-only source and l…
build: Faster Docker tasks; cross toolchain written only on change; r…
build: RED tests for one build making libobs and libobs-with-rust (#1065
build: Always build libobs-with-rust beside the C libobs; link and sh…
build: Run Docker tasks as named ephemeral singletons with reattached…
build: Cap Docker task volumes and prune cargo targets after every run
build: Keep incremental compilation on in Docker tasks
build: Windows cross check gets a resource compiler; share soldr acro…
ci: Update Tier 2 and rust.cmake tests for the read-only source and l…
build: Faster Docker tasks; cross toolchain written only on change; r…
build: Always build libobs-with-rust beside the C libobs; link and sh…
release-rust: Look for Rust code in libobs-with-rust, not the shipped…
build: macOS OBS-Studio-Rust builds also build libobs-with-rust (obs-…