From 7d47c371cd73892edaca055e45b2928a562e90ae Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 01:09:40 -0800 Subject: [PATCH 01/30] test: reproduce standalone Rust-static support and provider-order gaps (Refs #5219) --- ci/test_rust_static_link_support.py | 67 +++++++++++++++++++ rust/obs-build/tests/native.rs | 2 + .../shared_rust_static_support.rs | 19 ++++++ 3 files changed, 88 insertions(+) create mode 100644 ci/test_rust_static_link_support.py create mode 100644 rust/obs-build/tests/native/registration/shared_rust_static_support.rs diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py new file mode 100644 index 0000000000..f30c5f6cfe --- /dev/null +++ b/ci/test_rust_static_link_support.py @@ -0,0 +1,67 @@ +#!/usr/bin/env -S uv run --script +"""Exercise the standalone Rust-static support contract with real native links.""" + +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[1] +HELPER = ROOT / "test/cmocka/rust-static-link-support.cmake" + + +@unittest.skipUnless(shutil.which("cmake") and shutil.which("cc"), "requires CMake and C compiler") +class RustStaticLinkSupport(unittest.TestCase): + def test_shared_consumer_transitive_host_and_static_allocator(self): + with tempfile.TemporaryDirectory() as directory: + source = Path(directory) + files = { + "main.c": "int rust_entry(void); int bmalloc(void); int main(void) { return rust_entry() != 17 || bmalloc() != 7; }\n", + "rust.c": "int private_adapter(void); int bmalloc(void) { return 7; } int error_data_add(void) { return bmalloc(); } int rust_entry(void) { return error_data_add() + private_adapter(); }\n", + "import.c": "int bmalloc(void) { return 100; } int error_data_add(void) { return bmalloc(); }\n", + "adapter.c": "int host_value(void); int private_adapter(void) { return host_value(); }\n", + "unused.c": "int unavailable(void); int unused_adapter(void) { return unavailable(); }\n", + "host.c": "int host_value(void) { return 10; }\n", + } + for name, content in files.items(): + (source / name).write_text(content) + (source / "CMakeLists.txt").write_text( + "cmake_minimum_required(VERSION 3.28)\nproject(rust_support C)\n" + "add_library(host SHARED host.c)\n" + "add_library(host_owner INTERFACE)\n" + "target_link_libraries(host_owner INTERFACE host)\n" + "add_library(libobs_rust-static STATIC rust.c)\n" + "add_library(imported_obs SHARED import.c)\n" + "add_library(OBS::libobs ALIAS imported_obs)\n" + "add_library(support STATIC adapter.c unused.c)\n" + "add_library(indirect INTERFACE)\n" + "target_link_libraries(indirect INTERFACE libobs_rust-static)\n" + "foreach(name IN ITEMS direct indirect_consumer)\n" + " add_executable(${name} main.c)\n" + " target_link_libraries(${name} PRIVATE OBS::libobs)\n" + "endforeach()\n" + "target_link_libraries(direct PRIVATE libobs_rust-static)\n" + "target_link_libraries(indirect_consumer PRIVATE indirect)\n" + f'include("{HELPER.as_posix()}" OPTIONAL)\n' + "if(COMMAND obs_rust_static_consumers)\n" + " obs_rust_static_consumers(support host_owner)\n" + "else()\n" + # Baseline models the old per-target archive with no host interface. + " target_link_libraries(direct PRIVATE support)\n" + " target_link_libraries(indirect_consumer PRIVATE support)\n" + "endif()\n" + ) + build = source / "build" + self.run_command(["cmake", "-S", str(source), "-B", str(build)]) + self.run_command(["cmake", "--build", str(build), "--parallel", "2"]) + for name in ("direct", "indirect_consumer"): + self.run_command([str(build / name)]) + + def run_command(self, command): + result = subprocess.run(command, capture_output=True, text=True, check=False, timeout=60) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + + +if __name__ == "__main__": + unittest.main() diff --git a/rust/obs-build/tests/native.rs b/rust/obs-build/tests/native.rs index a6a8cab241..8f4bf3052b 100644 --- a/rust/obs-build/tests/native.rs +++ b/rust/obs-build/tests/native.rs @@ -5520,3 +5520,5 @@ mod canonical_type_catalog_enum_swap_is_registered; #[path = "native/registration/canonical_object_id_swap_is_registered.rs"] mod canonical_object_id_swap_is_registered; +#[path = "native/registration/shared_rust_static_support.rs"] +mod shared_rust_static_support; diff --git a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs new file mode 100644 index 0000000000..fd8093f0db --- /dev/null +++ b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs @@ -0,0 +1,19 @@ +use super::*; + +#[test] +fn rust_static_precedes_import_providers_and_their_host_closure() { + use obs_build::validation::graph::{Dependency, Graph}; + let graph = Graph::parse( + r#"{"schema":1,"targets":{"fixture":{"sources":["main.c"], + "libraries":["OBS::libobs","host_consumer","libobs_rust-static"]}}, + "tests":{"fixture":{"target":"fixture"}}}"#, + ) + .unwrap(); + let dependencies = [ + ("OBS::libobs".into(), Dependency { artifacts: vec!["obs.lib".into()], ..Default::default() }), + ("host_consumer".into(), Dependency { artifacts: vec!["consumer.a".into(), "host.so".into()], ..Default::default() }), + ("libobs_rust-static".into(), Dependency { artifacts: vec!["rust.lib".into()], ..Default::default() }), + ].into(); + assert_eq!(graph.targets["fixture"].dependency_artifacts(&Default::default(), &dependencies).unwrap(), + ["rust.lib", "obs.lib", "consumer.a", "host.so"].map(std::path::PathBuf::from)); +} From cdf74f86f91738ec7ba9367d5a0b77be07b1ec6b Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 01:19:55 -0800 Subject: [PATCH 02/30] build: share real native support and Rust-first provider selection (Refs #5219) --- ci/test_rust_static_link_support.py | 20 ++++-- cmake/finders/FindGio.cmake | 2 + docs/ci-tooling.md | 11 ++++ rust/obs-build/src/platform/mod.rs | 15 +++++ rust/obs-build/src/validation/graph.rs | 52 ++++++++++++++-- .../validation/graph/rust_static_support.rs | 61 +++++++++++++++++++ .../shared_rust_static_support.rs | 37 ++++++++--- test/cmocka/base-variadic-link-support.c | 2 + test/cmocka/build/rust-static-support.json | 12 ++++ test/cmocka/core-initialized-link-support.c | 2 + test/cmocka/rust-static-link-support.cmake | 57 +++++++++++++++++ .../video_info_query_link_support.cmake | 36 +++++------ 12 files changed, 268 insertions(+), 39 deletions(-) create mode 100644 rust/obs-build/src/validation/graph/rust_static_support.rs create mode 100644 test/cmocka/base-variadic-link-support.c create mode 100644 test/cmocka/build/rust-static-support.json create mode 100644 test/cmocka/core-initialized-link-support.c create mode 100644 test/cmocka/rust-static-link-support.cmake diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index f30c5f6cfe..6d9a0db2fc 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -14,11 +14,18 @@ @unittest.skipUnless(shutil.which("cmake") and shutil.which("cc"), "requires CMake and C compiler") class RustStaticLinkSupport(unittest.TestCase): def test_shared_consumer_transitive_host_and_static_allocator(self): + self.check_fixture(False) + + def test_allocator_member_is_selected_before_shared_import_provider(self): + self.check_fixture(True) + + def check_fixture(self, baseline_host): with tempfile.TemporaryDirectory() as directory: source = Path(directory) files = { "main.c": "int rust_entry(void); int bmalloc(void); int main(void) { return rust_entry() != 17 || bmalloc() != 7; }\n", - "rust.c": "int private_adapter(void); int bmalloc(void) { return 7; } int error_data_add(void) { return bmalloc(); } int rust_entry(void) { return error_data_add() + private_adapter(); }\n", + "rust.c": "int private_adapter(void); int error_data_add(void); int rust_entry(void) { return error_data_add() + private_adapter(); }\n", + "allocator.c": "int bmalloc(void) { return 7; } int error_data_add(void) { return bmalloc(); }\n", "import.c": "int bmalloc(void) { return 100; } int error_data_add(void) { return bmalloc(); }\n", "adapter.c": "int host_value(void); int private_adapter(void) { return host_value(); }\n", "unused.c": "int unavailable(void); int unused_adapter(void) { return unavailable(); }\n", @@ -30,11 +37,13 @@ def test_shared_consumer_transitive_host_and_static_allocator(self): "cmake_minimum_required(VERSION 3.28)\nproject(rust_support C)\n" "add_library(host SHARED host.c)\n" "add_library(host_owner INTERFACE)\n" - "target_link_libraries(host_owner INTERFACE host)\n" - "add_library(libobs_rust-static STATIC rust.c)\n" + 'target_link_libraries(host_owner INTERFACE host "$<$:Optional::Host>")\n' + "add_library(libobs_rust-static STATIC rust.c allocator.c)\n" "add_library(imported_obs SHARED import.c)\n" "add_library(OBS::libobs ALIAS imported_obs)\n" "add_library(support STATIC adapter.c unused.c)\n" + + ("target_link_libraries(support PRIVATE host_owner)\n" if baseline_host else "") + + "add_library(indirect INTERFACE)\n" "target_link_libraries(indirect INTERFACE libobs_rust-static)\n" "foreach(name IN ITEMS direct indirect_consumer)\n" @@ -54,8 +63,9 @@ def test_shared_consumer_transitive_host_and_static_allocator(self): ) build = source / "build" self.run_command(["cmake", "-S", str(source), "-B", str(build)]) - self.run_command(["cmake", "--build", str(build), "--parallel", "2"]) - for name in ("direct", "indirect_consumer"): + targets = ("direct",) if baseline_host else ("direct", "indirect_consumer") + self.run_command(["cmake", "--build", str(build), "--parallel", "2", "--target", *targets]) + for name in targets: self.run_command([str(build / name)]) def run_command(self, command): diff --git a/cmake/finders/FindGio.cmake b/cmake/finders/FindGio.cmake index 42da5747e5..527a4850c6 100644 --- a/cmake/finders/FindGio.cmake +++ b/cmake/finders/FindGio.cmake @@ -109,6 +109,8 @@ if(Gio_FOUND) gio::gio PROPERTIES INTERFACE_COMPILE_OPTIONS "${PC_Gio_CFLAGS_OTHER}" + INTERFACE_LINK_LIBRARIES "${PC_Gio_LINK_LIBRARIES}" + INTERFACE_LINK_OPTIONS "${PC_Gio_LDFLAGS_OTHER}" INTERFACE_INCLUDE_DIRECTORIES "${Gio_INCLUDE_DIR};${GioUnix_INCLUDE_DIR};${Glib_INCLUDE_DIR}" VERSION ${Gio_VERSION} ) diff --git a/docs/ci-tooling.md b/docs/ci-tooling.md index b0a807da80..609e05aad3 100644 --- a/docs/ci-tooling.md +++ b/docs/ci-tooling.md @@ -309,6 +309,17 @@ these are build-tree cold timings, excluding first-host downloads. The original eight Windows category binaries also linked (128.53 s with partial Cargo reuse). These local timings are not a hosted critical-path guarantee. +Standalone Rust-static support is selected for every consumer, including tests +that also link shared libobs or inherit Rust through an interface target. +`test/cmocka/build/rust-static-support.json` owns the real private adapter members +for both CMake and Cargo-native fixtures. Add new shared adapters there as separate +lazy archive members; fixture-owned definitions retain precedence. CMake inherits +the native owner (`libobs-objects`) link interface rather than maintaining host +libraries per test. Cargo's production Rust-archive dependency carries its native +package interface. Both paths put Rust before shared/import providers so allocator +and parser symbols are selected consistently. Link checks prove linking only; +native runtime checks still own recording callbacks and allocator behavior. + #### macOS Rust execution artifacts (#5008) The maintainer chose **STRICT** on 2026-11-17: nothing compiles on hosted diff --git a/rust/obs-build/src/platform/mod.rs b/rust/obs-build/src/platform/mod.rs index 9faa943281..5183f45760 100644 --- a/rust/obs-build/src/platform/mod.rs +++ b/rust/obs-build/src/platform/mod.rs @@ -997,6 +997,21 @@ pub fn native_test_rust_static_options(target: &str) -> Result, Stri .into()) } +/// Native libraries used by the production Rust archive, independent of which +/// exported function first causes the linker to extract an archive member. +pub fn configure_rust_static_dependencies( + target: &str, + library: &mut crate::SharedLibrary, +) -> Result<(), String> { + crate::libobs::add_package(library, target, "jansson")?; + if target.contains("linux") { + for package in ["uuid", "gio-2.0"] { + crate::libobs::add_package(library, target, package)?; + } + } + Ok(()) +} + pub fn native_test_math_options(target: &str) -> Vec { if target.contains("msvc") { vec![] diff --git a/rust/obs-build/src/validation/graph.rs b/rust/obs-build/src/validation/graph.rs index 86c2a17e09..ba0a618028 100644 --- a/rust/obs-build/src/validation/graph.rs +++ b/rust/obs-build/src/validation/graph.rs @@ -6,6 +6,7 @@ use crate::{NativeBuild, SharedLibrary}; #[path = "configured_headers.rs"] mod configured_headers; +mod rust_static_support; use configured_headers::ConfiguredHeader; use serde::Deserialize; use std::{ @@ -358,6 +359,12 @@ impl Target { names.push(name.into()); } } + // The Rust provider must precede shared/import libraries that export + // the same allocators and parser helpers (MSVC import members collide). + if let Some(index) = names.iter().position(|name| name == "libobs_rust-static") { + let rust = names.remove(index); + names.insert(0, rust); + } Ok(names) } @@ -542,6 +549,8 @@ pub struct Selection<'a> { /// have no artifacts; they still carry required headers and definitions. #[derive(Clone, Debug, Default)] pub struct Dependency { + /// Production Rust archives also select the shared demand-linked C bridge. + pub rust_static_support: bool, pub runtime_path_prepend: BTreeMap>, pub artifacts: Vec, pub include_dirs: Vec, @@ -555,6 +564,7 @@ pub struct Dependency { impl From for Dependency { fn from(library: SharedLibrary) -> Self { Self { + rust_static_support: false, runtime_path_prepend: BTreeMap::new(), artifacts: library.dependencies, include_dirs: library.include_dirs, @@ -578,11 +588,16 @@ impl Dependency { archive.display() )); } - Ok(Self { - artifacts: vec![archive], - link_options: crate::platform::native_test_rust_static_options(target)?, - ..Default::default() - }) + let mut native = SharedLibrary::default(); + crate::platform::configure_rust_static_dependencies(target, &mut native)?; + let mut dependency = Self::from(native); + dependency.rust_static_support = true; + dependency.artifacts.push(archive); + dependency.link_options.splice( + 0..0, + crate::platform::native_test_rust_static_options(target)?, + ); + Ok(dependency) } /// Resolve a native SDK package into its compile and link interface. @@ -753,6 +768,7 @@ impl Graph { let root = dunce::canonicalize(root).map_err(|error| error.to_string())?; let selected = self.select(facts)?; let mut artifacts = BTreeMap::new(); + let mut rust_support: Option = None; let mut watched_inputs = BTreeSet::new(); for (name, spec) in selected.targets { let mut target = SharedLibrary { @@ -798,7 +814,12 @@ impl Graph { &root.join(&import.definition), &output, )?; - target.dependencies.insert(0, library); + let index = usize::from( + spec.library_names(facts)? + .first() + .is_some_and(|name| name == "libobs_rust-static"), + ); + target.dependencies.insert(index, library); } for source in &spec.sources { if !source.selected(facts)? { @@ -895,6 +916,25 @@ impl Graph { target.definitions.push((key.into(), value)); } spec.add_header_libraries(&mut target, libraries)?; + if spec.library_names(facts)?.iter().any(|name| { + name == "libobs_rust-static" + && libraries + .get(name) + .is_some_and(|dep| dep.rust_static_support) + }) { + let support = match &rust_support { + Some(support) => support, + None => { + rust_support.insert(rust_static_support::prepare(build, &root, libraries)?) + } + }; + // Private adapters follow Rust, ahead of shared/import providers. + target.dependencies.insert(1, support.clone()); + // Legacy registrations may still name these eager wrappers. + // The manifest now owns their real implementations lazily. + let shared_sources = rust_static_support::sources(&root)?; + target.sources.retain(|path| !shared_sources.contains(path)); + } for package in &spec.packages { crate::libobs::add_package(&mut target, &build.target, package)?; } diff --git a/rust/obs-build/src/validation/graph/rust_static_support.rs b/rust/obs-build/src/validation/graph/rust_static_support.rs new file mode 100644 index 0000000000..55f7bfdabd --- /dev/null +++ b/rust/obs-build/src/validation/graph/rust_static_support.rs @@ -0,0 +1,61 @@ +//! The same real, demand-linked bridge members selected by cmocka's CMake graph. +use super::{Dependency, NativeBuild, SharedLibrary}; +use std::{ + collections::BTreeMap, + path::{Path, PathBuf}, +}; + +const MANIFEST: &str = include_str!("../../../../../test/cmocka/build/rust-static-support.json"); + +pub(super) fn sources(root: &Path) -> Result, String> { + #[derive(serde::Deserialize)] + #[serde(deny_unknown_fields)] + struct Manifest { + sources: Vec, + } + let manifest: Manifest = serde_json::from_str(MANIFEST) + .map_err(|error| format!("Rust-static support manifest: {error}"))?; + Ok(manifest.sources + .iter() + .map(|path| root.join(path)) + .collect()) +} + +pub(super) fn prepare( + build: &NativeBuild, + root: &Path, + libraries: &BTreeMap, +) -> Result { + let mut support = SharedLibrary { + name: "rust-static-link-support".into(), + sources: sources(root)?, + include_dirs: vec![ + root.into(), + root.join("libobs"), + root.join("deps/libcaption"), + ], + ..Default::default() + }; + // These are owner interfaces, not a list repeated for each executable. + for name in [ + "OBS::libobs", + "SIMDe::SIMDe", + "Uthash::Uthash", + "libobs_rust-static", + ] { + if let Some(owner) = libraries.get(name) { + support + .include_dirs + .extend(owner.include_dirs.iter().cloned()); + support + .definitions + .extend(owner.definitions.iter().cloned()); + } + } + println!( + "cargo:rerun-if-changed={}", + root.join("test/cmocka/build/rust-static-support.json") + .display() + ); + build.static_library(&support) +} diff --git a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs index fd8093f0db..cf2df530a8 100644 --- a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs +++ b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs @@ -1,5 +1,3 @@ -use super::*; - #[test] fn rust_static_precedes_import_providers_and_their_host_closure() { use obs_build::validation::graph::{Dependency, Graph}; @@ -10,10 +8,33 @@ fn rust_static_precedes_import_providers_and_their_host_closure() { ) .unwrap(); let dependencies = [ - ("OBS::libobs".into(), Dependency { artifacts: vec!["obs.lib".into()], ..Default::default() }), - ("host_consumer".into(), Dependency { artifacts: vec!["consumer.a".into(), "host.so".into()], ..Default::default() }), - ("libobs_rust-static".into(), Dependency { artifacts: vec!["rust.lib".into()], ..Default::default() }), - ].into(); - assert_eq!(graph.targets["fixture"].dependency_artifacts(&Default::default(), &dependencies).unwrap(), - ["rust.lib", "obs.lib", "consumer.a", "host.so"].map(std::path::PathBuf::from)); + ( + "OBS::libobs".into(), + Dependency { + artifacts: vec!["obs.lib".into()], + ..Default::default() + }, + ), + ( + "host_consumer".into(), + Dependency { + artifacts: vec!["consumer.a".into(), "host.so".into()], + ..Default::default() + }, + ), + ( + "libobs_rust-static".into(), + Dependency { + artifacts: vec!["rust.lib".into()], + ..Default::default() + }, + ), + ] + .into(); + assert_eq!( + graph.targets["fixture"] + .dependency_artifacts(&Default::default(), &dependencies) + .unwrap(), + ["rust.lib", "obs.lib", "consumer.a", "host.so"].map(std::path::PathBuf::from) + ); } diff --git a/test/cmocka/base-variadic-link-support.c b/test/cmocka/base-variadic-link-support.c new file mode 100644 index 0000000000..1a56ec379b --- /dev/null +++ b/test/cmocka/base-variadic-link-support.c @@ -0,0 +1,2 @@ +/* Demand-link the real private logger bridge, preserving fixture-owned loggers. */ +#include "libobs/util/base-variadic.c.h" diff --git a/test/cmocka/build/rust-static-support.json b/test/cmocka/build/rust-static-support.json new file mode 100644 index 0000000000..65749ba4a8 --- /dev/null +++ b/test/cmocka/build/rust-static-support.json @@ -0,0 +1,12 @@ +{ + "sources": [ + "test/cmocka/core-state-link-support.c", + "test/cmocka/video-info-query-link-support.c", + "test/cmocka/base-variadic-link-support.c", + "test/cmocka/core-initialized-link-support.c", + "test/cmocka/source-save-load-link-support.c", + "test/cmocka/source-settings-getter-link-support.c", + "test/cmocka/encoder-video-tex-active-fields-link-support.c", + "test/cmocka/encoder-video-tex-active-mix-link-support.c" + ] +} diff --git a/test/cmocka/core-initialized-link-support.c b/test/cmocka/core-initialized-link-support.c new file mode 100644 index 0000000000..32f766f300 --- /dev/null +++ b/test/cmocka/core-initialized-link-support.c @@ -0,0 +1,2 @@ +/* Demand-link the real core-state field adapter for standalone Rust consumers. */ +#include "libobs/obs-core-initialized-fields.c.h" diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake new file mode 100644 index 0000000000..f3ecbc4a1e --- /dev/null +++ b/test/cmocka/rust-static-link-support.cmake @@ -0,0 +1,57 @@ +# One selection rule for standalone consumers, including interface dependencies. +include_guard(GLOBAL) + +function(_obs_uses_rust_static target visited output) + if(target STREQUAL "libobs_rust-static") + set(${output} TRUE PARENT_SCOPE) + return() + endif() + if(NOT TARGET "${target}" OR target IN_LIST visited) + set(${output} FALSE PARENT_SCOPE) + return() + endif() + list(APPEND visited "${target}") + get_target_property(type "${target}" TYPE) + # A shared library's implementation is not a standalone Rust consumer. + if(type MATCHES "^(SHARED|MODULE)_LIBRARY$") + set(${output} FALSE PARENT_SCOPE) + return() + endif() + get_target_property(links "${target}" INTERFACE_LINK_LIBRARIES) + get_target_property(private_links "${target}" LINK_LIBRARIES) + string(REGEX MATCHALL "[A-Za-z0-9_.+-]+(::[A-Za-z0-9_.+-]+)*" dependencies "${links};${private_links}") + foreach(dependency IN LISTS dependencies) + _obs_uses_rust_static("${dependency}" "${visited}" uses_rust) + if(uses_rust) + set(${output} TRUE PARENT_SCOPE) + return() + endif() + endforeach() + set(${output} FALSE PARENT_SCOPE) +endfunction() + +function(obs_rust_static_consumers support native_owner) + if(TARGET "${native_owner}") + # Inherit the owner's full native closure, including host-selected libraries + # and their transitive interfaces. Never copy GObject/Jansson lists per test. + target_link_libraries( + "${support}" + PRIVATE "$>" + ) + endif() + get_directory_property(targets BUILDSYSTEM_TARGETS) + foreach(target IN LISTS targets) + get_target_property(type "${target}" TYPE) + if(NOT type STREQUAL "EXECUTABLE") + continue() + endif() + _obs_uses_rust_static("${target}" "" uses_rust) + if(uses_rust) + get_target_property(links "${target}" LINK_LIBRARIES) + list(REMOVE_ITEM links libobs_rust-static) + # Resolve static allocators/parser/logging before OBS's DLL import members. + # An indirect consumer also needs this explicit first provider. + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "libobs_rust-static;${links};${support}") + endif() + endforeach() +endfunction() diff --git a/test/cmocka/tests.d/video_info_query_link_support.cmake b/test/cmocka/tests.d/video_info_query_link_support.cmake index 8193568b98..9d269a2af9 100644 --- a/test/cmocka/tests.d/video_info_query_link_support.cmake +++ b/test/cmocka/tests.d/video_info_query_link_support.cmake @@ -1,18 +1,20 @@ -# Keep global-dependent adapters in an archive: fixture-owned cores take precedence. -# Shared libobs hides these private adapters; every Rust-static consumer needs -# the support archive, including consumers that also link OBS::libobs. +# Real private adapters in separate lazy members, shared by every Rust consumer. +include("${CMAKE_CURRENT_LIST_DIR}/../rust-static-link-support.cmake") function(_video_info_query_link_support) - add_library( - video_info_query_link_support - STATIC - "${CMAKE_CURRENT_SOURCE_DIR}/video-info-query-link-support.c" - "${CMAKE_CURRENT_SOURCE_DIR}/core-state-link-support.c" - "${CMAKE_CURRENT_SOURCE_DIR}/encoder-get-name-link-support.c" - "${CMAKE_CURRENT_SOURCE_DIR}/output-interleave-name-link-support.c" - "${CMAKE_CURRENT_SOURCE_DIR}/encoder-video-tex-active-fields-link-support.c" - "${CMAKE_CURRENT_SOURCE_DIR}/encoder-video-tex-active-mix-link-support.c" - "${CMAKE_CURRENT_SOURCE_DIR}/source-audio-capture-callback-link-support.c" + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/build/rust-static-support.json" manifest) + string(JSON count LENGTH "${manifest}" sources) + math(EXPR last "${count} - 1") + set(sources) + foreach(index RANGE ${last}) + string(JSON source GET "${manifest}" sources ${index}) + list(APPEND sources "${CMAKE_SOURCE_DIR}/${source}") + endforeach() + set_property( + DIRECTORY + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/build/rust-static-support.json" ) + add_library(video_info_query_link_support STATIC ${sources}) target_include_directories( video_info_query_link_support PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/config" @@ -21,12 +23,6 @@ function(_video_info_query_link_support) video_info_query_link_support PRIVATE OBS::caption Uthash::Uthash $<$:OBS::w32-pthreads> ) - get_directory_property(_targets BUILDSYSTEM_TARGETS) - foreach(_target IN LISTS _targets) - get_target_property(_links ${_target} LINK_LIBRARIES) - if("libobs_rust-static" IN_LIST _links) - target_link_libraries(${_target} PRIVATE video_info_query_link_support) - endif() - endforeach() + obs_rust_static_consumers(video_info_query_link_support libobs-objects) endfunction() cmake_language(DEFER CALL _video_info_query_link_support) From 3cc8b9e0867e43ffea87445a72796a33a75edb0c Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 01:29:16 -0800 Subject: [PATCH 03/30] build: preserve optional and conditional native dependency selection (Refs #5219) --- ci/test_rust_static_link_support.py | 12 ++++- libobs/CMakeLists.txt | 11 ++++ rust/obs-build/src/platform/mod.rs | 11 +++- .../validation/graph/rust_static_support.rs | 3 +- test/cmocka/rust-static-link-support.cmake | 53 ++++++++++++++----- .../video_info_query_link_support.cmake | 2 +- 6 files changed, 72 insertions(+), 20 deletions(-) diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index 6d9a0db2fc..ea4c0b43b3 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -46,12 +46,16 @@ def check_fixture(self, baseline_host): + "add_library(indirect INTERFACE)\n" "target_link_libraries(indirect INTERFACE libobs_rust-static)\n" - "foreach(name IN ITEMS direct indirect_consumer)\n" + "foreach(name IN ITEMS direct indirect_consumer conditional_consumer)\n" " add_executable(${name} main.c)\n" " target_link_libraries(${name} PRIVATE OBS::libobs)\n" "endforeach()\n" "target_link_libraries(direct PRIVATE libobs_rust-static)\n" "target_link_libraries(indirect_consumer PRIVATE indirect)\n" + 'target_link_libraries(conditional_consumer PRIVATE "$<$:indirect>")\n' + "file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/reference.c \"int main(void) { return 0; }\\n\")\n" + "add_executable(reference ${CMAKE_CURRENT_BINARY_DIR}/reference.c)\n" + 'target_link_libraries(reference PRIVATE "$<$:libobs_rust-static>")\n' f'include("{HELPER.as_posix()}" OPTIONAL)\n' "if(COMMAND obs_rust_static_consumers)\n" " obs_rust_static_consumers(support host_owner)\n" @@ -60,10 +64,14 @@ def check_fixture(self, baseline_host): " target_link_libraries(direct PRIVATE support)\n" " target_link_libraries(indirect_consumer PRIVATE support)\n" "endif()\n" + 'file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/reference-links.txt" CONTENT "$>")\n' ) build = source / "build" self.run_command(["cmake", "-S", str(source), "-B", str(build)]) - targets = ("direct",) if baseline_host else ("direct", "indirect_consumer") + reference_links = (build / "reference-links.txt").read_text() + self.assertNotIn("libobs_rust-static", reference_links) + self.assertNotIn("support", reference_links) + targets = ("direct",) if baseline_host else ("direct", "indirect_consumer", "conditional_consumer") self.run_command(["cmake", "--build", str(build), "--parallel", "2", "--target", *targets]) for name in targets: self.run_command([str(build / name)]) diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt index 3dd214e69a..4a65f947bb 100644 --- a/libobs/CMakeLists.txt +++ b/libobs/CMakeLists.txt @@ -264,6 +264,17 @@ if(TARGET libobs-c-reference) ) endif() +# Keep native link requirements in the owner's directory so imported targets and +# conditional dependencies retain their scope. Standalone Rust consumers inherit +# this interface without importing the native core's objects or the shared DSO. +add_library(libobs-native-dependencies INTERFACE) +add_library(OBS::libobs-native-dependencies ALIAS libobs-native-dependencies) +get_target_property(_native_libraries libobs-objects INTERFACE_LINK_LIBRARIES) +target_link_libraries(libobs-native-dependencies INTERFACE ${_native_libraries}) +if(TARGET libobs_rust-static) + target_link_libraries(libobs_rust-static INTERFACE OBS::libobs-native-dependencies) +endif() + # Last, once every source list and host file has filled libobs-objects: split # its groups into the lib-modules of build/modules.d (#3259). include(cmake/modules.cmake) diff --git a/rust/obs-build/src/platform/mod.rs b/rust/obs-build/src/platform/mod.rs index 5183f45760..399d86a73d 100644 --- a/rust/obs-build/src/platform/mod.rs +++ b/rust/obs-build/src/platform/mod.rs @@ -1005,8 +1005,15 @@ pub fn configure_rust_static_dependencies( ) -> Result<(), String> { crate::libobs::add_package(library, target, "jansson")?; if target.contains("linux") { - for package in ["uuid", "gio-2.0"] { - crate::libobs::add_package(library, target, package)?; + crate::libobs::add_package(library, target, "uuid")?; + // Match the optional native owner: no-GIO archives remain usable on + // hosts without GIO. Archives that actually need it still fail to link. + if pkg_config::Config::new() + .cargo_metadata(false) + .probe("gio-2.0") + .is_ok() + { + crate::libobs::add_package(library, target, "gio-2.0")?; } } Ok(()) diff --git a/rust/obs-build/src/validation/graph/rust_static_support.rs b/rust/obs-build/src/validation/graph/rust_static_support.rs index 55f7bfdabd..6b23e764b3 100644 --- a/rust/obs-build/src/validation/graph/rust_static_support.rs +++ b/rust/obs-build/src/validation/graph/rust_static_support.rs @@ -15,7 +15,8 @@ pub(super) fn sources(root: &Path) -> Result, String> { } let manifest: Manifest = serde_json::from_str(MANIFEST) .map_err(|error| format!("Rust-static support manifest: {error}"))?; - Ok(manifest.sources + Ok(manifest + .sources .iter() .map(|path| root.join(path)) .collect()) diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index f3ecbc4a1e..8e229d3e57 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -3,41 +3,59 @@ include_guard(GLOBAL) function(_obs_uses_rust_static target visited output) if(target STREQUAL "libobs_rust-static") - set(${output} TRUE PARENT_SCOPE) + set(${output} 1 PARENT_SCOPE) return() endif() if(NOT TARGET "${target}" OR target IN_LIST visited) - set(${output} FALSE PARENT_SCOPE) + set(${output} 0 PARENT_SCOPE) return() endif() list(APPEND visited "${target}") get_target_property(type "${target}" TYPE) # A shared library's implementation is not a standalone Rust consumer. if(type MATCHES "^(SHARED|MODULE)_LIBRARY$") - set(${output} FALSE PARENT_SCOPE) + set(${output} 0 PARENT_SCOPE) return() endif() get_target_property(links "${target}" INTERFACE_LINK_LIBRARIES) get_target_property(private_links "${target}" LINK_LIBRARIES) - string(REGEX MATCHALL "[A-Za-z0-9_.+-]+(::[A-Za-z0-9_.+-]+)*" dependencies "${links};${private_links}") + set(links "${links};${private_links}") + string(REPLACE ";" "$" condition_links "${links}") + string(REGEX MATCHALL "[A-Za-z0-9_.+-]+(::[A-Za-z0-9_.+-]+)*" dependencies "${links}") + list(REMOVE_DUPLICATES dependencies) + set(conditions) foreach(dependency IN LISTS dependencies) _obs_uses_rust_static("${dependency}" "${visited}" uses_rust) - if(uses_rust) - set(${output} TRUE PARENT_SCOPE) - return() + if(NOT uses_rust STREQUAL "0") + if(dependency IN_LIST links) + if(uses_rust STREQUAL "1") + set(${output} 1 PARENT_SCOPE) + return() + endif() + list(APPEND conditions "${uses_rust}") + else() + # Evaluate conditional edges with their original owner and links, not + # the subsequently rewritten consumer property (which would recurse). + list( + APPEND conditions + "$>,${uses_rust}>" + ) + endif() endif() endforeach() - set(${output} FALSE PARENT_SCOPE) + if(conditions) + list(JOIN conditions "," condition) + set(${output} "$" PARENT_SCOPE) + else() + set(${output} 0 PARENT_SCOPE) + endif() endfunction() function(obs_rust_static_consumers support native_owner) if(TARGET "${native_owner}") # Inherit the owner's full native closure, including host-selected libraries # and their transitive interfaces. Never copy GObject/Jansson lists per test. - target_link_libraries( - "${support}" - PRIVATE "$>" - ) + target_link_libraries("${support}" PRIVATE "${native_owner}") endif() get_directory_property(targets BUILDSYSTEM_TARGETS) foreach(target IN LISTS targets) @@ -46,12 +64,19 @@ function(obs_rust_static_consumers support native_owner) continue() endif() _obs_uses_rust_static("${target}" "" uses_rust) - if(uses_rust) + if(NOT uses_rust STREQUAL "0") get_target_property(links "${target}" LINK_LIBRARIES) list(REMOVE_ITEM links libobs_rust-static) # Resolve static allocators/parser/logging before OBS's DLL import members. # An indirect consumer also needs this explicit first provider. - set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "libobs_rust-static;${links};${support}") + if(uses_rust STREQUAL "1") + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "libobs_rust-static;${links};${support}") + else() + set_property( + TARGET "${target}" + PROPERTY LINK_LIBRARIES "$<${uses_rust}:libobs_rust-static>;${links};$<${uses_rust}:${support}>" + ) + endif() endif() endforeach() endfunction() diff --git a/test/cmocka/tests.d/video_info_query_link_support.cmake b/test/cmocka/tests.d/video_info_query_link_support.cmake index 9d269a2af9..dbbd7f63dd 100644 --- a/test/cmocka/tests.d/video_info_query_link_support.cmake +++ b/test/cmocka/tests.d/video_info_query_link_support.cmake @@ -23,6 +23,6 @@ function(_video_info_query_link_support) video_info_query_link_support PRIVATE OBS::caption Uthash::Uthash $<$:OBS::w32-pthreads> ) - obs_rust_static_consumers(video_info_query_link_support libobs-objects) + obs_rust_static_consumers(video_info_query_link_support OBS::libobs-native-dependencies) endfunction() cmake_language(DEFER CALL _video_info_query_link_support) From f4e2591a895d4ee229b0ee810fa37cfb150c0b6d Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 01:36:05 -0800 Subject: [PATCH 04/30] test: keep shared support regression beside its adapter contract (Refs #5219) --- rust/obs-build/tests/native.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rust/obs-build/tests/native.rs b/rust/obs-build/tests/native.rs index 8f4bf3052b..3f83fc2e1c 100644 --- a/rust/obs-build/tests/native.rs +++ b/rust/obs-build/tests/native.rs @@ -495,6 +495,9 @@ mod canonical_undo_stack_is_registered; mod canonical_vaapi_device_select_is_registered; #[path = "native/registration/canonical_video_info_query_is_registered.rs"] mod canonical_video_info_query_is_registered; + +#[path = "native/registration/shared_rust_static_support.rs"] +mod shared_rust_static_support; #[path = "native/registration/canonical_video_output_compatibility_is_registered.rs"] mod canonical_video_output_compatibility_is_registered; #[path = "native/registration/canonical_video_scaler_direct_is_registered.rs"] @@ -5518,7 +5521,6 @@ mod canonical_source_update_properties_swap_is_registered; #[path = "native/registration/canonical_type_catalog_enum_swap_is_registered.rs"] mod canonical_type_catalog_enum_swap_is_registered; + #[path = "native/registration/canonical_object_id_swap_is_registered.rs"] mod canonical_object_id_swap_is_registered; -#[path = "native/registration/shared_rust_static_support.rs"] -mod shared_rust_static_support; From f4135c8b502ca4874e5b2892ef2d6e7b05798ff6 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 01:39:14 -0800 Subject: [PATCH 05/30] style: apply rustfmt ordering to the support regression module (Refs #5219) --- rust/obs-build/tests/native.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/obs-build/tests/native.rs b/rust/obs-build/tests/native.rs index 3f83fc2e1c..0b17a549b6 100644 --- a/rust/obs-build/tests/native.rs +++ b/rust/obs-build/tests/native.rs @@ -496,8 +496,6 @@ mod canonical_vaapi_device_select_is_registered; #[path = "native/registration/canonical_video_info_query_is_registered.rs"] mod canonical_video_info_query_is_registered; -#[path = "native/registration/shared_rust_static_support.rs"] -mod shared_rust_static_support; #[path = "native/registration/canonical_video_output_compatibility_is_registered.rs"] mod canonical_video_output_compatibility_is_registered; #[path = "native/registration/canonical_video_scaler_direct_is_registered.rs"] @@ -518,6 +516,8 @@ mod canonical_x11_keymap_is_registered; mod canonical_xcomposite_decisions_are_registered; #[path = "native/registration/canonical_youtube_broadcast_settings_is_registered.rs"] mod canonical_youtube_broadcast_settings_is_registered; +#[path = "native/registration/shared_rust_static_support.rs"] +mod shared_rust_static_support; /// #1390: the libobs built from this checkout for real-libobs graph runtimes. /// `OBS_GRAPH_LIBOBS` selects the Tier 2 implementation explicitly: `hybrid` From c8d46b9c8e1c548f449ee6dbcc5edb08b96f97f3 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 01:48:10 -0800 Subject: [PATCH 06/30] build: preserve declared DSO binding outside MSVC imports (Refs #5219) --- ci/test_rust_static_link_support.py | 11 +++++- docs/ci-tooling.md | 5 ++- rust/obs-build/src/validation/graph.rs | 35 +++++++---------- .../validation/graph/rust_static_support.rs | 39 +++++++++++++++++++ .../shared_rust_static_support.rs | 8 +++- test/cmocka/rust-static-link-support.cmake | 21 +++++++--- 6 files changed, 86 insertions(+), 33 deletions(-) diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index ea4c0b43b3..9bc52f2ed9 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -19,11 +19,15 @@ def test_shared_consumer_transitive_host_and_static_allocator(self): def test_allocator_member_is_selected_before_shared_import_provider(self): self.check_fixture(True) - def check_fixture(self, baseline_host): + def test_non_msvc_preserves_declared_shared_binding(self): + self.check_fixture(False, False) + + def check_fixture(self, baseline_host, msvc=True): with tempfile.TemporaryDirectory() as directory: source = Path(directory) files = { - "main.c": "int rust_entry(void); int bmalloc(void); int main(void) { return rust_entry() != 17 || bmalloc() != 7; }\n", + "main.c": "int rust_entry(void); int bmalloc(void); int main(void) { return rust_entry() != " + + ("17 || bmalloc() != 7" if msvc else "110 || bmalloc() != 100") + "; }\n", "rust.c": "int private_adapter(void); int error_data_add(void); int rust_entry(void) { return error_data_add() + private_adapter(); }\n", "allocator.c": "int bmalloc(void) { return 7; } int error_data_add(void) { return bmalloc(); }\n", "import.c": "int bmalloc(void) { return 100; } int error_data_add(void) { return bmalloc(); }\n", @@ -35,6 +39,9 @@ def check_fixture(self, baseline_host): (source / name).write_text(content) (source / "CMakeLists.txt").write_text( "cmake_minimum_required(VERSION 3.28)\nproject(rust_support C)\n" + # Model the MSVC import boundary with host-linkable providers. + + f"set(MSVC {'TRUE' if msvc else 'FALSE'})\n" + + "add_library(host SHARED host.c)\n" "add_library(host_owner INTERFACE)\n" 'target_link_libraries(host_owner INTERFACE host "$<$:Optional::Host>")\n' diff --git a/docs/ci-tooling.md b/docs/ci-tooling.md index 609e05aad3..ce9b4b070e 100644 --- a/docs/ci-tooling.md +++ b/docs/ci-tooling.md @@ -316,8 +316,9 @@ for both CMake and Cargo-native fixtures. Add new shared adapters there as separ lazy archive members; fixture-owned definitions retain precedence. CMake inherits the native owner (`libobs-objects`) link interface rather than maintaining host libraries per test. Cargo's production Rust-archive dependency carries its native -package interface. Both paths put Rust before shared/import providers so allocator -and parser symbols are selected consistently. Link checks prove linking only; +package interface. Both paths put Rust before MSVC import providers so allocator +and parser symbols are selected consistently; ELF/Darwin retain the fixture's +declared DSO binding order. Link checks prove linking only; native runtime checks still own recording callbacks and allocator behavior. #### macOS Rust execution artifacts (#5008) diff --git a/rust/obs-build/src/validation/graph.rs b/rust/obs-build/src/validation/graph.rs index ba0a618028..ad62aa7f6b 100644 --- a/rust/obs-build/src/validation/graph.rs +++ b/rust/obs-build/src/validation/graph.rs @@ -359,9 +359,11 @@ impl Target { names.push(name.into()); } } - // The Rust provider must precede shared/import libraries that export - // the same allocators and parser helpers (MSVC import members collide). - if let Some(index) = names.iter().position(|name| name == "libobs_rust-static") { + // MSVC import members collide with Rust allocators/parser helpers. + // ELF/Darwin fixtures retain their explicitly declared DSO bindings. + if facts.get("MSVC") == Some(&true) + && let Some(index) = names.iter().position(|name| name == "libobs_rust-static") + { let rust = names.remove(index); names.insert(0, rust); } @@ -916,25 +918,14 @@ impl Graph { target.definitions.push((key.into(), value)); } spec.add_header_libraries(&mut target, libraries)?; - if spec.library_names(facts)?.iter().any(|name| { - name == "libobs_rust-static" - && libraries - .get(name) - .is_some_and(|dep| dep.rust_static_support) - }) { - let support = match &rust_support { - Some(support) => support, - None => { - rust_support.insert(rust_static_support::prepare(build, &root, libraries)?) - } - }; - // Private adapters follow Rust, ahead of shared/import providers. - target.dependencies.insert(1, support.clone()); - // Legacy registrations may still name these eager wrappers. - // The manifest now owns their real implementations lazily. - let shared_sources = rust_static_support::sources(&root)?; - target.sources.retain(|path| !shared_sources.contains(path)); - } + rust_static_support::select( + build, + &root, + libraries, + &spec.library_names(facts)?, + &mut target, + &mut rust_support, + )?; for package in &spec.packages { crate::libobs::add_package(&mut target, &build.target, package)?; } diff --git a/rust/obs-build/src/validation/graph/rust_static_support.rs b/rust/obs-build/src/validation/graph/rust_static_support.rs index 6b23e764b3..e463c625c9 100644 --- a/rust/obs-build/src/validation/graph/rust_static_support.rs +++ b/rust/obs-build/src/validation/graph/rust_static_support.rs @@ -60,3 +60,42 @@ pub(super) fn prepare( ); build.static_library(&support) } + +pub(super) fn select( + build: &NativeBuild, + root: &Path, + libraries: &BTreeMap, + names: &[String], + target: &mut SharedLibrary, + cached: &mut Option, +) -> Result<(), String> { + if !names.iter().any(|name| { + name == "libobs_rust-static" + && libraries + .get(name) + .is_some_and(|dep| dep.rust_static_support) + }) { + return Ok(()); + } + let support = match cached { + Some(support) => support, + None => cached.insert(prepare(build, root, libraries)?), + }; + // Private adapters follow Rust, including when a fixture deliberately + // selects a shared provider before that archive. + let archive = libraries["libobs_rust-static"] + .artifacts + .first() + .ok_or("Rust-static dependency has no archive")?; + let index = target + .dependencies + .iter() + .position(|path| path == archive) + .ok_or("Rust-static archive missing from native link")?; + target.dependencies.insert(index + 1, support.clone()); + // Legacy registrations may still name these eager wrappers. The manifest + // now owns their real implementations lazily. + let shared_sources = sources(root)?; + target.sources.retain(|path| !shared_sources.contains(path)); + Ok(()) +} diff --git a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs index cf2df530a8..7dfd4d431f 100644 --- a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs +++ b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs @@ -33,8 +33,14 @@ fn rust_static_precedes_import_providers_and_their_host_closure() { .into(); assert_eq!( graph.targets["fixture"] - .dependency_artifacts(&Default::default(), &dependencies) + .dependency_artifacts(&[("MSVC".into(), true)].into(), &dependencies) .unwrap(), ["rust.lib", "obs.lib", "consumer.a", "host.so"].map(std::path::PathBuf::from) ); + assert_eq!( + graph.targets["fixture"] + .dependency_artifacts(&[("MSVC".into(), false)].into(), &dependencies) + .unwrap(), + ["obs.lib", "consumer.a", "host.so", "rust.lib"].map(std::path::PathBuf::from) + ); } diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index 8e229d3e57..caf1e8ec0c 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -66,16 +66,25 @@ function(obs_rust_static_consumers support native_owner) _obs_uses_rust_static("${target}" "" uses_rust) if(NOT uses_rust STREQUAL "0") get_target_property(links "${target}" LINK_LIBRARIES) - list(REMOVE_ITEM links libobs_rust-static) # Resolve static allocators/parser/logging before OBS's DLL import members. # An indirect consumer also needs this explicit first provider. if(uses_rust STREQUAL "1") - set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "libobs_rust-static;${links};${support}") + if(MSVC) + list(REMOVE_ITEM links libobs_rust-static) + set(links "libobs_rust-static;${links}") + elseif(NOT "libobs_rust-static" IN_LIST links) + # Preserve intentional ELF/Darwin DSO selection. Make an indirect + # Rust edge explicit before support so the archive is searched first. + list(APPEND links libobs_rust-static) + endif() + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};${support}") else() - set_property( - TARGET "${target}" - PROPERTY LINK_LIBRARIES "$<${uses_rust}:libobs_rust-static>;${links};$<${uses_rust}:${support}>" - ) + if(MSVC) + set(links "$<${uses_rust}:libobs_rust-static>;${links}") + else() + set(links "${links};$<${uses_rust}:libobs_rust-static>") + endif() + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};$<${uses_rust}:${support}>") endif() endif() endforeach() From fee024143e22e137e845ac67a453432997843fc1 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 02:49:46 -0800 Subject: [PATCH 07/30] build: let native fixture imports inherit their support owners (Refs #5219) --- ci/test_rust_static_link_support.py | 6 + cmake/cross/CMakeLists.txt | 15 +- cmake/cross/tier2.cmake | 1 + rust/obs-build/src/platform/mod.rs | 2 +- rust/obs-build/src/validation/graph.rs | 96 ++- .../validation/graph/rust_static_support.rs | 24 +- ...rust_static_header_steps_are_registered.rs | 2 + .../rust-static/support/video-info-query.json | 653 ------------------ .../shared_rust_static_support.rs | 56 ++ test/cmocka/build/test-graph.json | 65 +- test/cmocka/native-test-graph.cmake | 4 + test/cmocka/rust-static-link-support.cmake | 121 +++- .../video_info_query_link_support.cmake | 24 +- 13 files changed, 303 insertions(+), 766 deletions(-) delete mode 100644 rust/obs-build/tests/native/registration/rust-static/support/video-info-query.json diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index 9bc52f2ed9..72c8381b4e 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -72,6 +72,9 @@ def check_fixture(self, baseline_host, msvc=True): " target_link_libraries(indirect_consumer PRIVATE support)\n" "endif()\n" 'file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/reference-links.txt" CONTENT "$>")\n' + 'foreach(name IN ITEMS direct indirect_consumer conditional_consumer)\n' + ' file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}-links.txt" CONTENT "$>")\n' + 'endforeach()\n' ) build = source / "build" self.run_command(["cmake", "-S", str(source), "-B", str(build)]) @@ -82,6 +85,9 @@ def check_fixture(self, baseline_host, msvc=True): self.run_command(["cmake", "--build", str(build), "--parallel", "2", "--target", *targets]) for name in targets: self.run_command([str(build / name)]) + if msvc: + links = (build / f"{name}-links.txt").read_text().split(";") + self.assertEqual(links[:2], ["libobs_rust-static", "support"]) def run_command(self, command): result = subprocess.run(command, capture_output=True, text=True, check=False, timeout=60) diff --git a/cmake/cross/CMakeLists.txt b/cmake/cross/CMakeLists.txt index 8b4e5e5fec..66f1044f6e 100644 --- a/cmake/cross/CMakeLists.txt +++ b/cmake/cross/CMakeLists.txt @@ -282,12 +282,16 @@ function(_obs_cross_shared_libobs name) swresample jansson ) + add_library(${name}-native INTERFACE) + add_library(OBS::libobs-native-dependencies ALIAS ${name}-native) + target_link_directories(${name}-native INTERFACE "${OBS_CROSS_DEPS}/lib") + target_link_libraries(${name} PRIVATE ${name}-native) if(_host STREQUAL WINDOWS) # The Rust standard library pulls winsock and NT APIs in through its # objects; the shipped libobs link gets these from the same system libs. target_link_libraries( - ${name} - PRIVATE ${_common_deps} avrt dwmapi dxgi winmm rpcrt4 ws2_32 ntdll bcrypt userenv + ${name}-native + INTERFACE ${_common_deps} avrt dwmapi dxgi winmm rpcrt4 ws2_32 ntdll bcrypt userenv ) # The Rust staticlib's object directives request MSVCRT.lib / OLDNAMES.lib # with Windows' case, while the Linux-side xwin SDK ships msvcrt.lib / @@ -308,6 +312,7 @@ function(_obs_cross_shared_libobs name) ) endforeach() target_link_directories(${name} PRIVATE "${_case_lib_dir}") + target_link_directories(${name}-native INTERFACE "${_case_lib_dir}") # Rust no_mangle shims in a staticlib are not dllexport, so name them, as # libobs/cmake/rust-os-windows.cmake does for the native build. file(GLOB _obs_rust_export_fragments "${OBS_SOURCE_ROOT}/libobs/cmake/rust-exports.d/*.txt") @@ -333,12 +338,12 @@ function(_obs_cross_shared_libobs name) ${name}-pthreads PROPERTIES C_STANDARD 17 C_STANDARD_REQUIRED TRUE PREFIX "" OUTPUT_NAME w32-pthreads ) - target_link_libraries(${name} PRIVATE ${name}-pthreads) + target_link_libraries(${name}-native INTERFACE ${name}-pthreads) set_target_properties(${name} PROPERTIES IMPORT_PREFIX "" IMPORT_SUFFIX ".lib") else() target_link_libraries( - ${name} - PRIVATE + ${name}-native + INTERFACE ${_common_deps} "-framework AppKit" "-framework AudioToolbox" diff --git a/cmake/cross/tier2.cmake b/cmake/cross/tier2.cmake index 02d836e050..6d75bce12d 100644 --- a/cmake/cross/tier2.cmake +++ b/cmake/cross/tier2.cmake @@ -23,6 +23,7 @@ corrosion_import_crate( CRATE_TYPES staticlib PROFILE release ) +target_link_libraries(libobs_rust-static INTERFACE OBS::libobs-native-dependencies) if(OS_MACOS) # A host librt must never satisfy a Darwin dependency probe. diff --git a/rust/obs-build/src/platform/mod.rs b/rust/obs-build/src/platform/mod.rs index 399d86a73d..7971351c69 100644 --- a/rust/obs-build/src/platform/mod.rs +++ b/rust/obs-build/src/platform/mod.rs @@ -1003,7 +1003,7 @@ pub fn configure_rust_static_dependencies( target: &str, library: &mut crate::SharedLibrary, ) -> Result<(), String> { - crate::libobs::add_package(library, target, "jansson")?; + configure_core_dependencies(target, &crate::libobs::Options::default(), library)?; if target.contains("linux") { crate::libobs::add_package(library, target, "uuid")?; // Match the optional native owner: no-GIO archives remain usable on diff --git a/rust/obs-build/src/validation/graph.rs b/rust/obs-build/src/validation/graph.rs index ad62aa7f6b..bb306fb181 100644 --- a/rust/obs-build/src/validation/graph.rs +++ b/rust/obs-build/src/validation/graph.rs @@ -1,7 +1,8 @@ //! Declarative native test targets and their execution contracts. //! //! Selection is explicit: callers provide platform, feature and dependency -//! facts. Unknown facts are errors; the optional HAVE_X11_DISPLAY runtime fact +//! facts. Production archive owners supply their known platform facts; explicit +//! caller values override them. Unknown facts are errors; the optional HAVE_X11_DISPLAY runtime fact //! alone defaults to false when no X server is declared. use crate::{NativeBuild, SharedLibrary}; #[path = "configured_headers.rs"] @@ -242,10 +243,11 @@ impl Target { &self, target: &mut SharedLibrary, libraries: &BTreeMap, + facts: &BTreeMap, ) -> Result<(), String> { + let names = self.library_names(facts)?; for name in &self.header_libraries { - let dependency = libraries - .get(name) + let dependency = native_dependency(name, libraries, &names) .ok_or_else(|| format!("unresolved native test header library {name}"))?; target .include_dirs @@ -377,10 +379,11 @@ impl Target { facts: &BTreeMap, libraries: &BTreeMap, ) -> Result, String> { + let facts = inherited_facts(facts, libraries); + let names = self.library_names(&facts)?; let mut artifacts = Vec::new(); - for name in self.library_names(facts)? { - let dependency = libraries - .get(&name) + for name in &names { + let dependency = native_dependency(name, libraries, &names) .ok_or_else(|| format!("unresolved native test library {name}"))?; artifacts.extend(dependency.artifacts.iter().cloned()); } @@ -553,6 +556,10 @@ pub struct Selection<'a> { pub struct Dependency { /// Production Rust archives also select the shared demand-linked C bridge. pub rust_static_support: bool, + /// SDK interfaces provided by this owner rather than redeclared per fixture. + pub native_libraries: BTreeMap, + /// Known archive-target facts. Explicit caller values take precedence. + pub native_facts: BTreeMap, pub runtime_path_prepend: BTreeMap>, pub artifacts: Vec, pub include_dirs: Vec, @@ -567,6 +574,8 @@ impl From for Dependency { fn from(library: SharedLibrary) -> Self { Self { rust_static_support: false, + native_libraries: BTreeMap::new(), + native_facts: BTreeMap::new(), runtime_path_prepend: BTreeMap::new(), artifacts: library.dependencies, include_dirs: library.include_dirs, @@ -580,6 +589,14 @@ impl From for Dependency { } impl Dependency { + /// Facts known from an archive's target. SDK and feature choices stay explicit. + pub fn target_facts(target: &str) -> BTreeMap { + crate::platform::native_test_facts(target, false, false) + .into_iter() + .filter(|(name, _)| name == "UNIX" || name == "MSVC" || name.starts_with("OS_")) + .collect() + } + /// Import the production archive for the scoped Linux pacing characterization. pub fn rust_static(target: &str, archive: &Path) -> Result { let archive = dunce::canonicalize(archive) @@ -594,6 +611,30 @@ impl Dependency { crate::platform::configure_rust_static_dependencies(target, &mut native)?; let mut dependency = Self::from(native); dependency.rust_static_support = true; + dependency.native_facts = Self::target_facts(target); + dependency + .native_facts + .insert("HAVE_LIBOBS_RUST_STATIC".into(), true); + for name in [ + "OBS::caption", + "Uthash::Uthash", + "SIMDe::SIMDe", + "Threads::Threads", + "FFmpeg::avcodec", + "FFmpeg::avformat", + "FFmpeg::avutil", + "FFmpeg::swscale", + "FFmpeg::swresample", + "jansson::jansson", + "ZLIB::ZLIB", + "LibUUID::LibUUID", + "gio::gio", + "m", + ] { + dependency + .native_libraries + .insert(name.into(), Self::default()); + } dependency.artifacts.push(archive); dependency.link_options.splice( 0..0, @@ -617,6 +658,37 @@ impl Dependency { } } +fn inherited_facts( + facts: &BTreeMap, + libraries: &BTreeMap, +) -> BTreeMap { + let mut inherited = libraries + .get("libobs_rust-static") + .map(|owner| owner.native_facts.clone()) + .unwrap_or_default(); + inherited.extend(facts.iter().map(|(name, value)| (name.clone(), *value))); + inherited +} + +fn native_dependency<'a>( + name: &str, + libraries: &'a BTreeMap, + selected: &[String], +) -> Option<&'a Dependency> { + libraries.get(name).or_else(|| { + selected + .iter() + .any(|name| name == "libobs_rust-static") + .then(|| { + libraries + .get("libobs_rust-static")? + .native_libraries + .get(name) + }) + .flatten() + }) +} + impl Graph { pub fn load(path: &Path) -> Result { let text = fs::read_to_string(path) @@ -768,9 +840,11 @@ impl Graph { libraries: &BTreeMap, ) -> Result, String> { let root = dunce::canonicalize(root).map_err(|error| error.to_string())?; + let inherited = inherited_facts(facts, libraries); + let facts = &inherited; let selected = self.select(facts)?; let mut artifacts = BTreeMap::new(); - let mut rust_support: Option = None; + let mut rust_support = None; let mut watched_inputs = BTreeSet::new(); for (name, spec) in selected.targets { let mut target = SharedLibrary { @@ -917,7 +991,7 @@ impl Graph { }); target.definitions.push((key.into(), value)); } - spec.add_header_libraries(&mut target, libraries)?; + spec.add_header_libraries(&mut target, libraries, facts)?; rust_static_support::select( build, &root, @@ -934,9 +1008,9 @@ impl Graph { } // Static archives precede their dynamic dependencies under // --as-needed, as in the existing native compatibility builder. - for name in spec.library_names(facts)? { - let dependency = libraries - .get(&name) + let names = spec.library_names(facts)?; + for name in &names { + let dependency = native_dependency(name, libraries, &names) .ok_or_else(|| format!("unresolved native test library {name}"))?; target .include_dirs diff --git a/rust/obs-build/src/validation/graph/rust_static_support.rs b/rust/obs-build/src/validation/graph/rust_static_support.rs index e463c625c9..54f9155002 100644 --- a/rust/obs-build/src/validation/graph/rust_static_support.rs +++ b/rust/obs-build/src/validation/graph/rust_static_support.rs @@ -22,11 +22,16 @@ pub(super) fn sources(root: &Path) -> Result, String> { .collect()) } -pub(super) fn prepare( +pub(super) struct Support { + archive: PathBuf, + caption: PathBuf, +} + +fn prepare( build: &NativeBuild, root: &Path, libraries: &BTreeMap, -) -> Result { +) -> Result { let mut support = SharedLibrary { name: "rust-static-link-support".into(), sources: sources(root)?, @@ -58,7 +63,10 @@ pub(super) fn prepare( root.join("test/cmocka/build/rust-static-support.json") .display() ); - build.static_library(&support) + Ok(Support { + archive: build.static_library(&support)?, + caption: crate::libobs::build_caption(build, root)?, + }) } pub(super) fn select( @@ -67,7 +75,7 @@ pub(super) fn select( libraries: &BTreeMap, names: &[String], target: &mut SharedLibrary, - cached: &mut Option, + cached: &mut Option, ) -> Result<(), String> { if !names.iter().any(|name| { name == "libobs_rust-static" @@ -92,7 +100,13 @@ pub(super) fn select( .iter() .position(|path| path == archive) .ok_or("Rust-static archive missing from native link")?; - target.dependencies.insert(index + 1, support.clone()); + target + .dependencies + .insert(index + 1, support.archive.clone()); + target.include_dirs.push(root.join("deps/libcaption")); + target + .link_options + .push(support.caption.to_string_lossy().into_owned()); // Legacy registrations may still name these eager wrappers. The manifest // now owns their real implementations lazily. let shared_sources = sources(root)?; diff --git a/rust/obs-build/tests/native/registration/canonical_rust_static_header_steps_are_registered.rs b/rust/obs-build/tests/native/registration/canonical_rust_static_header_steps_are_registered.rs index 4f2502c2a2..55ca4ebb33 100644 --- a/rust/obs-build/tests/native/registration/canonical_rust_static_header_steps_are_registered.rs +++ b/rust/obs-build/tests/native/registration/canonical_rust_static_header_steps_are_registered.rs @@ -218,6 +218,8 @@ fn canonical_rust_static_header_steps_run_unchanged() { ("HAVE_LIBOBS_RUST_STATIC".into(), true), ("MSVC".into(), false), ("UNIX".into(), true), + // This fixture imports no local portal SDK; Rust owns its native closure. + ("HAVE_PORTAL_TEST_GIO".into(), false), ] .into(); for target in graph.targets.values() { diff --git a/rust/obs-build/tests/native/registration/rust-static/support/video-info-query.json b/rust/obs-build/tests/native/registration/rust-static/support/video-info-query.json deleted file mode 100644 index 9f20bb8264..0000000000 --- a/rust/obs-build/tests/native/registration/rust-static/support/video-info-query.json +++ /dev/null @@ -1,653 +0,0 @@ -{ - "test_async_conversion_plan_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_async_frame_pacing_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_async_upload_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_audio_monitor_delay_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_coreaudio_device_rules_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_coreaudio_pacing_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_deinterlace_draw_plan_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_deinterlace_pacing_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_deinterlace_select_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_monitor_speaker_layout_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_monitor_video_sync_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_monitor_wasapi_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_pulse_monitor_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_service_handler_getters_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_audio_input_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_audio_place_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_audio_render_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_audio_timing_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_color_space_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_draw_plan_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_frame_copy_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_media_admission_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_monitoring_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_ptm_gate_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_render_route_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_size_route_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_video_tick_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_source_volume_apply_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_transition_load_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_transition_render_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - }, - "test_transition_start_steps_rust": { - "sources": [ - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c" - ], - "includes": [ - "." - ], - "header_libraries": [ - "OBS::libobs", - "SIMDe::SIMDe" - ], - "libraries": [ - "OBS::caption", - "Uthash::Uthash", - { - "name": "OBS::w32-pthreads", - "requires": "OS_WINDOWS" - } - ] - } -} diff --git a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs index 7dfd4d431f..3cb6d5f869 100644 --- a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs +++ b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs @@ -44,3 +44,59 @@ fn rust_static_precedes_import_providers_and_their_host_closure() { ["obs.lib", "consumer.a", "host.so", "rust.lib"].map(std::path::PathBuf::from) ); } + +#[test] +fn rust_archive_owns_transitive_sdk_interfaces_and_target_facts() { + use obs_build::validation::graph::{Dependency, Graph}; + let graph = Graph::parse( + r#"{"schema":1,"targets":{"fixture":{"sources":["main.c"], + "libraries":[{"name":"host_sdk","requires":"OS_LINUX"},"libobs_rust-static"]}}, + "tests":{"fixture":{"target":"fixture"}}}"#, + ) + .unwrap(); + let owner = Dependency { + artifacts: vec!["rust.a".into()], + native_facts: Dependency::target_facts("x86_64-unknown-linux-gnu"), + native_libraries: [( + "host_sdk".into(), + Dependency { + artifacts: vec!["host.a".into()], + ..Default::default() + }, + )] + .into(), + ..Default::default() + }; + let libraries = [("libobs_rust-static".into(), owner)].into(); + assert_eq!( + graph.targets["fixture"] + .dependency_artifacts(&Default::default(), &libraries) + .unwrap(), + ["host.a", "rust.a"].map(std::path::PathBuf::from) + ); + assert_eq!( + graph.targets["fixture"] + .dependency_artifacts(&[("OS_LINUX".into(), false)].into(), &libraries) + .unwrap(), + ["rust.a"].map(std::path::PathBuf::from) + ); + for feature in ["ENABLE_HEVC", "UNDECLARED_SDK"] { + let graph = Graph::parse( + &serde_json::json!({ + "schema": 1, + "targets": {"fixture": {"sources": ["main.c"], "libraries": [ + {"name": "host_sdk", "requires": feature}, "libobs_rust-static" + ]}}, + "tests": {"fixture": {"target": "fixture"}} + }) + .to_string(), + ) + .unwrap(); + assert_eq!( + graph.targets["fixture"] + .dependency_artifacts(&Default::default(), &libraries) + .unwrap_err(), + format!("unknown native test requirement {feature}") + ); + } +} diff --git a/test/cmocka/build/test-graph.json b/test/cmocka/build/test-graph.json index 8d3d9c638a..3e4a222117 100644 --- a/test/cmocka/build/test-graph.json +++ b/test/cmocka/build/test-graph.json @@ -304,8 +304,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -428,8 +426,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -540,8 +536,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -752,8 +746,6 @@ "test/cmocka/output-service-getter-link-stub.c", "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", "test/cmocka/output-starting-queries-link-support.c" @@ -1675,8 +1667,6 @@ "test/cmocka/output-service-getter-link-stub.c", "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", "test/cmocka/output-starting-queries-link-support.c" @@ -1771,8 +1761,6 @@ "test/cmocka/output-service-getter-link-stub.c", "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", "test/cmocka/output-starting-queries-link-support.c" @@ -2041,8 +2029,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -2139,8 +2125,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -2214,8 +2198,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -8883,8 +8865,6 @@ "test/cmocka/output-service-getter-link-stub.c", "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", "test/cmocka/output-starting-queries-link-support.c" @@ -8945,8 +8925,6 @@ "test/cmocka/output-service-getter-link-stub.c", "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", "test/cmocka/output-starting-queries-link-support.c" @@ -9008,8 +8986,6 @@ "test/cmocka/output-service-getter-link-stub.c", "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", "test/cmocka/output-starting-queries-link-support.c" @@ -12856,8 +12832,6 @@ "test/cmocka/output-service-getter-link-stub.c", "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", "test/cmocka/output-starting-queries-link-support.c" @@ -15456,10 +15430,7 @@ "test/cmocka/test_service_handler_getters.c", "test/cmocka/service-handler-getters-link-support.c", "libobs/util/base-variadic.c.h", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -16125,8 +16096,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -16213,8 +16182,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -16307,8 +16274,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -16414,8 +16379,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -16533,8 +16496,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -16692,8 +16653,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -16923,8 +16882,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -17183,8 +17140,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -17311,8 +17266,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -17476,8 +17429,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -17592,8 +17543,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -17691,8 +17640,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -18070,8 +18017,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -18148,8 +18093,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -18973,8 +18916,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -19092,8 +19033,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", @@ -19309,8 +19248,6 @@ "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/video-info-query-link-support.c", - "test/cmocka/core-state-link-support.c", "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", diff --git a/test/cmocka/native-test-graph.cmake b/test/cmocka/native-test-graph.cmake index 11055cba32..3bb953de2a 100644 --- a/test/cmocka/native-test-graph.cmake +++ b/test/cmocka/native-test-graph.cmake @@ -947,4 +947,8 @@ function(obs_native_test_graph path root) endif() endforeach() endif() + if(EXISTS "${root}/test/cmocka/build/rust-static-support.json") + include("${root}/test/cmocka/rust-static-link-support.cmake") + obs_rust_static_fixture_support("${root}") + endif() endfunction() diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index caf1e8ec0c..2b003aac73 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -71,21 +71,134 @@ function(obs_rust_static_consumers support native_owner) if(uses_rust STREQUAL "1") if(MSVC) list(REMOVE_ITEM links libobs_rust-static) - set(links "libobs_rust-static;${links}") + set(links "libobs_rust-static;${support};${links}") elseif(NOT "libobs_rust-static" IN_LIST links) # Preserve intentional ELF/Darwin DSO selection. Make an indirect # Rust edge explicit before support so the archive is searched first. list(APPEND links libobs_rust-static) endif() - set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};${support}") + if(MSVC) + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links}") + else() + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};${support}") + endif() else() if(MSVC) - set(links "$<${uses_rust}:libobs_rust-static>;${links}") + set(links "$<${uses_rust}:libobs_rust-static>;$<${uses_rust}:${support}>;${links}") else() set(links "${links};$<${uses_rust}:libobs_rust-static>") endif() - set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};$<${uses_rust}:${support}>") + if(MSVC) + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links}") + else() + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};$<${uses_rust}:${support}>") + endif() endif() endif() endforeach() endfunction() + +# Shared by the complete cmocka project and independent graph fixture projects. +function(obs_add_rust_static_support root native_owner) + if(NOT TARGET video_info_query_link_support) + file(READ "${root}/test/cmocka/build/rust-static-support.json" manifest) + string(JSON count LENGTH "${manifest}" sources) + math(EXPR last "${count} - 1") + set(sources) + foreach(index RANGE ${last}) + string(JSON source GET "${manifest}" sources ${index}) + list(APPEND sources "${root}/${source}") + endforeach() + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${root}/test/cmocka/build/rust-static-support.json") + add_library(video_info_query_link_support STATIC ${sources}) + target_include_directories( + video_info_query_link_support + PRIVATE "${root}" "${root}/libobs" "${CMAKE_BINARY_DIR}/config" + ) + if(TARGET OBS::libobs) + target_include_directories( + video_info_query_link_support + PRIVATE "$" + ) + endif() + target_link_libraries( + video_info_query_link_support + PRIVATE OBS::caption Uthash::Uthash $<$:OBS::w32-pthreads> + ) + endif() + obs_rust_static_consumers(video_info_query_link_support "${native_owner}") +endfunction() + +function(obs_rust_static_fixture_support root) + # Real archive replays need the same owners as the full project. Configuration + # models with an INTERFACE placeholder keep their dependency-free contract. + if( + NOT CMAKE_C_COMPILER_LOADED + OR NOT TARGET libobs_rust-static + OR TARGET OBS::libobs-native-dependencies + OR OBS_CROSS_TIER2 + ) + return() + endif() + get_target_property(type libobs_rust-static TYPE) + get_target_property(archive libobs_rust-static IMPORTED_LOCATION) + if(NOT type STREQUAL "STATIC_LIBRARY" OR NOT EXISTS "${archive}") + return() + endif() + get_directory_property(targets BUILDSYSTEM_TARGETS) + set(has_consumer FALSE) + foreach(target IN LISTS targets) + get_target_property(type "${target}" TYPE) + if(type STREQUAL "EXECUTABLE") + _obs_uses_rust_static("${target}" "" uses_rust) + if(NOT uses_rust STREQUAL "0") + set(has_consumer TRUE) + endif() + endif() + endforeach() + if(NOT has_consumer) + return() + endif() + list(APPEND CMAKE_MODULE_PATH "${root}/cmake/finders") + if(NOT TARGET OBS::caption) + add_subdirectory("${root}/deps/libcaption" "${CMAKE_BINARY_DIR}/rust-static-caption") + endif() + find_package(Uthash REQUIRED) + find_package(SIMDe REQUIRED) + find_package(jansson REQUIRED) + find_package(ZLIB REQUIRED) + find_package(Threads REQUIRED) + find_package( + FFmpeg + REQUIRED + COMPONENTS avcodec avformat avutil swscale swresample + ) + add_library(obs-rust-static-fixture-native INTERFACE) + add_library(OBS::libobs-native-dependencies ALIAS obs-rust-static-fixture-native) + target_link_libraries( + obs-rust-static-fixture-native + INTERFACE + OBS::caption + Uthash::Uthash + SIMDe::SIMDe + jansson::jansson + ZLIB::ZLIB + Threads::Threads + FFmpeg::avcodec + FFmpeg::avformat + FFmpeg::avutil + FFmpeg::swscale + FFmpeg::swresample + ${CMAKE_DL_LIBS} + ) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_package(LibUUID REQUIRED) + find_package(Gio QUIET) + target_link_libraries(obs-rust-static-fixture-native INTERFACE LibUUID::LibUUID m rt util) + if(TARGET gio::gio) + target_link_libraries(obs-rust-static-fixture-native INTERFACE gio::gio) + endif() + endif() + target_link_libraries(libobs_rust-static INTERFACE OBS::libobs-native-dependencies) + obs_add_rust_static_support("${root}" OBS::libobs-native-dependencies) +endfunction() diff --git a/test/cmocka/tests.d/video_info_query_link_support.cmake b/test/cmocka/tests.d/video_info_query_link_support.cmake index dbbd7f63dd..ccb859466f 100644 --- a/test/cmocka/tests.d/video_info_query_link_support.cmake +++ b/test/cmocka/tests.d/video_info_query_link_support.cmake @@ -1,28 +1,6 @@ # Real private adapters in separate lazy members, shared by every Rust consumer. include("${CMAKE_CURRENT_LIST_DIR}/../rust-static-link-support.cmake") function(_video_info_query_link_support) - file(READ "${CMAKE_CURRENT_SOURCE_DIR}/build/rust-static-support.json" manifest) - string(JSON count LENGTH "${manifest}" sources) - math(EXPR last "${count} - 1") - set(sources) - foreach(index RANGE ${last}) - string(JSON source GET "${manifest}" sources ${index}) - list(APPEND sources "${CMAKE_SOURCE_DIR}/${source}") - endforeach() - set_property( - DIRECTORY - APPEND - PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/build/rust-static-support.json" - ) - add_library(video_info_query_link_support STATIC ${sources}) - target_include_directories( - video_info_query_link_support - PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/config" - ) - target_link_libraries( - video_info_query_link_support - PRIVATE OBS::caption Uthash::Uthash $<$:OBS::w32-pthreads> - ) - obs_rust_static_consumers(video_info_query_link_support OBS::libobs-native-dependencies) + obs_add_rust_static_support("${CMAKE_SOURCE_DIR}" OBS::libobs-native-dependencies) endfunction() cmake_language(DEFER CALL _video_info_query_link_support) From e073fa66ef23000db3b95c41fce42263a4875656 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 03:12:15 -0800 Subject: [PATCH 08/30] build: demand-link each real logger provider independently (Refs #5219) --- ci/test_rust_static_link_support.py | 54 ++++++++++++++++++++++ test/cmocka/base-blog-link-support.c | 6 +++ test/cmocka/base-blogva-link-support.c | 6 +++ test/cmocka/base-crash-link-support.c | 6 +++ test/cmocka/base-variadic-link-support.c | 3 ++ test/cmocka/build/rust-static-support.json | 3 ++ 6 files changed, 78 insertions(+) create mode 100644 test/cmocka/base-blog-link-support.c create mode 100644 test/cmocka/base-blogva-link-support.c create mode 100644 test/cmocka/base-crash-link-support.c diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index 72c8381b4e..2073700bb5 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -2,6 +2,7 @@ """Exercise the standalone Rust-static support contract with real native links.""" from pathlib import Path +import json import shutil import subprocess import tempfile @@ -22,6 +23,59 @@ def test_allocator_member_is_selected_before_shared_import_provider(self): def test_non_msvc_preserves_declared_shared_binding(self): self.check_fixture(False, False) + def test_real_logger_members_preserve_fixture_owned_guards(self): + with tempfile.TemporaryDirectory() as directory: + source = Path(directory) + (source / "build").mkdir() + (source / "build/libobs-util.pch.h").write_text( + "#include \n#include \n#include \n" + "typedef void (*log_handler_t)(int, const char *, va_list, void *);\n" + "#define LOG_DEBUG 100\n#define LOG_INFO 200\n#define LOG_WARNING 300\n#define LOG_ERROR 400\n" + "#define UNUSED_PARAMETER(x) (void)(x)\n#define OBS_NORETURN _Noreturn\n" + ) + manifest = json.loads((ROOT / "test/cmocka/build/rust-static-support.json").read_text()) + objects = [] + for member in manifest["sources"]: + if not Path(member).name.startswith("base-"): + continue + output = source / (Path(member).stem + ".o") + self.run_command(["cc", "-std=c11", "-I", str(source), "-I", str(ROOT), + "-c", str(ROOT / member), "-o", str(output)]) + objects.append(str(output)) + archive = source / "support.a" + self.run_command(["ar", "rcs", str(archive), *objects]) + main = source / "main.c" + main.write_text( + '#include "build/libobs-util.pch.h"\n#include \n' + "static int calls, guards;\n" + "static void handler(int level, const char *fmt, va_list args, void *p) " + "{ (void)level; (void)fmt; (void)args; (void)p; ++calls; }\n" + "void base_get_log_handler(log_handler_t *h, void **p) { *h = handler; *p = NULL; }\n" + "int base_begin_crash(void (**h)(const char *, va_list, void *), void **p, int *d) " + "{ (void)h; (void)p; *d = 1; return 0; }\n" + "void blogva(int, const char *, va_list);\n" + "void base_log_literal(log_handler_t, void *, int, const char *);\n" + "log_handler_t base_default_log_handler(void);\n" + "#ifdef FIXTURE_GUARDS\n" + "void blog(int level, const char *fmt, ...) { (void)level; (void)fmt; ++guards; }\n" + "_Noreturn void bcrash(const char *fmt, ...) { (void)fmt; exit(77); }\n" + "#else\nvoid blog(int, const char *, ...);\n_Noreturn void bcrash(const char *, ...);\n#endif\n" + "static void forward(const char *fmt, ...) " + "{ va_list args; va_start(args, fmt); blogva(100, fmt, args); va_end(args); }\n" + "int main(int argc, char **argv) { (void)argv; if (argc > 1) bcrash(\"guard\"); " + "forward(\"log\"); base_log_literal(handler, NULL, 100, \"literal\"); " + "blog(100, \"public\"); if (!base_default_log_handler()) return 1;\n" + "#ifdef FIXTURE_GUARDS\nreturn calls != 2 || guards != 1;\n" + "#else\nreturn calls != 3;\n#endif\n}\n" + ) + for guarded in (False, True): + executable = source / ("guarded" if guarded else "real") + self.run_command(["cc", "-std=c11", *(["-DFIXTURE_GUARDS"] if guarded else []), + str(main), str(archive), "-o", str(executable)]) + self.run_command([str(executable)]) + result = subprocess.run([str(executable), "crash"], capture_output=True, timeout=10) + self.assertEqual(result.returncode, 77 if guarded else 0, result.stderr) + def check_fixture(self, baseline_host, msvc=True): with tempfile.TemporaryDirectory() as directory: source = Path(directory) diff --git a/test/cmocka/base-blog-link-support.c b/test/cmocka/base-blog-link-support.c new file mode 100644 index 0000000000..d9f1696885 --- /dev/null +++ b/test/cmocka/base-blog-link-support.c @@ -0,0 +1,6 @@ +/* A fixture's own public logger must take precedence over this lazy provider. */ +#define base_default_log_handler obs_link_support_blog_default_handler +#define base_log_literal obs_link_support_blog_literal +#define blogva obs_link_support_blog_blogva +#define bcrash obs_link_support_blog_bcrash +#include "libobs/util/base-variadic.c.h" diff --git a/test/cmocka/base-blogva-link-support.c b/test/cmocka/base-blogva-link-support.c new file mode 100644 index 0000000000..a73da17ffe --- /dev/null +++ b/test/cmocka/base-blogva-link-support.c @@ -0,0 +1,6 @@ +/* Requesting the real va_list forwarder must not also select blog or bcrash. */ +#define base_default_log_handler obs_link_support_blogva_default_handler +#define base_log_literal obs_link_support_blogva_literal +#define blog obs_link_support_blogva_blog +#define bcrash obs_link_support_blogva_bcrash +#include "libobs/util/base-variadic.c.h" diff --git a/test/cmocka/base-crash-link-support.c b/test/cmocka/base-crash-link-support.c new file mode 100644 index 0000000000..43c873fd1d --- /dev/null +++ b/test/cmocka/base-crash-link-support.c @@ -0,0 +1,6 @@ +/* Keep the real crash provider independent of fixture-owned public loggers. */ +#define base_default_log_handler obs_link_support_crash_default_handler +#define base_log_literal obs_link_support_crash_literal +#define blog obs_link_support_crash_blog +#define blogva obs_link_support_crash_blogva +#include "libobs/util/base-variadic.c.h" diff --git a/test/cmocka/base-variadic-link-support.c b/test/cmocka/base-variadic-link-support.c index 1a56ec379b..458a13af10 100644 --- a/test/cmocka/base-variadic-link-support.c +++ b/test/cmocka/base-variadic-link-support.c @@ -1,2 +1,5 @@ /* Demand-link the real private logger bridge, preserving fixture-owned loggers. */ +#define blog obs_link_support_bridge_blog +#define blogva obs_link_support_bridge_blogva +#define bcrash obs_link_support_bridge_bcrash #include "libobs/util/base-variadic.c.h" diff --git a/test/cmocka/build/rust-static-support.json b/test/cmocka/build/rust-static-support.json index 65749ba4a8..447ae3a20b 100644 --- a/test/cmocka/build/rust-static-support.json +++ b/test/cmocka/build/rust-static-support.json @@ -3,6 +3,9 @@ "test/cmocka/core-state-link-support.c", "test/cmocka/video-info-query-link-support.c", "test/cmocka/base-variadic-link-support.c", + "test/cmocka/base-blog-link-support.c", + "test/cmocka/base-blogva-link-support.c", + "test/cmocka/base-crash-link-support.c", "test/cmocka/core-initialized-link-support.c", "test/cmocka/source-save-load-link-support.c", "test/cmocka/source-settings-getter-link-support.c", From a60d6231690cdfeafb093a4e2a591ddf5903bba6 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 03:57:39 -0800 Subject: [PATCH 09/30] test(build): reproduce lazy native support callbacks into Rust (Refs #5219) --- ci/test_rust_static_link_support.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index 2073700bb5..f7e5e31ab8 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -85,7 +85,8 @@ def check_fixture(self, baseline_host, msvc=True): "rust.c": "int private_adapter(void); int error_data_add(void); int rust_entry(void) { return error_data_add() + private_adapter(); }\n", "allocator.c": "int bmalloc(void) { return 7; } int error_data_add(void) { return bmalloc(); }\n", "import.c": "int bmalloc(void) { return 100; } int error_data_add(void) { return bmalloc(); }\n", - "adapter.c": "int host_value(void); int private_adapter(void) { return host_value(); }\n", + "adapter.c": "int host_value(void); int rust_callback(void); int private_adapter(void) { return host_value() + rust_callback(); }\n", + "callback.c": "int rust_callback(void) { return 0; }\n", "unused.c": "int unavailable(void); int unused_adapter(void) { return unavailable(); }\n", "host.c": "int host_value(void) { return 10; }\n", } @@ -99,7 +100,7 @@ def check_fixture(self, baseline_host, msvc=True): "add_library(host SHARED host.c)\n" "add_library(host_owner INTERFACE)\n" 'target_link_libraries(host_owner INTERFACE host "$<$:Optional::Host>")\n' - "add_library(libobs_rust-static STATIC rust.c allocator.c)\n" + "add_library(libobs_rust-static STATIC rust.c allocator.c callback.c)\n" "add_library(imported_obs SHARED import.c)\n" "add_library(OBS::libobs ALIAS imported_obs)\n" "add_library(support STATIC adapter.c unused.c)\n" From 6417096e3ac4b3191d9cd1026eb35eaa15c62f7c Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 03:58:17 -0800 Subject: [PATCH 10/30] build: preserve callbacks from lazy support into Rust (Refs #5219) --- rust/obs-build/src/validation/graph/rust_static_support.rs | 2 ++ test/cmocka/rust-static-link-support.cmake | 3 +++ 2 files changed, 5 insertions(+) diff --git a/rust/obs-build/src/validation/graph/rust_static_support.rs b/rust/obs-build/src/validation/graph/rust_static_support.rs index 54f9155002..8a01058217 100644 --- a/rust/obs-build/src/validation/graph/rust_static_support.rs +++ b/rust/obs-build/src/validation/graph/rust_static_support.rs @@ -103,6 +103,8 @@ pub(super) fn select( target .dependencies .insert(index + 1, support.archive.clone()); + // A support member can introduce a previously unseen Rust callback. + target.dependencies.insert(index + 2, archive.clone()); target.include_dirs.push(root.join("deps/libcaption")); target .link_options diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index 2b003aac73..2165937b29 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -52,6 +52,9 @@ function(_obs_uses_rust_static target visited output) endfunction() function(obs_rust_static_consumers support native_owner) + # Real C adapters call back into Rust. Retain that return edge so ELF archive + # selection searches Rust again after extracting a lazy support member. + target_link_libraries("${support}" PRIVATE libobs_rust-static) if(TARGET "${native_owner}") # Inherit the owner's full native closure, including host-selected libraries # and their transitive interfaces. Never copy GObject/Jansson lists per test. From 364cdbfa379ded431524be3897d6f638a041f85d Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 04:31:20 -0800 Subject: [PATCH 11/30] test(build): reproduce nested Rust and native archive callbacks (Refs #5219) --- ci/test_rust_static_link_support.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index f7e5e31ab8..20ebb8fe2c 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -23,6 +23,9 @@ def test_allocator_member_is_selected_before_shared_import_provider(self): def test_non_msvc_preserves_declared_shared_binding(self): self.check_fixture(False, False) + def test_non_msvc_preserves_declared_static_binding(self): + self.check_fixture(False, False, True) + def test_real_logger_members_preserve_fixture_owned_guards(self): with tempfile.TemporaryDirectory() as directory: source = Path(directory) @@ -76,17 +79,20 @@ def test_real_logger_members_preserve_fixture_owned_guards(self): result = subprocess.run([str(executable), "crash"], capture_output=True, timeout=10) self.assertEqual(result.returncode, 77 if guarded else 0, result.stderr) - def check_fixture(self, baseline_host, msvc=True): + def check_fixture(self, baseline_host, msvc=True, rust_first=False): with tempfile.TemporaryDirectory() as directory: source = Path(directory) files = { "main.c": "int rust_entry(void); int bmalloc(void); int main(void) { return rust_entry() != " - + ("17 || bmalloc() != 7" if msvc else "110 || bmalloc() != 100") + "; }\n", + + ("17 || bmalloc() != 7" if msvc or rust_first else "110 || bmalloc() != 100") + "; }\n", "rust.c": "int private_adapter(void); int error_data_add(void); int rust_entry(void) { return error_data_add() + private_adapter(); }\n", "allocator.c": "int bmalloc(void) { return 7; } int error_data_add(void) { return bmalloc(); }\n", "import.c": "int bmalloc(void) { return 100; } int error_data_add(void) { return bmalloc(); }\n", "adapter.c": "int host_value(void); int rust_callback(void); int private_adapter(void) { return host_value() + rust_callback(); }\n", - "callback.c": "int rust_callback(void) { return 0; }\n", + "callback.c": ("int rust_callback(void) { return 0; }\n" if msvc else + "int private_callback_adapter(void); int rust_callback(void) { return private_callback_adapter(); }\n"), + "callback-adapter.c": "int rust_leaf(void); int private_callback_adapter(void) { return rust_leaf(); }\n", + "leaf.c": "int rust_leaf(void) { return 0; }\n", "unused.c": "int unavailable(void); int unused_adapter(void) { return unavailable(); }\n", "host.c": "int host_value(void) { return 10; }\n", } @@ -100,17 +106,18 @@ def check_fixture(self, baseline_host, msvc=True): "add_library(host SHARED host.c)\n" "add_library(host_owner INTERFACE)\n" 'target_link_libraries(host_owner INTERFACE host "$<$:Optional::Host>")\n' - "add_library(libobs_rust-static STATIC rust.c allocator.c callback.c)\n" + "add_library(libobs_rust-static STATIC rust.c allocator.c callback.c leaf.c)\n" "add_library(imported_obs SHARED import.c)\n" "add_library(OBS::libobs ALIAS imported_obs)\n" - "add_library(support STATIC adapter.c unused.c)\n" + "add_library(support STATIC adapter.c callback-adapter.c unused.c)\n" + ("target_link_libraries(support PRIVATE host_owner)\n" if baseline_host else "") + "add_library(indirect INTERFACE)\n" "target_link_libraries(indirect INTERFACE libobs_rust-static)\n" "foreach(name IN ITEMS direct indirect_consumer conditional_consumer)\n" " add_executable(${name} main.c)\n" - " target_link_libraries(${name} PRIVATE OBS::libobs)\n" + + (" target_link_libraries(${name} PRIVATE libobs_rust-static OBS::libobs)\n" if rust_first else + " target_link_libraries(${name} PRIVATE OBS::libobs)\n") + "endforeach()\n" "target_link_libraries(direct PRIVATE libobs_rust-static)\n" "target_link_libraries(indirect_consumer PRIVATE indirect)\n" From d8889e20e1704f10e99d50a145c7dde34f3bbb34 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 04:33:06 -0800 Subject: [PATCH 12/30] build: resolve the Rust and native support archive component to completion (Refs #5219) --- ci/test_rust_static_link_support.py | 2 ++ docs/ci-tooling.md | 4 +++- rust/obs-build/src/platform/mod.rs | 14 ++++++++++++++ .../src/validation/graph/rust_static_support.rs | 6 ++++++ test/cmocka/rust-static-link-support.cmake | 10 ++++++++-- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index 20ebb8fe2c..31e301079f 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -134,9 +134,11 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): " target_link_libraries(indirect_consumer PRIVATE support)\n" "endif()\n" 'file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/reference-links.txt" CONTENT "$>")\n' + 'if(MSVC)\n' 'foreach(name IN ITEMS direct indirect_consumer conditional_consumer)\n' ' file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}-links.txt" CONTENT "$>")\n' 'endforeach()\n' + 'endif()\n' ) build = source / "build" self.run_command(["cmake", "-S", str(source), "-B", str(build)]) diff --git a/docs/ci-tooling.md b/docs/ci-tooling.md index ce9b4b070e..09fa6209f1 100644 --- a/docs/ci-tooling.md +++ b/docs/ci-tooling.md @@ -312,7 +312,9 @@ These local timings are not a hosted critical-path guarantee. Standalone Rust-static support is selected for every consumer, including tests that also link shared libobs or inherit Rust through an interface target. `test/cmocka/build/rust-static-support.json` owns the real private adapter members -for both CMake and Cargo-native fixtures. Add new shared adapters there as separate +for both CMake and Cargo-native fixtures. Linux resolves Rust and support as a +rescan group so newly selected members can call back in either direction. +Add new shared adapters there as separate lazy archive members; fixture-owned definitions retain precedence. CMake inherits the native owner (`libobs-objects`) link interface rather than maintaining host libraries per test. Cargo's production Rust-archive dependency carries its native diff --git a/rust/obs-build/src/platform/mod.rs b/rust/obs-build/src/platform/mod.rs index 7971351c69..5ed77e32f6 100644 --- a/rust/obs-build/src/platform/mod.rs +++ b/rust/obs-build/src/platform/mod.rs @@ -1019,6 +1019,20 @@ pub fn configure_rust_static_dependencies( Ok(()) } +pub fn native_test_static_rescan_options(target: &str, archives: &[&Path]) -> Vec { + if !target.contains("-linux-") { + return Vec::new(); + } + let mut options = vec!["-Wl,--start-group".into()]; + options.extend( + archives + .iter() + .map(|path| path.to_string_lossy().into_owned()), + ); + options.push("-Wl,--end-group".into()); + options +} + pub fn native_test_math_options(target: &str) -> Vec { if target.contains("msvc") { vec![] diff --git a/rust/obs-build/src/validation/graph/rust_static_support.rs b/rust/obs-build/src/validation/graph/rust_static_support.rs index 8a01058217..7c2c739e93 100644 --- a/rust/obs-build/src/validation/graph/rust_static_support.rs +++ b/rust/obs-build/src/validation/graph/rust_static_support.rs @@ -105,6 +105,12 @@ pub(super) fn select( .insert(index + 1, support.archive.clone()); // A support member can introduce a previously unseen Rust callback. target.dependencies.insert(index + 2, archive.clone()); + target + .link_options + .extend(crate::platform::native_test_static_rescan_options( + &build.target, + &[archive.as_path(), support.archive.as_path()], + )); target.include_dirs.push(root.join("deps/libcaption")); target .link_options diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index 2165937b29..6d19651896 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -55,6 +55,12 @@ function(obs_rust_static_consumers support native_owner) # Real C adapters call back into Rust. Retain that return edge so ELF archive # selection searches Rust again after extracting a lazy support member. target_link_libraries("${support}" PRIVATE libobs_rust-static) + set(support_link "${support}") + if(NOT MSVC AND (CMAKE_C_LINK_GROUP_USING_RESCAN_SUPPORTED OR CMAKE_LINK_GROUP_USING_RESCAN_SUPPORTED)) + # Resolve the complete Rust/C callback component, including newly extracted + # members that introduce another callback in the opposite direction. + set(support_link "$") + endif() if(TARGET "${native_owner}") # Inherit the owner's full native closure, including host-selected libraries # and their transitive interfaces. Never copy GObject/Jansson lists per test. @@ -83,7 +89,7 @@ function(obs_rust_static_consumers support native_owner) if(MSVC) set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links}") else() - set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};${support}") + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};${support_link}") endif() else() if(MSVC) @@ -94,7 +100,7 @@ function(obs_rust_static_consumers support native_owner) if(MSVC) set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links}") else() - set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};$<${uses_rust}:${support}>") + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links};$<${uses_rust}:${support_link}>") endif() endif() endif() From 4444bc6f6716ae24680b5795b2200080d34be923 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 04:36:27 -0800 Subject: [PATCH 13/30] build: retain the direct support edge in rescan groups (Refs #5219) --- test/cmocka/rust-static-link-support.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index 6d19651896..6fd339082b 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -59,7 +59,9 @@ function(obs_rust_static_consumers support native_owner) if(NOT MSVC AND (CMAKE_C_LINK_GROUP_USING_RESCAN_SUPPORTED OR CMAKE_LINK_GROUP_USING_RESCAN_SUPPORTED)) # Resolve the complete Rust/C callback component, including newly extracted # members that introduce another callback in the opposite direction. - set(support_link "$") + # Keep the direct support edge visible to existing graph assertions. CMake + # replaces its non-group occurrence with this same group during generation. + set(support_link "${support};$") endif() if(TARGET "${native_owner}") # Inherit the owner's full native closure, including host-selected libraries From b72521c4a14e53ab29e6ef79c064018dc9228db5 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 05:15:39 -0800 Subject: [PATCH 14/30] style: keep upstream registration footer formatted (Refs #5219) --- rust/obs-build/tests/native.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rust/obs-build/tests/native.rs b/rust/obs-build/tests/native.rs index 0b17a549b6..8caf1debbd 100644 --- a/rust/obs-build/tests/native.rs +++ b/rust/obs-build/tests/native.rs @@ -5521,6 +5521,5 @@ mod canonical_source_update_properties_swap_is_registered; #[path = "native/registration/canonical_type_catalog_enum_swap_is_registered.rs"] mod canonical_type_catalog_enum_swap_is_registered; - #[path = "native/registration/canonical_object_id_swap_is_registered.rs"] mod canonical_object_id_swap_is_registered; From 230c8a9053af569e9f7973e4cbe7874a0f5d31cd Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 05:37:58 -0800 Subject: [PATCH 15/30] build: preserve fixture-owned adapter compile definitions (Refs #5219) Ci-Attestation: {"at":1795097713,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":254,"stamp":"60aa8b31ac58c7dd3a47a15112719f5d","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097713,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":254,"stamp":"9a6f96543a2230548fb919f361565cad","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097713,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":254,"stamp":"5bb2332116fbe8098a5db1e9300d153e","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097713,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":254,"stamp":"6ec6385e072e425a597a46fc276ee700","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097457,"gate":"general/all/client-lint","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"bfd8d730b18f8cb60e741bf29ce3f390","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097713,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":254,"stamp":"a798488aabef20ad048810020e967f50","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"016ece3946e728aa8b2abaa42838bb60","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"437a04d4fbc4837c92437c58261cfcde","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"546a5d0eee50374e349c8e3d2872ce21","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"696ffb9652df32d4ef33eea75fe82d6a","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"6cafa6188f92950e548c13d95e0548e3","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"b43e7cb4464db69d8781ce1f8a895eed","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"51595931a403432611f34eb2d9469683","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"d208e9af94a01f97c636594de84b55af","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"c7b7ae0de0409f57c6d17475f18fbe42","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"431ddedf3343ef696e63d2c33f0f3423","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097457,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"6640fc8bb55d7dedabbd91351d33ec72","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795097458,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"8f89a4a5db1178a78c70aa01f2bf47c86ef3580cfd94983a95d15d282aaba419","lane":"client-lint","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":228,"stamp":"845ebe86a8507c878e84933f45b208cd","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Ci-Attestation: {"at":1795098423,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"f8a5d8ec385ed9bfdb36530de6b66d6804552c9963366bd31c3687aff5246d22","lane":"client-test-x86_64-unknown-linux-gnu","parents":["82c0a71aaa158061f47ecdf78b4d260a33c45eb6"],"secs":708,"stamp":"a2f343ee6cb1441e976a79f324ac9a9e","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab","v":1,"via":"run"} Client-Checks: {"checks":{"base":"157e2df84406d7a27034be037f64e80669998e01","coverage":"all-tracked-applicable-files","diff":["ci/test_rust_static_link_support.py","cmake/cross/CMakeLists.txt","cmake/cross/tier2.cmake","cmake/finders/FindGio.cmake","docs/ci-tooling.md","libobs/CMakeLists.txt","rust/obs-build/src/platform/mod.rs","rust/obs-build/src/validation/graph.rs","rust/obs-build/src/validation/graph/rust_static_support.rs","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_rust_static_header_steps_are_registered.rs","rust/obs-build/tests/native/registration/rust-static/support/video-info-query.json","rust/obs-build/tests/native/registration/shared_rust_static_support.rs","test/cmocka/base-blog-link-support.c","test/cmocka/base-blogva-link-support.c","test/cmocka/base-crash-link-support.c","test/cmocka/base-variadic-link-support.c","test/cmocka/build/rust-static-support.json","test/cmocka/build/test-graph.json","test/cmocka/core-initialized-link-support.c","test/cmocka/native-test-graph.cmake","test/cmocka/rust-static-link-support.cmake","test/cmocka/tests.d/video_info_query_link_support.cmake"],"head":"0613ea9348436b5ceea4d85944b43b77e56c346f","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"a3c06e578a759913182b97600b334218613558eda30e1cbe8eb23370a6674d57","tree":"c7ba5e06ae7660040bf4cf723fa4ed72826a51ab"}} --- docs/ci-tooling.md | 2 ++ rust/obs-build/src/validation/graph/rust_static_support.rs | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/ci-tooling.md b/docs/ci-tooling.md index 09fa6209f1..df2ffdca1e 100644 --- a/docs/ci-tooling.md +++ b/docs/ci-tooling.md @@ -314,6 +314,8 @@ that also link shared libobs or inherit Rust through an interface target. `test/cmocka/build/rust-static-support.json` owns the real private adapter members for both CMake and Cargo-native fixtures. Linux resolves Rust and support as a rescan group so newly selected members can call back in either direction. +Fixture-owned adapters keep their compile definitions and take precedence over +the shared fallback members. Add new shared adapters there as separate lazy archive members; fixture-owned definitions retain precedence. CMake inherits the native owner (`libobs-objects`) link interface rather than maintaining host diff --git a/rust/obs-build/src/validation/graph/rust_static_support.rs b/rust/obs-build/src/validation/graph/rust_static_support.rs index 7c2c739e93..723671c287 100644 --- a/rust/obs-build/src/validation/graph/rust_static_support.rs +++ b/rust/obs-build/src/validation/graph/rust_static_support.rs @@ -115,9 +115,7 @@ pub(super) fn select( target .link_options .push(support.caption.to_string_lossy().into_owned()); - // Legacy registrations may still name these eager wrappers. The manifest - // now owns their real implementations lazily. - let shared_sources = sources(root)?; - target.sources.retain(|path| !shared_sources.contains(path)); + // Fixture-owned providers retain their compile definitions and precedence. + // The archive supplies only members those providers do not define. Ok(()) } From 9f4c5b3865f5b08cbf3a59edbdc881a614da5733 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 06:53:39 -0800 Subject: [PATCH 16/30] test(ci): cover every Rust-static consumer in native Tier 2 link mode (Refs #5219) --- ci/cmocka_link_check.py | 16 ++++++++++++++-- ci/test_cmocka_link_check.py | 13 +++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ci/cmocka_link_check.py b/ci/cmocka_link_check.py index 5e64de3f50..95e8e7d883 100644 --- a/ci/cmocka_link_check.py +++ b/ci/cmocka_link_check.py @@ -33,7 +33,19 @@ def discover_targets(reply: Path) -> list[str]: model = json.loads((reply / index["reply"]["codemodel-v2"]["jsonFile"]).read_text()) targets = [json.loads((reply / target["jsonFile"]).read_text()) for target in model["configurations"][0]["targets"]] - rust = sorted(t["name"] for t in targets if t["type"] == "EXECUTABLE" and t["name"].endswith("_rust")) + by_id = {t.get("id", t["name"]): t for t in targets} + + def uses_rust(target: dict, visited: frozenset[str] = frozenset()) -> bool: + name = target["name"] + if name == "libobs_rust-static": + return True + if name in visited or target["type"] in ("SHARED_LIBRARY", "MODULE_LIBRARY"): + return False + return any(uses_rust(by_id[dep["id"]], visited | {name}) + for dep in target.get("dependencies", []) if dep["id"] in by_id) + + rust = sorted(t["name"] for t in targets if t["type"] == "EXECUTABLE" + and (t["name"].endswith("_rust") or uses_rust(t))) if not rust or not any(t["name"] == "libobs-cross-shared" and t["type"] == "SHARED_LIBRARY" for t in targets): raise ValueError("Tier 2 cross-link inventory needs Rust executables and hybrid libobs") return ["libobs-cross-shared", *rust] @@ -136,7 +148,7 @@ def _link(alias: str, work: Path, jobs: int, env: dict[str, str]) -> None: configured = time.monotonic() subprocess.run(["cmake", "-S", str(ROOT), "-B", str(work), "-G", "Ninja", f"-DOBS_CROSS_TARGET={alias}", "-DOBS_CROSS_LINK=ON", "-DOBS_CROSS_TIER2=ON", - "-DCMAKE_BUILD_TYPE=Release", f"-DRust_CARGO={wrappers / 'cargo'}", + "-DCMAKE_BUILD_TYPE=RelWithDebInfo", f"-DRust_CARGO={wrappers / 'cargo'}", f"-DRust_COMPILER={wrappers / 'rustc'}", f"-DRust_CARGO_TARGET={target}", "-DOBS_TEST_SANITIZE_PER_TARGET=OFF", f"-DCMAKE_C_COMPILER_LAUNCHER={env['CMAKE_C_COMPILER_LAUNCHER']}", diff --git a/ci/test_cmocka_link_check.py b/ci/test_cmocka_link_check.py index a984901fa0..440739c047 100644 --- a/ci/test_cmocka_link_check.py +++ b/ci/test_cmocka_link_check.py @@ -119,15 +119,20 @@ def test_uses_generated_target_types_and_names_not_source_regexes(self): refs = [] for name, kind in (("test_existing_rust", "EXECUTABLE"), ("test_new_steps_rust", "EXECUTABLE"), - ("test_plain", "EXECUTABLE"), ("support_rust", "STATIC_LIBRARY"), + ("test_plain", "EXECUTABLE"), ("support_rust", "STATIC_LIBRARY"), + ("test_hotkey_background_enum", "EXECUTABLE"), + ("libobs_rust-static", "STATIC_LIBRARY"), ("libobs-cross-shared", "SHARED_LIBRARY")): filename = name + ".json" - (reply / filename).write_text(json.dumps({"name": name, "type": kind})) - refs.append({"name": name, "jsonFile": filename}) + target = {"id": name, "name": name, "type": kind} + if name == "test_hotkey_background_enum": + target["dependencies"] = [{"id": "libobs_rust-static"}] + (reply / filename).write_text(json.dumps(target)) + refs.append({"id": name, "name": name, "jsonFile": filename}) (reply / "codemodel.json").write_text(json.dumps({"configurations": [{"targets": refs}]})) (reply / "index-1.json").write_text(json.dumps({"reply": {"codemodel-v2": {"jsonFile": "codemodel.json"}}})) self.assertEqual(cmocka_link_check.discover_targets(reply), - ["libobs-cross-shared", "test_existing_rust", "test_new_steps_rust"]) + ["libobs-cross-shared", "test_existing_rust", "test_hotkey_background_enum", "test_new_steps_rust"]) def test_existing_reply_without_rust_executables_fails_closed(self): with tempfile.TemporaryDirectory() as temporary: From 8b48205f0234ec2280219a8092442ff8f644ff86 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 06:57:25 -0800 Subject: [PATCH 17/30] test(build): reject mixed static and DLL providers on MSVC (Refs #5219) --- ci/cmocka_link_check.py | 7 ++++++- ci/test_cmocka_link_check.py | 5 ++++- ci/test_rust_static_link_support.py | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ci/cmocka_link_check.py b/ci/cmocka_link_check.py index 95e8e7d883..b4dab72fe8 100644 --- a/ci/cmocka_link_check.py +++ b/ci/cmocka_link_check.py @@ -44,8 +44,13 @@ def uses_rust(target: dict, visited: frozenset[str] = frozenset()) -> bool: return any(uses_rust(by_id[dep["id"]], visited | {name}) for dep in target.get("dependencies", []) if dep["id"] in by_id) + def links_rust(target: dict) -> bool: + # Imported Corrosion archives do not have codemodel target entries. + return any(Path(part["fragment"].strip('"')).name in ("libobs_rust.lib", "liblibobs_rust.a") + for part in target.get("link", {}).get("commandFragments", [])) + rust = sorted(t["name"] for t in targets if t["type"] == "EXECUTABLE" - and (t["name"].endswith("_rust") or uses_rust(t))) + and (t["name"].endswith("_rust") or uses_rust(t) or links_rust(t))) if not rust or not any(t["name"] == "libobs-cross-shared" and t["type"] == "SHARED_LIBRARY" for t in targets): raise ValueError("Tier 2 cross-link inventory needs Rust executables and hybrid libobs") return ["libobs-cross-shared", *rust] diff --git a/ci/test_cmocka_link_check.py b/ci/test_cmocka_link_check.py index 440739c047..3f77bbbe08 100644 --- a/ci/test_cmocka_link_check.py +++ b/ci/test_cmocka_link_check.py @@ -121,18 +121,21 @@ def test_uses_generated_target_types_and_names_not_source_regexes(self): ("test_new_steps_rust", "EXECUTABLE"), ("test_plain", "EXECUTABLE"), ("support_rust", "STATIC_LIBRARY"), ("test_hotkey_background_enum", "EXECUTABLE"), + ("test_video_level_queries", "EXECUTABLE"), ("libobs_rust-static", "STATIC_LIBRARY"), ("libobs-cross-shared", "SHARED_LIBRARY")): filename = name + ".json" target = {"id": name, "name": name, "type": kind} if name == "test_hotkey_background_enum": target["dependencies"] = [{"id": "libobs_rust-static"}] + if name == "test_video_level_queries": + target["link"] = {"commandFragments": [{"fragment": '"/build/libobs_rust.lib"', "role": "libraries"}]} (reply / filename).write_text(json.dumps(target)) refs.append({"id": name, "name": name, "jsonFile": filename}) (reply / "codemodel.json").write_text(json.dumps({"configurations": [{"targets": refs}]})) (reply / "index-1.json").write_text(json.dumps({"reply": {"codemodel-v2": {"jsonFile": "codemodel.json"}}})) self.assertEqual(cmocka_link_check.discover_targets(reply), - ["libobs-cross-shared", "test_existing_rust", "test_hotkey_background_enum", "test_new_steps_rust"]) + ["libobs-cross-shared", "test_existing_rust", "test_hotkey_background_enum", "test_new_steps_rust", "test_video_level_queries"]) def test_existing_reply_without_rust_executables_fails_closed(self): with tempfile.TemporaryDirectory() as temporary: diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index 31e301079f..178933b933 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -152,6 +152,8 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): if msvc: links = (build / f"{name}-links.txt").read_text().split(";") self.assertEqual(links[:2], ["libobs_rust-static", "support"]) + self.assertNotIn("OBS::libobs", links, + "standalone MSVC Rust must not mix its objects with the full OBS import provider") def run_command(self, command): result = subprocess.run(command, capture_output=True, text=True, check=False, timeout=60) From 8324061cd229b95939d07b434cfba565ef9d3a2f Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 07:24:20 -0800 Subject: [PATCH 18/30] test(build): preserve lazy fixture providers without eager runtime callbacks (Refs #5219) --- ci/test_rust_static_link_support.py | 16 +++++++++++----- .../registration/shared_rust_static_support.rs | 11 +++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index 178933b933..310d5cface 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -84,7 +84,7 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): source = Path(directory) files = { "main.c": "int rust_entry(void); int bmalloc(void); int main(void) { return rust_entry() != " - + ("17 || bmalloc() != 7" if msvc or rust_first else "110 || bmalloc() != 100") + "; }\n", + + ("18 || bmalloc() != 7" if msvc else "17 || bmalloc() != 7" if rust_first else "110 || bmalloc() != 100") + "; }\n", "rust.c": "int private_adapter(void); int error_data_add(void); int rust_entry(void) { return error_data_add() + private_adapter(); }\n", "allocator.c": "int bmalloc(void) { return 7; } int error_data_add(void) { return bmalloc(); }\n", "import.c": "int bmalloc(void) { return 100; } int error_data_add(void) { return bmalloc(); }\n", @@ -95,6 +95,8 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): "leaf.c": "int rust_leaf(void) { return 0; }\n", "unused.c": "int unavailable(void); int unused_adapter(void) { return unavailable(); }\n", "host.c": "int host_value(void) { return 10; }\n", + "eager-link-support.c": "int unavailable(void); int unused_eager_adapter(void) { return unavailable(); }\n", + "fixture-link-support.c": "int host_value(void); int private_adapter(void) { return host_value() + 1; }\n", } for name, content in files.items(): (source / name).write_text(content) @@ -114,18 +116,22 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): + "add_library(indirect INTERFACE)\n" "target_link_libraries(indirect INTERFACE libobs_rust-static)\n" - "foreach(name IN ITEMS direct indirect_consumer conditional_consumer)\n" + "foreach(name IN ITEMS direct direct_copy indirect_consumer conditional_consumer)\n" " add_executable(${name} main.c)\n" + + (" target_sources(${name} PRIVATE eager-link-support.c fixture-link-support.c)\n" if msvc else "") + (" target_link_libraries(${name} PRIVATE libobs_rust-static OBS::libobs)\n" if rust_first else " target_link_libraries(${name} PRIVATE OBS::libobs)\n") + "endforeach()\n" "target_link_libraries(direct PRIVATE libobs_rust-static)\n" + "target_link_libraries(direct_copy PRIVATE libobs_rust-static)\n" "target_link_libraries(indirect_consumer PRIVATE indirect)\n" 'target_link_libraries(conditional_consumer PRIVATE "$<$:indirect>")\n' "file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/reference.c \"int main(void) { return 0; }\\n\")\n" "add_executable(reference ${CMAKE_CURRENT_BINARY_DIR}/reference.c)\n" 'target_link_libraries(reference PRIVATE "$<$:libobs_rust-static>")\n' f'include("{HELPER.as_posix()}" OPTIONAL)\n' + f'include("{(ROOT / "test/cmocka/shared-link-support.cmake").as_posix()}")\n' + 'cmake_language(DEFER CALL obs_share_test_link_support)\n' "if(COMMAND obs_rust_static_consumers)\n" " obs_rust_static_consumers(support host_owner)\n" "else()\n" @@ -135,7 +141,7 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): "endif()\n" 'file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/reference-links.txt" CONTENT "$>")\n' 'if(MSVC)\n' - 'foreach(name IN ITEMS direct indirect_consumer conditional_consumer)\n' + 'foreach(name IN ITEMS direct direct_copy indirect_consumer conditional_consumer)\n' ' file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}-links.txt" CONTENT "$>")\n' 'endforeach()\n' 'endif()\n' @@ -145,13 +151,13 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): reference_links = (build / "reference-links.txt").read_text() self.assertNotIn("libobs_rust-static", reference_links) self.assertNotIn("support", reference_links) - targets = ("direct",) if baseline_host else ("direct", "indirect_consumer", "conditional_consumer") + targets = ("direct",) if baseline_host else ("direct", "direct_copy", "indirect_consumer", "conditional_consumer") self.run_command(["cmake", "--build", str(build), "--parallel", "2", "--target", *targets]) for name in targets: self.run_command([str(build / name)]) if msvc: links = (build / f"{name}-links.txt").read_text().split(";") - self.assertEqual(links[:2], ["libobs_rust-static", "support"]) + self.assertEqual(links[:3], ["libobs_rust-static", f"{name}-rust-static-support", "support"]) self.assertNotIn("OBS::libobs", links, "standalone MSVC Rust must not mix its objects with the full OBS import provider") diff --git a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs index 3cb6d5f869..4e05c4058d 100644 --- a/rust/obs-build/tests/native/registration/shared_rust_static_support.rs +++ b/rust/obs-build/tests/native/registration/shared_rust_static_support.rs @@ -43,6 +43,17 @@ fn rust_static_precedes_import_providers_and_their_host_closure() { .unwrap(), ["obs.lib", "consumer.a", "host.so", "rust.lib"].map(std::path::PathBuf::from) ); + let mut standalone = dependencies.clone(); + standalone + .get_mut("libobs_rust-static") + .unwrap() + .rust_static_support = true; + assert_eq!( + graph.targets["fixture"] + .dependency_artifacts(&[("MSVC".into(), true)].into(), &standalone) + .unwrap(), + ["rust.lib", "consumer.a", "host.so"].map(std::path::PathBuf::from) + ); } #[test] From 5791a6892100f4087acc4aaf4e7f5a871efa7961 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 07:44:16 -0800 Subject: [PATCH 19/30] build: isolate the MSVC Rust-static component from OBS DLL imports (Refs #5219) --- ci/cmocka_link_check.py | 39 ++- ci/test_cmocka_link_check.py | 20 ++ docs/ci-tooling.md | 13 +- libobs/build/libobs.core+.h.c | 1 + libobs/build/libobs.core-output+.h.c | 1 + libobs/build/libobs.core-source+.h.c | 1 + libobs/obs-context-runtime.c.h | 281 ++++++++++++++++++ libobs/obs-encoder-weak-refs.c.h | 33 ++ libobs/obs-encoder.c.h | 27 -- libobs/obs-source-weak-refs.c.h | 18 ++ libobs/obs-source.c.h | 17 -- libobs/obs.c.h | 280 ----------------- rust/obs-build/src/validation/graph.rs | 13 +- .../validation/graph/rust_static_support.rs | 21 +- rust/obs-c-oracle/build.rs | 2 +- test/cmocka/build/rust-static-support.json | 30 +- test/cmocka/cf-preprocessor-link-support.c | 2 + test/cmocka/context-runtime-link-support.c | 2 + test/cmocka/dstr-variadic-link-support.c | 2 + .../cmocka/effect-parser-funcs-link-support.c | 2 + test/cmocka/encoder-weak-refs-link-support.c | 2 + .../graphics-image-convert-link-support.c | 3 + .../cmocka/graphics-image-deps-link-support.c | 2 + .../graphics-image-max-size-link-support.c | 2 + .../graphics-preprocessor-link-support.c | 9 + test/cmocka/graphics-runtime-link-support.c | 6 + .../graphics-texture-file-data-link-support.c | 2 + .../graphics-image-fallback-link-support.c | 2 + .../graphics-image-fallback-link-support.c | 2 + test/cmocka/hotkey-fields-link-support.c | 3 + test/cmocka/profiler-variadic-link-support.c | 2 + test/cmocka/rust-static-link-support.cmake | 97 ++++++ test/cmocka/service-runtime-link-support.c | 2 + test/cmocka/service-state-link-support.c | 2 + .../cmocka/source-weak-control-link-support.c | 2 + test/cmocka/source-weak-refs-link-support.c | 2 + .../texture-creators-fields-link-support.c | 2 + 37 files changed, 599 insertions(+), 348 deletions(-) create mode 100644 libobs/obs-context-runtime.c.h create mode 100644 libobs/obs-encoder-weak-refs.c.h create mode 100644 libobs/obs-source-weak-refs.c.h create mode 100644 test/cmocka/cf-preprocessor-link-support.c create mode 100644 test/cmocka/context-runtime-link-support.c create mode 100644 test/cmocka/dstr-variadic-link-support.c create mode 100644 test/cmocka/effect-parser-funcs-link-support.c create mode 100644 test/cmocka/encoder-weak-refs-link-support.c create mode 100644 test/cmocka/graphics-image-convert-link-support.c create mode 100644 test/cmocka/graphics-image-deps-link-support.c create mode 100644 test/cmocka/graphics-image-max-size-link-support.c create mode 100644 test/cmocka/graphics-preprocessor-link-support.c create mode 100644 test/cmocka/graphics-runtime-link-support.c create mode 100644 test/cmocka/graphics-texture-file-data-link-support.c create mode 100644 test/cmocka/hosts/posix/graphics-image-fallback-link-support.c create mode 100644 test/cmocka/hosts/windows/graphics-image-fallback-link-support.c create mode 100644 test/cmocka/hotkey-fields-link-support.c create mode 100644 test/cmocka/profiler-variadic-link-support.c create mode 100644 test/cmocka/service-runtime-link-support.c create mode 100644 test/cmocka/service-state-link-support.c create mode 100644 test/cmocka/source-weak-control-link-support.c create mode 100644 test/cmocka/source-weak-refs-link-support.c create mode 100644 test/cmocka/texture-creators-fields-link-support.c diff --git a/ci/cmocka_link_check.py b/ci/cmocka_link_check.py index b4dab72fe8..88527f0041 100644 --- a/ci/cmocka_link_check.py +++ b/ci/cmocka_link_check.py @@ -25,14 +25,33 @@ TRIPLES = {"win-x64": "x86_64-pc-windows-msvc", "mac-arm64": "aarch64-apple-darwin"} -def discover_targets(reply: Path) -> list[str]: +def configured_targets(reply: Path) -> list[dict]: indexes = sorted(reply.glob("index-*.json")) if not indexes: raise FileNotFoundError(f"No CMake file-api reply in {reply}") index = json.loads(indexes[-1].read_text()) model = json.loads((reply / index["reply"]["codemodel-v2"]["jsonFile"]).read_text()) - targets = [json.loads((reply / target["jsonFile"]).read_text()) - for target in model["configurations"][0]["targets"]] + return [json.loads((reply / target["jsonFile"]).read_text()) + for target in model["configurations"][0]["targets"]] + + +def links_rust_archive(target: dict) -> bool: + # Imported Corrosion archives do not have codemodel target entries. + return any(Path(part["fragment"].strip('"')).name in ("libobs_rust.lib", "liblibobs_rust.a") + for part in target.get("link", {}).get("commandFragments", [])) + + +def validate_msvc_providers(reply: Path) -> None: + for target in configured_targets(reply): + if target["type"] != "EXECUTABLE" or not links_rust_archive(target): + continue + if any(Path(part["fragment"].strip('"')).name == "obs.lib" + for part in target.get("link", {}).get("commandFragments", [])): + raise ValueError(f"{target['name']}: standalone Rust/support must not mix with obs.dll's full import library") + + +def discover_targets(reply: Path) -> list[str]: + targets = configured_targets(reply) by_id = {t.get("id", t["name"]): t for t in targets} def uses_rust(target: dict, visited: frozenset[str] = frozenset()) -> bool: @@ -44,13 +63,8 @@ def uses_rust(target: dict, visited: frozenset[str] = frozenset()) -> bool: return any(uses_rust(by_id[dep["id"]], visited | {name}) for dep in target.get("dependencies", []) if dep["id"] in by_id) - def links_rust(target: dict) -> bool: - # Imported Corrosion archives do not have codemodel target entries. - return any(Path(part["fragment"].strip('"')).name in ("libobs_rust.lib", "liblibobs_rust.a") - for part in target.get("link", {}).get("commandFragments", [])) - rust = sorted(t["name"] for t in targets if t["type"] == "EXECUTABLE" - and (t["name"].endswith("_rust") or uses_rust(t) or links_rust(t))) + and (t["name"].endswith("_rust") or uses_rust(t) or links_rust_archive(t))) if not rust or not any(t["name"] == "libobs-cross-shared" and t["type"] == "SHARED_LIBRARY" for t in targets): raise ValueError("Tier 2 cross-link inventory needs Rust executables and hybrid libobs") return ["libobs-cross-shared", *rust] @@ -111,7 +125,12 @@ def cache_env(work: Path, tools: Path | None = None) -> dict[str, str]: def build_targets(alias: str, work: Path, jobs: int, env: dict[str, str]) -> None: - targets = discover_targets(work / ".cmake/api/v1/reply") + reply = work / ".cmake/api/v1/reply" + targets = discover_targets(reply) + if alias == "win-x64": + # LLD and native LINK resolve late archive members differently. Enforce + # the component boundary even when LLD happens to accept an import mix. + validate_msvc_providers(reply) (work / "link-targets.json").write_text(json.dumps(targets, indent=2) + "\n") print(f"Tier 2 {alias}: linking hybrid libobs and {len(targets) - 1} Rust fixtures ({jobs} Ninja workers)", flush=True) subprocess.run(["cmake", "--build", str(work), "--parallel", str(jobs), "--target", *targets, diff --git a/ci/test_cmocka_link_check.py b/ci/test_cmocka_link_check.py index 3f77bbbe08..d6928df70a 100644 --- a/ci/test_cmocka_link_check.py +++ b/ci/test_cmocka_link_check.py @@ -69,6 +69,7 @@ def test_each_alias_builds_the_full_inventory_at_the_cpu_budget(self): with self.subTest(alias=alias), tempfile.TemporaryDirectory() as temporary: work = Path(temporary) with mock.patch.object(cmocka_link_check, "discover_targets", return_value=inventory), \ + mock.patch.object(cmocka_link_check, "validate_msvc_providers"), \ mock.patch.object(cmocka_link_check.subprocess, "run") as run: cmocka_link_check.build_targets(alias, work, 3, {}) args = run.call_args.args[0] @@ -84,6 +85,7 @@ def test_alias_link_failures_propagate(self): work = Path(temporary) failure = subprocess.CalledProcessError(1, ["cmake", "--build"]) with mock.patch.object(cmocka_link_check, "discover_targets", return_value=["libobs-cross-shared", "test_existing_rust"]), \ + mock.patch.object(cmocka_link_check, "validate_msvc_providers"), \ mock.patch.object(cmocka_link_check.subprocess, "run", side_effect=failure): with self.assertRaises(subprocess.CalledProcessError): cmocka_link_check.build_targets(alias, work, 2, {}) @@ -113,6 +115,24 @@ def test_cache_is_fresh_and_cannot_inherit_relaxed_or_remote_policy(self): class DiscoveryTest(unittest.TestCase): + def test_msvc_rejects_full_dll_imports_beside_the_rust_archive(self): + with tempfile.TemporaryDirectory() as temporary: + reply = Path(temporary) + target = {"name": "fixture", "type": "EXECUTABLE", "link": {"commandFragments": [ + {"fragment": "libobs_rust.lib", "role": "libraries"}, + {"fragment": '"/build/obs.lib"', "role": "libraries"}, + ]}} + (reply / "fixture.json").write_text(json.dumps(target)) + (reply / "codemodel.json").write_text(json.dumps({"configurations": [{ + "targets": [{"name": "fixture", "jsonFile": "fixture.json"}]}]})) + (reply / "index-1.json").write_text(json.dumps({"reply": { + "codemodel-v2": {"jsonFile": "codemodel.json"}}})) + with self.assertRaisesRegex(ValueError, "must not mix"): + cmocka_link_check.validate_msvc_providers(reply) + target["link"]["commandFragments"].pop() + (reply / "fixture.json").write_text(json.dumps(target)) + cmocka_link_check.validate_msvc_providers(reply) + def test_uses_generated_target_types_and_names_not_source_regexes(self): with tempfile.TemporaryDirectory() as temporary: reply = Path(temporary) diff --git a/docs/ci-tooling.md b/docs/ci-tooling.md index df2ffdca1e..1dd6cbbb99 100644 --- a/docs/ci-tooling.md +++ b/docs/ci-tooling.md @@ -258,7 +258,7 @@ cmake --build build --target cross-win-x64 # cross-mac-arm64, cross-mac-x64 #### Tier 2 pre-queue links (#5189) The Linux-hosted Tier 2 Link Check matrix links hybrid libobs and every -configured cmocka `*_rust` executable independently for Windows MSVC x86_64 and Darwin arm64 +configured Rust-static cmocka executable independently for Windows MSVC x86_64 and Darwin arm64 when `LANES["cmocka_link"]` selects the change. This includes libobs, its linked crates, obs-build registration/support, cmocka, Cargo inputs and the check's own implementation. Unrelated changes keep @@ -274,7 +274,13 @@ uv run --no-project --with cmake==3.31.10 --with ninja==1.13.0 ci/cmocka_link_ch The root CMake cross-link mode includes the unchanged cmocka graph and deferred support fragments. CMake's file-api discovers executable targets after host -conditions have been evaluated; an empty Rust inventory fails. The check builds +conditions have been evaluated, including consumers without a `_rust` suffix. +Imported Corrosion archives are discovered through generated link arguments as +well as target dependencies; an empty Rust inventory fails. The check uses +`RelWithDebInfo`, matching native Tier 2. Windows static consumers retain the +core's headers and demand-linked real C support without its full DLL import +library. The check rejects that import/static mix even if LLD accepts a link +that native MSVC LINK would reject (#5246). The check builds against real target cmocka and SDK libraries, never executes target programs, and saves `link-targets.json` in its build tree. It always refreshes the Rust archive through soldr so source-only edits cannot reuse the cross project's @@ -297,7 +303,8 @@ host Linux libraries cannot satisfy Darwin probes. A successful link does not prove runtime recording/allocator behavior or every binding/order error whose final link succeeds. -Local measurements on a shared Linux worker (four Ninja jobs, 2026-11-19): +Earlier Release measurements before #5246's complete inventory and static-only +Windows support (four Ninja jobs on a shared Linux worker, 2026-11-19): | Target | Fresh CMake/Corrosion tree | Warm tree | |---|---:|---:| diff --git a/libobs/build/libobs.core+.h.c b/libobs/build/libobs.core+.h.c index 4f39379c9b..eaf99c008e 100644 --- a/libobs/build/libobs.core+.h.c +++ b/libobs/build/libobs.core+.h.c @@ -4,6 +4,7 @@ #include "libobs/obs-audio-info-queries.c.h" #include "libobs/obs-base-effect-fields.c.h" +#include "libobs/obs-context-runtime.c.h" #include "libobs/obs-core-cmdline-fields.c.h" #include "libobs/obs-core-frame-interval-fields.c.h" #include "libobs/obs-core-global-fields.c.h" diff --git a/libobs/build/libobs.core-output+.h.c b/libobs/build/libobs.core-output+.h.c index fdd98c5197..d4c49b0543 100644 --- a/libobs/build/libobs.core-output+.h.c +++ b/libobs/build/libobs.core-output+.h.c @@ -38,6 +38,7 @@ #include "libobs/obs-encoder-state-queries-fields.c.h" #include "libobs/obs-encoder-type-info-fields.c.h" #include "libobs/obs-encoder-video-tex-active-fields.c.h" +#include "libobs/obs-encoder-weak-refs.c.h" #include "libobs/obs-encoder.c.h" #include "libobs/obs-output-active-fields.c.h" #include "libobs/obs-output-can-pause-fields.c.h" diff --git a/libobs/build/libobs.core-source+.h.c b/libobs/build/libobs.core-source+.h.c index d43b159069..ec5a7aff02 100644 --- a/libobs/build/libobs.core-source+.h.c +++ b/libobs/build/libobs.core-source+.h.c @@ -100,6 +100,7 @@ #include "libobs/obs-source-update-properties-fields.c.h" #include "libobs/obs-source-update.c.h" #include "libobs/obs-source-weak-predicates-fields.c.h" +#include "libobs/obs-source-weak-refs.c.h" #include "libobs/obs-source.c.h" #include "libobs/obs-texture-metadata-fields.c.h" #include "libobs/obs-timer-dispatch-fields.c.h" diff --git a/libobs/obs-context-runtime.c.h b/libobs/obs-context-runtime.c.h new file mode 100644 index 0000000000..62e139344b --- /dev/null +++ b/libobs/obs-context-runtime.c.h @@ -0,0 +1,281 @@ +#include "libobs/build/libobs.pch.h" + +/* ensures that names are never blank (obs-context-names.c) */ +static inline char *dup_name(const char *name, bool private) +{ + return obs_context_name_dup(name, private, &obs->data.unnamed_index); +} + +static inline bool obs_context_data_init_wrap(struct obs_context_data *context, enum obs_obj_type type, + obs_data_t *settings, const char *name, const char *uuid, + obs_data_t *hotkey_data, bool private) +{ + assert(context); + memset(context, 0, sizeof(*context)); + context->private = private; + context->type = type; + + pthread_mutex_init_value(&context->rename_cache_mutex); + if (pthread_mutex_init(&context->rename_cache_mutex, NULL) != 0) + return false; + + context->signals = signal_handler_create(); + if (!context->signals) + return false; + + context->procs = proc_handler_create(); + if (!context->procs) + return false; + + if (uuid && strlen(uuid) == UUID_STR_LENGTH) + context->uuid = bstrdup(uuid); + /* Only automatically generate UUIDs for sources */ + else if (type == OBS_OBJ_TYPE_SOURCE || type == OBS_OBJ_TYPE_CANVAS) + context->uuid = os_generate_uuid(); + + context->name = dup_name(name, private); + context->settings = obs_data_newref(settings); + context->hotkey_data = obs_data_newref(hotkey_data); + return true; +} + +bool obs_context_data_init(struct obs_context_data *context, enum obs_obj_type type, obs_data_t *settings, + const char *name, const char *uuid, obs_data_t *hotkey_data, bool private) +{ + if (obs_context_data_init_wrap(context, type, settings, name, uuid, hotkey_data, private)) { + return true; + } else { + obs_context_data_free(context); + return false; + } +} + +void obs_context_data_free(struct obs_context_data *context) +{ + obs_hotkeys_context_release(context); + signal_handler_destroy(context->signals); + proc_handler_destroy(context->procs); + obs_data_release(context->settings); + obs_context_data_remove(context); + pthread_mutex_destroy(&context->rename_cache_mutex); + bfree(context->name); + bfree((void *)(uintptr_t)context->uuid); + + for (size_t i = 0; i < context->rename_cache.num; i++) + bfree(context->rename_cache.array[i]); + da_free(context->rename_cache); + + memset(context, 0, sizeof(*context)); +} + +void obs_context_init_control(struct obs_context_data *context, void *object, obs_destroy_cb destroy) +{ + context->control = bzalloc(sizeof(obs_weak_object_t)); + context->control->object = object; + context->destroy = destroy; +} + +void obs_context_data_insert(struct obs_context_data *context, pthread_mutex_t *mutex, void *pfirst) +{ + struct obs_context_data **first = pfirst; + + assert(context); + assert(mutex); + assert(first); + + context->mutex = mutex; + + pthread_mutex_lock(mutex); + context->prev_next = first; + context->next = *first; + *first = context; + if (context->next) + context->next->prev_next = &context->next; + pthread_mutex_unlock(mutex); +} + +static bool context_name_exists(void *phash, const char *name) +{ + struct obs_context_data *head = phash; + struct obs_context_data *item = NULL; + + HASH_FIND_STR(head, name, item); + return item != NULL; +} + +/* NULL when the name is free, else the name made unique + * (obs-context-names.c) */ +static inline char *obs_context_deduplicate_name(void *phash, const char *name) +{ + return obs_context_name_deduplicate(name, context_name_exists, phash); +} + +void obs_context_data_insert_name(struct obs_context_data *context, pthread_mutex_t *mutex, void *pfirst) +{ + struct obs_context_data **first = pfirst; + char *new_name; + + assert(context); + assert(mutex); + assert(first); + + context->mutex = mutex; + + pthread_mutex_lock(mutex); + + /* Ensure name is not a duplicate. */ + new_name = obs_context_deduplicate_name(*first, context->name); + if (new_name) { + blog(LOG_WARNING, + "Attempted to insert context with duplicate name \"%s\"!" + " Name has been changed to \"%s\"", + context->name, new_name); + /* Since this happens before the context creation finishes, + * do not bother to add it to the rename cache. */ + bfree(context->name); + context->name = new_name; + } + + HASH_ADD_STR(*first, name, context); + + pthread_mutex_unlock(mutex); +} + +void obs_context_data_insert_uuid(struct obs_context_data *context, pthread_mutex_t *mutex, void *pfirst_uuid) +{ + struct obs_context_data **first_uuid = pfirst_uuid; + struct obs_context_data *item = NULL; + + assert(context); + assert(mutex); + assert(first_uuid); + + context->mutex = mutex; + + pthread_mutex_lock(mutex); + + /* Ensure UUID is not a duplicate. + * This should only ever happen if a scene collection file has been + * manually edited and an entry has been duplicated without removing + * or regenerating the UUID. */ + HASH_FIND_UUID(*first_uuid, context->uuid, item); + if (item) { + blog(LOG_WARNING, "Attempted to insert context with duplicate UUID \"%s\"!", context->uuid); + /* It is practically impossible for the new UUID to be a + * duplicate, so don't bother checking again. */ + bfree((void *)(uintptr_t)context->uuid); + context->uuid = os_generate_uuid(); + } + + HASH_ADD_UUID(*first_uuid, uuid, context); + pthread_mutex_unlock(mutex); +} + +void obs_context_data_remove(struct obs_context_data *context) +{ + if (context && context->prev_next) { + pthread_mutex_lock(context->mutex); + *context->prev_next = context->next; + if (context->next) + context->next->prev_next = context->prev_next; + context->prev_next = NULL; + pthread_mutex_unlock(context->mutex); + } +} + +void obs_context_data_remove_name(struct obs_context_data *context, pthread_mutex_t *mutex, void *phead) +{ + struct obs_context_data **head = phead; + + assert(head); + + /* A context whose object failed to initialize was never added (its + * hash handle is still zeroed), and deleting it would corrupt or + * dereference the table. */ + if (!context || !context->hh.tbl) + return; + + pthread_mutex_lock(mutex); + HASH_DELETE(hh, *head, context); + pthread_mutex_unlock(mutex); +} + +void obs_context_data_remove_uuid(struct obs_context_data *context, pthread_mutex_t *mutex, void *puuid_head) +{ + struct obs_context_data **uuid_head = puuid_head; + + assert(uuid_head); + + if (!context || !context->uuid || !uuid_head) + return; + + pthread_mutex_lock(mutex); + HASH_DELETE(hh_uuid, *uuid_head, context); + pthread_mutex_unlock(mutex); +} + +void obs_context_wait(struct obs_context_data *context) +{ + /* Not in any list: its object failed to initialize. */ + if (!context->mutex) + return; + + pthread_mutex_lock(context->mutex); + pthread_mutex_unlock(context->mutex); +} + +void obs_context_data_setname(struct obs_context_data *context, const char *name) +{ + pthread_mutex_lock(&context->rename_cache_mutex); + + if (context->name) + da_push_back(context->rename_cache, &context->name); + context->name = dup_name(name, context->private); + + pthread_mutex_unlock(&context->rename_cache_mutex); +} + +void obs_context_data_setname_ht(struct obs_context_data *context, const char *name, void *phead) +{ + struct obs_context_data **head = phead; + char *new_name; + + pthread_mutex_lock(context->mutex); + pthread_mutex_lock(&context->rename_cache_mutex); + + HASH_DEL(*head, context); + if (context->name) + da_push_back(context->rename_cache, &context->name); + + /* Ensure new name is not a duplicate. A NULL name takes the unnamed + * name, as an empty one does. */ + new_name = name ? obs_context_deduplicate_name(*head, name) : NULL; + if (new_name) { + blog(LOG_WARNING, + "Attempted to rename context to duplicate name \"%s\"!" + " New name has been changed to \"%s\"", + name, new_name); + context->name = new_name; + } else { + context->name = dup_name(name, context->private); + } + + HASH_ADD_STR(*head, name, context); + + pthread_mutex_unlock(&context->rename_cache_mutex); + pthread_mutex_unlock(context->mutex); +} + +profiler_name_store_t *obs_get_profiler_name_store(void) +{ + return obs->name_store; +} + +void *obs_obj_get_data(void *obj) +{ + struct obs_context_data *context = obj; + if (!context) + return NULL; + + return context->data; +} diff --git a/libobs/obs-encoder-weak-refs.c.h b/libobs/obs-encoder-weak-refs.c.h new file mode 100644 index 0000000000..e1ae9bcbec --- /dev/null +++ b/libobs/obs-encoder-weak-refs.c.h @@ -0,0 +1,33 @@ +#include "libobs/build/libobs.pch.h" + +#define get_weak(encoder) ((obs_weak_encoder_t *)encoder->context.control) + +void obs_weak_encoder_addref(obs_weak_encoder_t *weak) +{ + if (!weak) + return; + + obs_weak_ref_addref(&weak->ref); +} + +void obs_weak_encoder_release(obs_weak_encoder_t *weak) +{ + if (!weak) + return; + + if (obs_weak_ref_release(&weak->ref)) + bfree(weak); +} + +obs_weak_encoder_t *obs_encoder_get_weak_encoder(obs_encoder_t *encoder) +{ + if (!encoder) + return NULL; + + obs_weak_encoder_t *weak = get_weak(encoder); + obs_weak_encoder_addref(weak); + return weak; +} + + +#undef get_weak diff --git a/libobs/obs-encoder.c.h b/libobs/obs-encoder.c.h index a66e984d60..49f7f0f353 100644 --- a/libobs/obs-encoder.c.h +++ b/libobs/obs-encoder.c.h @@ -1545,23 +1545,6 @@ void obs_encoder_release(obs_encoder_t *encoder) } } -void obs_weak_encoder_addref(obs_weak_encoder_t *weak) -{ - if (!weak) - return; - - obs_weak_ref_addref(&weak->ref); -} - -void obs_weak_encoder_release(obs_weak_encoder_t *weak) -{ - if (!weak) - return; - - if (obs_weak_ref_release(&weak->ref)) - bfree(weak); -} - obs_encoder_t *obs_encoder_get_ref(obs_encoder_t *encoder) { if (!encoder) @@ -1570,16 +1553,6 @@ obs_encoder_t *obs_encoder_get_ref(obs_encoder_t *encoder) return obs_weak_encoder_get_encoder(get_weak(encoder)); } -obs_weak_encoder_t *obs_encoder_get_weak_encoder(obs_encoder_t *encoder) -{ - if (!encoder) - return NULL; - - obs_weak_encoder_t *weak = get_weak(encoder); - obs_weak_encoder_addref(weak); - return weak; -} - obs_encoder_t *obs_weak_encoder_get_encoder(obs_weak_encoder_t *weak) { if (!weak) diff --git a/libobs/obs-source-weak-refs.c.h b/libobs/obs-source-weak-refs.c.h new file mode 100644 index 0000000000..9708bfdcad --- /dev/null +++ b/libobs/obs-source-weak-refs.c.h @@ -0,0 +1,18 @@ +#include "libobs/build/libobs.pch.h" + +void obs_weak_source_addref(obs_weak_source_t *weak) +{ + if (!weak) + return; + + obs_weak_ref_addref(&weak->ref); +} + +void obs_weak_source_release(obs_weak_source_t *weak) +{ + if (!weak) + return; + + if (obs_weak_ref_release(&weak->ref)) + bfree(weak); +} diff --git a/libobs/obs-source.c.h b/libobs/obs-source.c.h index 613fb14e14..6fc60df62b 100644 --- a/libobs/obs-source.c.h +++ b/libobs/obs-source.c.h @@ -717,23 +717,6 @@ void obs_source_release(obs_source_t *source) } } -void obs_weak_source_addref(obs_weak_source_t *weak) -{ - if (!weak) - return; - - obs_weak_ref_addref(&weak->ref); -} - -void obs_weak_source_release(obs_weak_source_t *weak) -{ - if (!weak) - return; - - if (obs_weak_ref_release(&weak->ref)) - bfree(weak); -} - obs_source_t *obs_source_get_ref(obs_source_t *source) { if (!source) diff --git a/libobs/obs.c.h b/libobs/obs.c.h index 2d61887617..fa205cd589 100644 --- a/libobs/obs.c.h +++ b/libobs/obs.c.h @@ -2541,286 +2541,6 @@ void obs_reset_source_uuids(void) pthread_mutex_unlock(&obs->data.sources_mutex); } -/* ensures that names are never blank (obs-context-names.c) */ -static inline char *dup_name(const char *name, bool private) -{ - return obs_context_name_dup(name, private, &obs->data.unnamed_index); -} - -static inline bool obs_context_data_init_wrap(struct obs_context_data *context, enum obs_obj_type type, - obs_data_t *settings, const char *name, const char *uuid, - obs_data_t *hotkey_data, bool private) -{ - assert(context); - memset(context, 0, sizeof(*context)); - context->private = private; - context->type = type; - - pthread_mutex_init_value(&context->rename_cache_mutex); - if (pthread_mutex_init(&context->rename_cache_mutex, NULL) != 0) - return false; - - context->signals = signal_handler_create(); - if (!context->signals) - return false; - - context->procs = proc_handler_create(); - if (!context->procs) - return false; - - if (uuid && strlen(uuid) == UUID_STR_LENGTH) - context->uuid = bstrdup(uuid); - /* Only automatically generate UUIDs for sources */ - else if (type == OBS_OBJ_TYPE_SOURCE || type == OBS_OBJ_TYPE_CANVAS) - context->uuid = os_generate_uuid(); - - context->name = dup_name(name, private); - context->settings = obs_data_newref(settings); - context->hotkey_data = obs_data_newref(hotkey_data); - return true; -} - -bool obs_context_data_init(struct obs_context_data *context, enum obs_obj_type type, obs_data_t *settings, - const char *name, const char *uuid, obs_data_t *hotkey_data, bool private) -{ - if (obs_context_data_init_wrap(context, type, settings, name, uuid, hotkey_data, private)) { - return true; - } else { - obs_context_data_free(context); - return false; - } -} - -void obs_context_data_free(struct obs_context_data *context) -{ - obs_hotkeys_context_release(context); - signal_handler_destroy(context->signals); - proc_handler_destroy(context->procs); - obs_data_release(context->settings); - obs_context_data_remove(context); - pthread_mutex_destroy(&context->rename_cache_mutex); - bfree(context->name); - bfree((void *)(uintptr_t)context->uuid); - - for (size_t i = 0; i < context->rename_cache.num; i++) - bfree(context->rename_cache.array[i]); - da_free(context->rename_cache); - - memset(context, 0, sizeof(*context)); -} - -void obs_context_init_control(struct obs_context_data *context, void *object, obs_destroy_cb destroy) -{ - context->control = bzalloc(sizeof(obs_weak_object_t)); - context->control->object = object; - context->destroy = destroy; -} - -void obs_context_data_insert(struct obs_context_data *context, pthread_mutex_t *mutex, void *pfirst) -{ - struct obs_context_data **first = pfirst; - - assert(context); - assert(mutex); - assert(first); - - context->mutex = mutex; - - pthread_mutex_lock(mutex); - context->prev_next = first; - context->next = *first; - *first = context; - if (context->next) - context->next->prev_next = &context->next; - pthread_mutex_unlock(mutex); -} - -static bool context_name_exists(void *phash, const char *name) -{ - struct obs_context_data *head = phash; - struct obs_context_data *item = NULL; - - HASH_FIND_STR(head, name, item); - return item != NULL; -} - -/* NULL when the name is free, else the name made unique - * (obs-context-names.c) */ -static inline char *obs_context_deduplicate_name(void *phash, const char *name) -{ - return obs_context_name_deduplicate(name, context_name_exists, phash); -} - -void obs_context_data_insert_name(struct obs_context_data *context, pthread_mutex_t *mutex, void *pfirst) -{ - struct obs_context_data **first = pfirst; - char *new_name; - - assert(context); - assert(mutex); - assert(first); - - context->mutex = mutex; - - pthread_mutex_lock(mutex); - - /* Ensure name is not a duplicate. */ - new_name = obs_context_deduplicate_name(*first, context->name); - if (new_name) { - blog(LOG_WARNING, - "Attempted to insert context with duplicate name \"%s\"!" - " Name has been changed to \"%s\"", - context->name, new_name); - /* Since this happens before the context creation finishes, - * do not bother to add it to the rename cache. */ - bfree(context->name); - context->name = new_name; - } - - HASH_ADD_STR(*first, name, context); - - pthread_mutex_unlock(mutex); -} - -void obs_context_data_insert_uuid(struct obs_context_data *context, pthread_mutex_t *mutex, void *pfirst_uuid) -{ - struct obs_context_data **first_uuid = pfirst_uuid; - struct obs_context_data *item = NULL; - - assert(context); - assert(mutex); - assert(first_uuid); - - context->mutex = mutex; - - pthread_mutex_lock(mutex); - - /* Ensure UUID is not a duplicate. - * This should only ever happen if a scene collection file has been - * manually edited and an entry has been duplicated without removing - * or regenerating the UUID. */ - HASH_FIND_UUID(*first_uuid, context->uuid, item); - if (item) { - blog(LOG_WARNING, "Attempted to insert context with duplicate UUID \"%s\"!", context->uuid); - /* It is practically impossible for the new UUID to be a - * duplicate, so don't bother checking again. */ - bfree((void *)(uintptr_t)context->uuid); - context->uuid = os_generate_uuid(); - } - - HASH_ADD_UUID(*first_uuid, uuid, context); - pthread_mutex_unlock(mutex); -} - -void obs_context_data_remove(struct obs_context_data *context) -{ - if (context && context->prev_next) { - pthread_mutex_lock(context->mutex); - *context->prev_next = context->next; - if (context->next) - context->next->prev_next = context->prev_next; - context->prev_next = NULL; - pthread_mutex_unlock(context->mutex); - } -} - -void obs_context_data_remove_name(struct obs_context_data *context, pthread_mutex_t *mutex, void *phead) -{ - struct obs_context_data **head = phead; - - assert(head); - - /* A context whose object failed to initialize was never added (its - * hash handle is still zeroed), and deleting it would corrupt or - * dereference the table. */ - if (!context || !context->hh.tbl) - return; - - pthread_mutex_lock(mutex); - HASH_DELETE(hh, *head, context); - pthread_mutex_unlock(mutex); -} - -void obs_context_data_remove_uuid(struct obs_context_data *context, pthread_mutex_t *mutex, void *puuid_head) -{ - struct obs_context_data **uuid_head = puuid_head; - - assert(uuid_head); - - if (!context || !context->uuid || !uuid_head) - return; - - pthread_mutex_lock(mutex); - HASH_DELETE(hh_uuid, *uuid_head, context); - pthread_mutex_unlock(mutex); -} - -void obs_context_wait(struct obs_context_data *context) -{ - /* Not in any list: its object failed to initialize. */ - if (!context->mutex) - return; - - pthread_mutex_lock(context->mutex); - pthread_mutex_unlock(context->mutex); -} - -void obs_context_data_setname(struct obs_context_data *context, const char *name) -{ - pthread_mutex_lock(&context->rename_cache_mutex); - - if (context->name) - da_push_back(context->rename_cache, &context->name); - context->name = dup_name(name, context->private); - - pthread_mutex_unlock(&context->rename_cache_mutex); -} - -void obs_context_data_setname_ht(struct obs_context_data *context, const char *name, void *phead) -{ - struct obs_context_data **head = phead; - char *new_name; - - pthread_mutex_lock(context->mutex); - pthread_mutex_lock(&context->rename_cache_mutex); - - HASH_DEL(*head, context); - if (context->name) - da_push_back(context->rename_cache, &context->name); - - /* Ensure new name is not a duplicate. A NULL name takes the unnamed - * name, as an empty one does. */ - new_name = name ? obs_context_deduplicate_name(*head, name) : NULL; - if (new_name) { - blog(LOG_WARNING, - "Attempted to rename context to duplicate name \"%s\"!" - " New name has been changed to \"%s\"", - name, new_name); - context->name = new_name; - } else { - context->name = dup_name(name, context->private); - } - - HASH_ADD_STR(*head, name, context); - - pthread_mutex_unlock(&context->rename_cache_mutex); - pthread_mutex_unlock(context->mutex); -} - -profiler_name_store_t *obs_get_profiler_name_store(void) -{ - return obs->name_store; -} - -void *obs_obj_get_data(void *obj) -{ - struct obs_context_data *context = obj; - if (!context) - return NULL; - - return context->data; -} - void obs_reset_audio_monitoring(void) { if (!obs_audio_monitoring_available()) diff --git a/rust/obs-build/src/validation/graph.rs b/rust/obs-build/src/validation/graph.rs index bb306fb181..b7ee063240 100644 --- a/rust/obs-build/src/validation/graph.rs +++ b/rust/obs-build/src/validation/graph.rs @@ -381,11 +381,22 @@ impl Target { ) -> Result, String> { let facts = inherited_facts(facts, libraries); let names = self.library_names(&facts)?; + let standalone_msvc = facts.get("MSVC") == Some(&true) + && names.iter().any(|name| { + name == "libobs_rust-static" + && libraries + .get(name) + .is_some_and(|dep| dep.rust_static_support) + }); let mut artifacts = Vec::new(); for name in &names { let dependency = native_dependency(name, libraries, &names) .ok_or_else(|| format!("unresolved native test library {name}"))?; - artifacts.extend(dependency.artifacts.iter().cloned()); + // Preserve OBS's header interface, but never let its complete DLL + // imports compete with the standalone Rust/support component. + if !(standalone_msvc && name == "OBS::libobs") { + artifacts.extend(dependency.artifacts.iter().cloned()); + } } Ok(artifacts) } diff --git a/rust/obs-build/src/validation/graph/rust_static_support.rs b/rust/obs-build/src/validation/graph/rust_static_support.rs index 723671c287..b353b1a60d 100644 --- a/rust/obs-build/src/validation/graph/rust_static_support.rs +++ b/rust/obs-build/src/validation/graph/rust_static_support.rs @@ -7,19 +7,26 @@ use std::{ const MANIFEST: &str = include_str!("../../../../../test/cmocka/build/rust-static-support.json"); -pub(super) fn sources(root: &Path) -> Result, String> { +pub(super) fn sources(root: &Path, facts: &BTreeMap) -> Result, String> { #[derive(serde::Deserialize)] #[serde(deny_unknown_fields)] struct Manifest { sources: Vec, + #[serde(default)] + platform_sources: BTreeMap>, } let manifest: Manifest = serde_json::from_str(MANIFEST) .map_err(|error| format!("Rust-static support manifest: {error}"))?; - Ok(manifest - .sources - .iter() - .map(|path| root.join(path)) - .collect()) + let mut sources = manifest.sources; + for (fact, paths) in manifest.platform_sources { + if *facts + .get(&fact) + .ok_or_else(|| format!("unknown Rust-static support target fact {fact}"))? + { + sources.extend(paths); + } + } + Ok(sources.iter().map(|path| root.join(path)).collect()) } pub(super) struct Support { @@ -34,7 +41,7 @@ fn prepare( ) -> Result { let mut support = SharedLibrary { name: "rust-static-link-support".into(), - sources: sources(root)?, + sources: sources(root, &Dependency::target_facts(&build.target))?, include_dirs: vec![ root.into(), root.join("libobs"), diff --git a/rust/obs-c-oracle/build.rs b/rust/obs-c-oracle/build.rs index e6dcbb870c..7a0e335d67 100644 --- a/rust/obs-c-oracle/build.rs +++ b/rust/obs-c-oracle/build.rs @@ -666,7 +666,7 @@ fn main() { "}", ), extract_c( - &libobs.join("obs-source.c.h"), + &libobs.join("obs-source-weak-refs.c.h"), "void obs_weak_source_release(", "}", ), diff --git a/test/cmocka/build/rust-static-support.json b/test/cmocka/build/rust-static-support.json index 447ae3a20b..c3fccbd512 100644 --- a/test/cmocka/build/rust-static-support.json +++ b/test/cmocka/build/rust-static-support.json @@ -10,6 +10,32 @@ "test/cmocka/source-save-load-link-support.c", "test/cmocka/source-settings-getter-link-support.c", "test/cmocka/encoder-video-tex-active-fields-link-support.c", - "test/cmocka/encoder-video-tex-active-mix-link-support.c" - ] + "test/cmocka/encoder-video-tex-active-mix-link-support.c", + "test/cmocka/hotkey-fields-link-support.c", + "test/cmocka/service-runtime-link-support.c", + "test/cmocka/service-state-link-support.c", + "test/cmocka/source-weak-control-link-support.c", + "test/cmocka/context-runtime-link-support.c", + "test/cmocka/encoder-weak-refs-link-support.c", + "test/cmocka/source-weak-refs-link-support.c", + "test/cmocka/profiler-variadic-link-support.c", + "test/cmocka/cf-preprocessor-link-support.c", + "test/cmocka/graphics-runtime-link-support.c", + "test/cmocka/dstr-variadic-link-support.c", + "test/cmocka/graphics-image-max-size-link-support.c", + "test/cmocka/graphics-image-deps-link-support.c", + "test/cmocka/graphics-texture-file-data-link-support.c", + "test/cmocka/effect-parser-funcs-link-support.c", + "test/cmocka/texture-creators-fields-link-support.c", + "test/cmocka/graphics-image-convert-link-support.c", + "test/cmocka/graphics-preprocessor-link-support.c" + ], + "platform_sources": { + "OS_WINDOWS": [ + "test/cmocka/hosts/windows/graphics-image-fallback-link-support.c" + ], + "UNIX": [ + "test/cmocka/hosts/posix/graphics-image-fallback-link-support.c" + ] + } } diff --git a/test/cmocka/cf-preprocessor-link-support.c b/test/cmocka/cf-preprocessor-link-support.c new file mode 100644 index 0000000000..bb4f79df89 --- /dev/null +++ b/test/cmocka/cf-preprocessor-link-support.c @@ -0,0 +1,2 @@ +/* The unported C preprocessor, using the Rust tokenizer and allocator. */ +#include "libobs/util/cf-lexer.c.h" diff --git a/test/cmocka/context-runtime-link-support.c b/test/cmocka/context-runtime-link-support.c new file mode 100644 index 0000000000..b3773651eb --- /dev/null +++ b/test/cmocka/context-runtime-link-support.c @@ -0,0 +1,2 @@ +/* Demand-link the unchanged production C runtime implementation. */ +#include "libobs/obs-context-runtime.c.h" diff --git a/test/cmocka/dstr-variadic-link-support.c b/test/cmocka/dstr-variadic-link-support.c new file mode 100644 index 0000000000..51ff5c43c2 --- /dev/null +++ b/test/cmocka/dstr-variadic-link-support.c @@ -0,0 +1,2 @@ +/* The real production provider, selected only on demand. */ +#include "libobs/util/dstr-variadic.c.h" diff --git a/test/cmocka/effect-parser-funcs-link-support.c b/test/cmocka/effect-parser-funcs-link-support.c new file mode 100644 index 0000000000..e06363c5b5 --- /dev/null +++ b/test/cmocka/effect-parser-funcs-link-support.c @@ -0,0 +1,2 @@ +/* The real production provider, selected only on demand. */ +#include "libobs/graphics/effect-parser-funcs.c.h" diff --git a/test/cmocka/encoder-weak-refs-link-support.c b/test/cmocka/encoder-weak-refs-link-support.c new file mode 100644 index 0000000000..eb84a36734 --- /dev/null +++ b/test/cmocka/encoder-weak-refs-link-support.c @@ -0,0 +1,2 @@ +/* Demand-link the unchanged production C runtime implementation. */ +#include "libobs/obs-encoder-weak-refs.c.h" diff --git a/test/cmocka/graphics-image-convert-link-support.c b/test/cmocka/graphics-image-convert-link-support.c new file mode 100644 index 0000000000..40ccf5bed6 --- /dev/null +++ b/test/cmocka/graphics-image-convert-link-support.c @@ -0,0 +1,3 @@ +/* The real FFmpeg frame conversion used by the production image loader. */ +#include "libobs/graphics/graphics-ffmpeg-orientation-adapter.c.h" +#include "libobs/graphics/graphics-texture-file-data-convert.c.h" diff --git a/test/cmocka/graphics-image-deps-link-support.c b/test/cmocka/graphics-image-deps-link-support.c new file mode 100644 index 0000000000..5c64ccb0dd --- /dev/null +++ b/test/cmocka/graphics-image-deps-link-support.c @@ -0,0 +1,2 @@ +/* The real production provider, selected only on demand. */ +#include "libobs/graphics/graphics-ffmpeg.c.h" diff --git a/test/cmocka/graphics-image-max-size-link-support.c b/test/cmocka/graphics-image-max-size-link-support.c new file mode 100644 index 0000000000..abdc53289f --- /dev/null +++ b/test/cmocka/graphics-image-max-size-link-support.c @@ -0,0 +1,2 @@ +/* The real production provider, selected only on demand. */ +#include "libobs/graphics/graphics-image-max-size.c.h" diff --git a/test/cmocka/graphics-preprocessor-link-support.c b/test/cmocka/graphics-preprocessor-link-support.c new file mode 100644 index 0000000000..4cea97d6c7 --- /dev/null +++ b/test/cmocka/graphics-preprocessor-link-support.c @@ -0,0 +1,9 @@ +/* A fixture-owned backend name takes precedence over the real runtime. */ +#include "libobs/build/libobs-graphics.pch.h" + +extern const char *obs_link_support_preprocessor_name(void); + +const char *gs_preprocessor_name(void) +{ + return obs_link_support_preprocessor_name(); +} diff --git a/test/cmocka/graphics-runtime-link-support.c b/test/cmocka/graphics-runtime-link-support.c new file mode 100644 index 0000000000..b211b71c4d --- /dev/null +++ b/test/cmocka/graphics-runtime-link-support.c @@ -0,0 +1,6 @@ +/* Retain the production graphics runtime only for consumers that request it. + * These files share the same private context and imports in the native group. */ +#define gs_preprocessor_name obs_link_support_preprocessor_name +#include "libobs/graphics/graphics-imports.c.h" +#include "libobs/graphics/graphics.c.h" +#include "libobs/graphics/viewport-entrypoints.c.h" diff --git a/test/cmocka/graphics-texture-file-data-link-support.c b/test/cmocka/graphics-texture-file-data-link-support.c new file mode 100644 index 0000000000..8f75eefca4 --- /dev/null +++ b/test/cmocka/graphics-texture-file-data-link-support.c @@ -0,0 +1,2 @@ +/* The real production provider, selected only on demand. */ +#include "libobs/graphics/graphics-texture-file-data.c.h" diff --git a/test/cmocka/hosts/posix/graphics-image-fallback-link-support.c b/test/cmocka/hosts/posix/graphics-image-fallback-link-support.c new file mode 100644 index 0000000000..ec57c82994 --- /dev/null +++ b/test/cmocka/hosts/posix/graphics-image-fallback-link-support.c @@ -0,0 +1,2 @@ +/* The production POSIX fallback, selected by the target facts. */ +#include "libobs/graphics/graphics-ffmpeg-host-posix.c.h" diff --git a/test/cmocka/hosts/windows/graphics-image-fallback-link-support.c b/test/cmocka/hosts/windows/graphics-image-fallback-link-support.c new file mode 100644 index 0000000000..473cd31a2c --- /dev/null +++ b/test/cmocka/hosts/windows/graphics-image-fallback-link-support.c @@ -0,0 +1,2 @@ +/* The production Windows WIC fallback, selected by the target facts. */ +#include "libobs/graphics/graphics-ffmpeg-host-windows.c.h" diff --git a/test/cmocka/hotkey-fields-link-support.c b/test/cmocka/hotkey-fields-link-support.c new file mode 100644 index 0000000000..86fe8f30bb --- /dev/null +++ b/test/cmocka/hotkey-fields-link-support.c @@ -0,0 +1,3 @@ +/* Real private adapters, retained only when a Rust archive member needs them. */ +#include "libobs/obs-hotkey-identity-fields.c.h" +#include "libobs/obs-hotkey-object-fields.c.h" diff --git a/test/cmocka/profiler-variadic-link-support.c b/test/cmocka/profiler-variadic-link-support.c new file mode 100644 index 0000000000..3e071c8613 --- /dev/null +++ b/test/cmocka/profiler-variadic-link-support.c @@ -0,0 +1,2 @@ +/* Demand-link the unchanged production C runtime implementation. */ +#include "libobs/util/profiler-variadic.c.h" diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index 6fd339082b..0278ab5ad4 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -51,7 +51,82 @@ function(_obs_uses_rust_static target visited output) endif() endfunction() +function(_obs_demand_rust_static_support) + get_directory_property(targets BUILDSYSTEM_TARGETS) + foreach(target IN LISTS targets) + get_target_property(type "${target}" TYPE) + if(NOT type STREQUAL "EXECUTABLE") + continue() + endif() + _obs_uses_rust_static("${target}" "" uses_rust) + if(uses_rust STREQUAL "0") + continue() + endif() + get_target_property(sources "${target}" SOURCES) + set(adapters) + set(fixture_sources) + foreach(source IN LISTS sources) + if(source MATCHES "-link-(support|stubs?)\\.c$" OR source MATCHES "^\\$]+>$") + list(APPEND adapters "${source}") + else() + list(APPEND fixture_sources "${source}") + endif() + endforeach() + if(NOT adapters) + continue() + endif() + # Preserve the fixture's definitions, source properties and header order. + # Each adapter remains an independent member; unrelated runtime callbacks + # must not select Rust objects or DLL imports in an isolated fixture. + set(local_support "${target}-rust-static-support") + add_library("${local_support}" STATIC ${adapters}) + set_target_properties("${local_support}" PROPERTIES UNITY_BUILD OFF) + foreach( + property + IN + ITEMS + COMPILE_DEFINITIONS + COMPILE_OPTIONS + COMPILE_FLAGS + COMPILE_FEATURES + INCLUDE_DIRECTORIES + SYSTEM_INCLUDE_DIRECTORIES + C_STANDARD + C_STANDARD_REQUIRED + C_EXTENSIONS + MSVC_RUNTIME_LIBRARY + MSVC_DEBUG_INFORMATION_FORMAT + ) + get_target_property(value "${target}" "${property}") + if(NOT value MATCHES "-NOTFOUND$") + set_property(TARGET "${local_support}" PROPERTY "${property}" "${value}") + endif() + endforeach() + get_target_property(links "${target}" LINK_LIBRARIES) + target_link_libraries("${local_support}" PRIVATE "$") + # Fixture-owned recording adapters precede the generic fallback archive. + list(INSERT links 1 "${local_support}") + set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links}") + set_property(TARGET "${target}" PROPERTY SOURCES "${fixture_sources}") + endforeach() +endfunction() + function(obs_rust_static_consumers support native_owner) + if(MSVC AND TARGET OBS::libobs AND NOT TARGET obs-rust-static-headers) + # A standalone Rust executable must use one allocator/logger implementation. + # Keep the core's header requirements without its competing DLL imports. + add_library(obs-rust-static-headers INTERFACE) + foreach( + property + IN + ITEMS INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES COMPILE_DEFINITIONS COMPILE_OPTIONS COMPILE_FEATURES + ) + get_target_property(value OBS::libobs INTERFACE_${property}) + if(value) + set_property(TARGET obs-rust-static-headers PROPERTY INTERFACE_${property} "${value}") + endif() + endforeach() + endif() # Real C adapters call back into Rust. Retain that return edge so ELF archive # selection searches Rust again after extracting a lazy support member. target_link_libraries("${support}" PRIVATE libobs_rust-static) @@ -77,6 +152,9 @@ function(obs_rust_static_consumers support native_owner) _obs_uses_rust_static("${target}" "" uses_rust) if(NOT uses_rust STREQUAL "0") get_target_property(links "${target}" LINK_LIBRARIES) + if(MSVC AND TARGET obs-rust-static-headers) + list(TRANSFORM links REPLACE "^(OBS::libobs|libobs)$" "obs-rust-static-headers") + endif() # Resolve static allocators/parser/logging before OBS's DLL import members. # An indirect consumer also needs this explicit first provider. if(uses_rust STREQUAL "1") @@ -107,6 +185,10 @@ function(obs_rust_static_consumers support native_owner) endif() endif() endforeach() + if(MSVC) + # Run after every legacy deferred fragment has supplied its real adapters. + cmake_language(DEFER CALL _obs_demand_rust_static_support) + endif() endfunction() # Shared by the complete cmocka project and independent graph fixture projects. @@ -120,6 +202,21 @@ function(obs_add_rust_static_support root native_owner) string(JSON source GET "${manifest}" sources ${index}) list(APPEND sources "${root}/${source}") endforeach() + string(JSON platforms ERROR_VARIABLE missing LENGTH "${manifest}" platform_sources) + if(NOT missing AND platforms GREATER 0) + math(EXPR platform_last "${platforms} - 1") + foreach(index RANGE ${platform_last}) + string(JSON fact MEMBER "${manifest}" platform_sources ${index}) + if(${fact}) + string(JSON count LENGTH "${manifest}" platform_sources "${fact}") + math(EXPR last "${count} - 1") + foreach(member RANGE ${last}) + string(JSON source GET "${manifest}" platform_sources "${fact}" ${member}) + list(APPEND sources "${root}/${source}") + endforeach() + endif() + endforeach() + endif() set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${root}/test/cmocka/build/rust-static-support.json") add_library(video_info_query_link_support STATIC ${sources}) target_include_directories( diff --git a/test/cmocka/service-runtime-link-support.c b/test/cmocka/service-runtime-link-support.c new file mode 100644 index 0000000000..6665a485a0 --- /dev/null +++ b/test/cmocka/service-runtime-link-support.c @@ -0,0 +1,2 @@ +/* The production C lifecycle steps called by the Rust service implementation. */ +#include "libobs/obs-service.c.h" diff --git a/test/cmocka/service-state-link-support.c b/test/cmocka/service-state-link-support.c new file mode 100644 index 0000000000..0cc05238a7 --- /dev/null +++ b/test/cmocka/service-state-link-support.c @@ -0,0 +1,2 @@ +/* Real private layouts for Rust service state and output ownership. */ +#include "libobs/obs-service-state-adapter.c.h" diff --git a/test/cmocka/source-weak-control-link-support.c b/test/cmocka/source-weak-control-link-support.c new file mode 100644 index 0000000000..652d487042 --- /dev/null +++ b/test/cmocka/source-weak-control-link-support.c @@ -0,0 +1,2 @@ +/* The production weak-control accessor for standalone Rust consumers. */ +#include "libobs/obs-source-get-weak-fields.c.h" diff --git a/test/cmocka/source-weak-refs-link-support.c b/test/cmocka/source-weak-refs-link-support.c new file mode 100644 index 0000000000..22a7e070ed --- /dev/null +++ b/test/cmocka/source-weak-refs-link-support.c @@ -0,0 +1,2 @@ +/* Demand-link the unchanged production C runtime implementation. */ +#include "libobs/obs-source-weak-refs.c.h" diff --git a/test/cmocka/texture-creators-fields-link-support.c b/test/cmocka/texture-creators-fields-link-support.c new file mode 100644 index 0000000000..d69a718405 --- /dev/null +++ b/test/cmocka/texture-creators-fields-link-support.c @@ -0,0 +1,2 @@ +/* The real production provider, selected only on demand. */ +#include "libobs/graphics/texture-creators-fields.c.h" From b6174af82c09e458e9f6645bc2303bace69a3206 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 07:51:23 -0800 Subject: [PATCH 20/30] test(build): keep inactive Rust consumers on their DLL provider (Refs #5219) --- ci/test_rust_static_link_support.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index 310d5cface..fccd64ddd6 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -97,6 +97,7 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): "host.c": "int host_value(void) { return 10; }\n", "eager-link-support.c": "int unavailable(void); int unused_eager_adapter(void) { return unavailable(); }\n", "fixture-link-support.c": "int host_value(void); int private_adapter(void) { return host_value() + 1; }\n", + "reference-link-support.c": "int bmalloc(void); int dll_counter(void) { return bmalloc(); }\n", } for name, content in files.items(): (source / name).write_text(content) @@ -126,9 +127,9 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): "target_link_libraries(direct_copy PRIVATE libobs_rust-static)\n" "target_link_libraries(indirect_consumer PRIVATE indirect)\n" 'target_link_libraries(conditional_consumer PRIVATE "$<$:indirect>")\n' - "file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/reference.c \"int main(void) { return 0; }\\n\")\n" - "add_executable(reference ${CMAKE_CURRENT_BINARY_DIR}/reference.c)\n" - 'target_link_libraries(reference PRIVATE "$<$:libobs_rust-static>")\n' + "file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/reference.c \"int dll_counter(void); int main(void) { return dll_counter() != 100; }\\n\")\n" + "add_executable(reference ${CMAKE_CURRENT_BINARY_DIR}/reference.c reference-link-support.c)\n" + 'target_link_libraries(reference PRIVATE OBS::libobs "$<$:libobs_rust-static>")\n' f'include("{HELPER.as_posix()}" OPTIONAL)\n' f'include("{(ROOT / "test/cmocka/shared-link-support.cmake").as_posix()}")\n' 'cmake_language(DEFER CALL obs_share_test_link_support)\n' @@ -152,7 +153,8 @@ def check_fixture(self, baseline_host, msvc=True, rust_first=False): self.assertNotIn("libobs_rust-static", reference_links) self.assertNotIn("support", reference_links) targets = ("direct",) if baseline_host else ("direct", "direct_copy", "indirect_consumer", "conditional_consumer") - self.run_command(["cmake", "--build", str(build), "--parallel", "2", "--target", *targets]) + self.run_command(["cmake", "--build", str(build), "--parallel", "2", "--target", "reference", *targets]) + self.run_command([str(build / "reference")]) for name in targets: self.run_command([str(build / name)]) if msvc: From 0b9187c3c072b68965969ccb27d6d61175c37035 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 07:51:23 -0800 Subject: [PATCH 21/30] build: preserve inactive conditional DLL consumers and adapters (Refs #5219) --- test/cmocka/rust-static-link-support.cmake | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index 0278ab5ad4..7581b0a377 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -68,6 +68,9 @@ function(_obs_demand_rust_static_support) foreach(source IN LISTS sources) if(source MATCHES "-link-(support|stubs?)\\.c$" OR source MATCHES "^\\$]+>$") list(APPEND adapters "${source}") + if(NOT uses_rust STREQUAL "1") + list(APPEND fixture_sources "$<$:${source}>") + endif() else() list(APPEND fixture_sources "${source}") endif() @@ -79,7 +82,7 @@ function(_obs_demand_rust_static_support) # Each adapter remains an independent member; unrelated runtime callbacks # must not select Rust objects or DLL imports in an isolated fixture. set(local_support "${target}-rust-static-support") - add_library("${local_support}" STATIC ${adapters}) + add_library("${local_support}" STATIC EXCLUDE_FROM_ALL ${adapters}) set_target_properties("${local_support}" PROPERTIES UNITY_BUILD OFF) foreach( property @@ -105,7 +108,11 @@ function(_obs_demand_rust_static_support) get_target_property(links "${target}" LINK_LIBRARIES) target_link_libraries("${local_support}" PRIVATE "$") # Fixture-owned recording adapters precede the generic fallback archive. - list(INSERT links 1 "${local_support}") + if(uses_rust STREQUAL "1") + list(INSERT links 1 "${local_support}") + else() + list(INSERT links 1 "$<${uses_rust}:${local_support}>") + endif() set_property(TARGET "${target}" PROPERTY LINK_LIBRARIES "${links}") set_property(TARGET "${target}" PROPERTY SOURCES "${fixture_sources}") endforeach() @@ -153,7 +160,19 @@ function(obs_rust_static_consumers support native_owner) if(NOT uses_rust STREQUAL "0") get_target_property(links "${target}" LINK_LIBRARIES) if(MSVC AND TARGET obs-rust-static-headers) - list(TRANSFORM links REPLACE "^(OBS::libobs|libobs)$" "obs-rust-static-headers") + set(provider_links) + foreach(link IN LISTS links) + if(link MATCHES "^(OBS::libobs|libobs)$") + if(uses_rust STREQUAL "1") + list(APPEND provider_links obs-rust-static-headers) + else() + list(APPEND provider_links "$") + endif() + else() + list(APPEND provider_links "${link}") + endif() + endforeach() + set(links "${provider_links}") endif() # Resolve static allocators/parser/logging before OBS's DLL import members. # An indirect consumer also needs this explicit first provider. From e6d10eace81d2bee2eabeb54c156eb54de2eadd1 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 08:03:11 -0800 Subject: [PATCH 22/30] test(build): reproduce missing Windows support in independent CMake consumers (Refs #5219) --- ci/test_rust_static_link_support.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/ci/test_rust_static_link_support.py b/ci/test_rust_static_link_support.py index fccd64ddd6..47f409fe5a 100644 --- a/ci/test_rust_static_link_support.py +++ b/ci/test_rust_static_link_support.py @@ -14,6 +14,37 @@ @unittest.skipUnless(shutil.which("cmake") and shutil.which("cc"), "requires CMake and C compiler") class RustStaticLinkSupport(unittest.TestCase): + def test_independent_cmake_inherits_physical_windows_sources(self): + with tempfile.TemporaryDirectory() as directory: + source = Path(directory) + manifest = source / "test/cmocka/build/rust-static-support.json" + manifest.parent.mkdir(parents=True) + manifest.write_text(json.dumps({"sources": ["common.c"], "platform_sources": { + "OS_WINDOWS": ["windows.c"], "UNIX": ["posix.c"]}})) + for name, body in { + "common.c": "int common_support(void) { return 0; }\n", + "rust.c": "int rust_support(void) { return 0; }\n", + "windows.c": "int platform_value(void) { return 13; }\n", + "posix.c": "int platform_value(void) { return 27; }\n", + "main.c": "int platform_value(void); int main(void) { return platform_value() != 13; }\n", + }.items(): + (source / name).write_text(body) + (source / "CMakeLists.txt").write_text( + "cmake_minimum_required(VERSION 3.28)\nproject(independent_support C)\n" + "set(MSVC TRUE)\nset(WIN32 TRUE)\nset(UNIX FALSE)\nunset(OS_WINDOWS)\n" + "add_library(libobs_rust-static STATIC rust.c)\n" + "add_library(caption INTERFACE)\nadd_library(OBS::caption ALIAS caption)\n" + "add_library(uthash INTERFACE)\nadd_library(Uthash::Uthash ALIAS uthash)\n" + "add_library(host_owner INTERFACE)\nadd_executable(consumer main.c)\n" + "target_link_libraries(consumer PRIVATE libobs_rust-static)\n" + f'include("{HELPER.as_posix()}")\n' + 'obs_add_rust_static_support("${CMAKE_CURRENT_SOURCE_DIR}" host_owner)\n' + ) + build = source / "build" + self.run_command(["cmake", "-S", str(source), "-B", str(build)]) + self.run_command(["cmake", "--build", str(build), "--target", "consumer"]) + self.run_command([str(build / "consumer")]) + def test_shared_consumer_transitive_host_and_static_allocator(self): self.check_fixture(False) From 957ae77cf74341cd1241725dc32c923bc8071f21 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 08:03:13 -0800 Subject: [PATCH 23/30] build: inherit physical Windows facts in independent support projects (Refs #5219) --- test/cmocka/rust-static-link-support.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/cmocka/rust-static-link-support.cmake b/test/cmocka/rust-static-link-support.cmake index 7581b0a377..29ca67af65 100644 --- a/test/cmocka/rust-static-link-support.cmake +++ b/test/cmocka/rust-static-link-support.cmake @@ -212,6 +212,9 @@ endfunction() # Shared by the complete cmocka project and independent graph fixture projects. function(obs_add_rust_static_support root native_owner) + if(NOT DEFINED OS_WINDOWS) + set(OS_WINDOWS "${WIN32}") + endif() if(NOT TARGET video_info_query_link_support) file(READ "${root}/test/cmocka/build/rust-static-support.json" manifest) string(JSON count LENGTH "${manifest}" sources) From e00c8175f9f566ecd43ecb162612d2b69a9381e3 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 08:12:05 -0800 Subject: [PATCH 24/30] style: format the extracted encoder weak-reference unit (Refs #5219) Ci-Attestation: {"at":1795105311,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":188,"stamp":"df3cf3982a6e644543a48ac4e3fc317d","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105311,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":188,"stamp":"5d9d5b3310c9bbb9c8ca934d3bb91014","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105311,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":188,"stamp":"22b5696700247bca2697a48bcb9e6070","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105311,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":188,"stamp":"99ba9adb54d4d501cfa35bd633890fbb","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105120,"gate":"general/all/client-lint","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"9957320ac203fc6fe5e4425081865193","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105311,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":188,"stamp":"3e9f103c7bcf196f60641e358b2c259b","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"c137b4ab8ce4984a984309605f7bd65f","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"073314aff642b712c6b6d93ede2df9cb","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"58ea3a0d727e4a4e232c730e16bd511b","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"d865d1e31293b9576814f3060a32bee5","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"6a68a988734e3c2c4d640a38a4d62472","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"44fdf4e67368f64178fb3b150f817aed","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"4e9fa675c1271acb16b970ddb2b40592","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"5e495eb79f9e1ab995826e037aff0c1f","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"8de6befbae8c43d472a94cd3596a4156","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105121,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"53fd3842afe9dd207d72fb8548028625","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105120,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"b0907cf78e4eaec3728abc4c5f46986c","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105120,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"d9d5e1a5d0b4f3f0b43d8401f6e22ac77fee76fee827d227b2fdee4991a7a911","lane":"client-lint","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":373,"stamp":"50283395dcd05f9ee4e46dec209bca3d","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Ci-Attestation: {"at":1795105982,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"470befe621f02535a37b3be05b8ae7b1bec43fc5a115fbdef6a6d90e444c9a14","lane":"client-test-x86_64-unknown-linux-gnu","parents":["13f4d5e0fffd71445272ebf16833feb0ec297113"],"secs":671,"stamp":"c5e93d3b25381189158cf0b8fabbe824","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30","v":1,"via":"run"} Client-Checks: {"checks":{"base":"9135554e3e5b9c608f75794f930709ea15dd2af8","coverage":"all-tracked-applicable-files","diff":["ci/cmocka_link_check.py","ci/test_cmocka_link_check.py","ci/test_rust_static_link_support.py","cmake/cross/CMakeLists.txt","cmake/cross/tier2.cmake","cmake/finders/FindGio.cmake","docs/ci-tooling.md","docs/features.md","frontend/utility/dock-proportions.hpp","frontend/widgets/OBSBasic_Docks.cpp.hpp","libobs/CMakeLists.txt","libobs/build/libobs.core+.h.c","libobs/build/libobs.core-output+.h.c","libobs/build/libobs.core-source+.h.c","libobs/build/libobs.graphics+.h.c","libobs/graphics/graphics-active-shader-queries.c.h","libobs/graphics/graphics.c.h","libobs/obs-context-runtime.c.h","libobs/obs-encoder-weak-refs.c.h","libobs/obs-encoder.c.h","libobs/obs-source-weak-refs.c.h","libobs/obs-source.c.h","libobs/obs.c.h","rust/obs-build/src/platform/mod.rs","rust/obs-build/src/validation/graph.rs","rust/obs-build/src/validation/graph/rust_static_support.rs","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_rust_static_header_steps_are_registered.rs","rust/obs-build/tests/native/registration/rust-static/support/video-info-query.json","rust/obs-build/tests/native/registration/shared_rust_static_support.rs","rust/obs-c-oracle/build.rs","test/cmocka/base-blog-link-support.c","test/cmocka/base-blogva-link-support.c","test/cmocka/base-crash-link-support.c","test/cmocka/base-variadic-link-support.c","test/cmocka/build/rust-static-support.json","test/cmocka/build/test-graph.json","test/cmocka/cf-preprocessor-link-support.c","test/cmocka/context-runtime-link-support.c","test/cmocka/core-initialized-link-support.c","test/cmocka/dstr-variadic-link-support.c","test/cmocka/effect-parser-funcs-link-support.c","test/cmocka/encoder-weak-refs-link-support.c","test/cmocka/graphics-image-convert-link-support.c","test/cmocka/graphics-image-deps-link-support.c","test/cmocka/graphics-image-max-size-link-support.c","test/cmocka/graphics-preprocessor-link-support.c","test/cmocka/graphics-runtime-link-support.c","test/cmocka/graphics-texture-file-data-link-support.c","test/cmocka/hosts/posix/graphics-image-fallback-link-support.c","test/cmocka/hosts/windows/graphics-image-fallback-link-support.c","test/cmocka/hotkey-fields-link-support.c","test/cmocka/native-test-graph.cmake","test/cmocka/profiler-variadic-link-support.c","test/cmocka/rust-static-link-support.cmake","test/cmocka/service-runtime-link-support.c","test/cmocka/service-state-link-support.c","test/cmocka/source-weak-control-link-support.c","test/cmocka/source-weak-refs-link-support.c","test/cmocka/test_dock_state_restart.cpp","test/cmocka/test_graphics_active_shader_queries.c","test/cmocka/tests.d/test_graphics_active_shader_queries.cmake","test/cmocka/tests.d/video_info_query_link_support.cmake","test/cmocka/texture-creators-fields-link-support.c"],"head":"cb82b940261f1be9b6fee3d887bac9095fd667d8","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"994bd0305a7ed63aeed3735e16925958c132af789db4612f972828fd61ef0aa0","tree":"454a8e557be0a0d4e1750ab1aee7cb0785741c30"}} --- libobs/obs-encoder-weak-refs.c.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libobs/obs-encoder-weak-refs.c.h b/libobs/obs-encoder-weak-refs.c.h index e1ae9bcbec..bb4380b91a 100644 --- a/libobs/obs-encoder-weak-refs.c.h +++ b/libobs/obs-encoder-weak-refs.c.h @@ -29,5 +29,4 @@ obs_weak_encoder_t *obs_encoder_get_weak_encoder(obs_encoder_t *encoder) return weak; } - #undef get_weak From 6d87dd355655d0b5510d996ae7176d033e0e975f Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 09:07:08 -0800 Subject: [PATCH 25/30] build: share newly merged output and indexbuffer adapters (Refs #5219) --- .../support/zz-output-starting-queries.json | 322 ------------------ test/cmocka/build/rust-static-support.json | 4 +- test/cmocka/build/test-graph.json | 186 ++++------ ...output_starting_queries_link_support.cmake | 21 -- 4 files changed, 65 insertions(+), 468 deletions(-) delete mode 100644 rust/obs-build/tests/native/registration/rust-static/support/zz-output-starting-queries.json delete mode 100644 test/cmocka/tests.d/output_starting_queries_link_support.cmake diff --git a/rust/obs-build/tests/native/registration/rust-static/support/zz-output-starting-queries.json b/rust/obs-build/tests/native/registration/rust-static/support/zz-output-starting-queries.json deleted file mode 100644 index e8c6df0455..0000000000 --- a/rust/obs-build/tests/native/registration/rust-static/support/zz-output-starting-queries.json +++ /dev/null @@ -1,322 +0,0 @@ -{ - "test_async_conversion_plan_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_async_frame_pacing_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_async_upload_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_audio_monitor_delay_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_coreaudio_device_rules_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_coreaudio_pacing_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_deinterlace_draw_plan_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_deinterlace_pacing_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_deinterlace_select_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_effect_param_types_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_effect_parser_blocks_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_effect_parser_compile_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_effect_parser_lifecycle_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_effect_parser_params_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_effect_parser_passes_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_effect_parser_shader_call_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_encoder_video_tex_active_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_graphics_ffmpeg_pq_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_graphics_ffmpeg_route_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_graphics_ffmpeg_wic_checks_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_graphics_immediate_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_graphics_state_stacks_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_monitor_speaker_layout_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_monitor_video_sync_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_monitor_wasapi_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_nsgif_decode_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_pulse_monitor_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_scene_audio_window_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_scene_bounds_place_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_scene_item_crop_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_scene_item_names_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_scene_item_order_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_scene_item_transform_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_scene_render_plan_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_scene_transform_update_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_service_handler_getters_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_audio_input_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_audio_place_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_audio_render_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_audio_timing_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_color_space_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_draw_plan_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_duplicate_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_filter_chain_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_frame_copy_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_init_context_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_media_admission_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_monitoring_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_ptm_gate_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_render_route_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_size_route_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_video_tick_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_source_volume_apply_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_sprite_geometry_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_transition_clock_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_transition_load_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_transition_render_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_transition_sample_time_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_transition_start_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_video_info_query_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_video_stop_requested_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_video_unmap_last_surface_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_window_match_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - }, - "test_windows_keys_steps_rust": { - "sources": [ - "test/cmocka/output-starting-queries-link-support.c" - ] - } -} diff --git a/test/cmocka/build/rust-static-support.json b/test/cmocka/build/rust-static-support.json index c3fccbd512..e0c9efb6ab 100644 --- a/test/cmocka/build/rust-static-support.json +++ b/test/cmocka/build/rust-static-support.json @@ -28,7 +28,9 @@ "test/cmocka/effect-parser-funcs-link-support.c", "test/cmocka/texture-creators-fields-link-support.c", "test/cmocka/graphics-image-convert-link-support.c", - "test/cmocka/graphics-preprocessor-link-support.c" + "test/cmocka/graphics-preprocessor-link-support.c", + "test/cmocka/output-starting-queries-link-support.c", + "test/cmocka/graphics-indexbuffer-maintenance-link-support.c" ], "platform_sources": { "OS_WINDOWS": [ diff --git a/test/cmocka/build/test-graph.json b/test/cmocka/build/test-graph.json index 3e4a222117..c635d239b9 100644 --- a/test/cmocka/build/test-graph.json +++ b/test/cmocka/build/test-graph.json @@ -307,8 +307,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -429,8 +428,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -539,8 +537,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -747,8 +744,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": { "all": [ @@ -1668,8 +1664,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": { "all": [ @@ -1762,8 +1757,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": { "all": [ @@ -2032,8 +2026,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -2128,8 +2121,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -2201,8 +2193,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -2710,8 +2701,7 @@ "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/object-validity-query-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -2796,8 +2786,7 @@ }, "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -2882,8 +2871,7 @@ "libobs/graphics/graphics-linear-srgb-fields.c.h", "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -3006,8 +2994,7 @@ "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/object-validity-query-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -3074,8 +3061,7 @@ }, "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -3158,8 +3144,7 @@ }, "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -3246,8 +3231,7 @@ }, "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -4154,8 +4138,7 @@ "test_encoder_video_tex_active_rust": { "sources": [ "test/cmocka/test_encoder_video_tex_active.c", - "test/cmocka/encoder-video-tex-active-fields-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/encoder-video-tex-active-fields-link-support.c" ], "definitions": [ "get_mix_for_video=tex_active_recording_mix_lookup", @@ -5085,8 +5068,7 @@ "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/object-validity-query-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -5171,8 +5153,7 @@ "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/object-validity-query-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -5232,8 +5213,7 @@ "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/object-validity-query-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -5331,8 +5311,7 @@ "libobs/graphics/graphics-linear-srgb-fields.c.h", "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -5510,8 +5489,7 @@ "libobs/graphics/graphics-linear-srgb-fields.c.h", "libobs/build/libobs.image-decode-adapter+.h.c", "libobs/obs-graphics-effect-file-fields.c.h", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -8866,8 +8844,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": { "all": [ @@ -8926,8 +8903,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": { "all": [ @@ -8987,8 +8963,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": { "all": [ @@ -9319,8 +9294,7 @@ "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/object-validity-query-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -12833,8 +12807,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": { "all": [ @@ -14096,8 +14069,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -14196,8 +14168,7 @@ "test/cmocka/scene-item-visible-link-support.c", "test/cmocka/scene-source-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "libraries": [ @@ -14540,8 +14511,7 @@ "test/cmocka/scene-item-visible-link-support.c", "test/cmocka/scene-source-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "includes": [ "libobs", @@ -14655,8 +14625,7 @@ "test/cmocka/scene-item-visible-link-support.c", "test/cmocka/scene-source-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "libraries": [ @@ -14714,8 +14683,7 @@ "test/cmocka/scene-item-visible-link-support.c", "test/cmocka/scene-source-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "libraries": [ @@ -14871,8 +14839,7 @@ "test/cmocka/scene-item-visible-link-support.c", "test/cmocka/scene-source-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "libraries": [ @@ -15015,8 +14982,7 @@ "test/cmocka/source-handler-getter-link-support.c", "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "includes": [ "libobs", @@ -15150,8 +15116,7 @@ "test/cmocka/scene-item-visible-link-support.c", "test/cmocka/scene-source-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -16099,8 +16064,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -16185,8 +16149,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -16277,8 +16240,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -16382,8 +16344,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -16499,8 +16460,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -16656,8 +16616,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -16722,8 +16681,7 @@ "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -16798,8 +16756,7 @@ "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -16885,8 +16842,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -17009,8 +16965,7 @@ "test/cmocka/source-identity-getter-link-stubs.c", "test/cmocka/source-push-query-link-stubs.c", "test/cmocka/source-state-getter-link-stubs.c", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "header_libraries": [ "OBS::source-init-context-rust-headers", @@ -17143,8 +17098,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -17269,8 +17223,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -17432,8 +17385,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -17546,8 +17498,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -17643,8 +17594,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -18020,8 +17970,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -18096,8 +18045,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -18238,8 +18186,7 @@ "libobs/graphics/graphics-linear-srgb-fields.c.h", "libobs/obs-graphics-effect-file-fields.c.h", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -18816,8 +18763,7 @@ "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -18919,8 +18865,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -19036,8 +18981,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ @@ -19113,8 +19057,7 @@ "test/cmocka/source-state-getter-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -19251,8 +19194,7 @@ "test/cmocka/weak-encoder-identity-link-stub.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-icon-type-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-icon-type-link-support.c" ], "includes": [ "libobs", @@ -20196,8 +20138,7 @@ "test/cmocka/test_video_info_query.c", "test/cmocka/video-info-query-link-support.c", "libobs/util/base-variadic.c.h", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "libraries": [ "libobs_rust-static", @@ -20547,8 +20488,7 @@ "test_video_stop_requested_rust": { "sources": [ "test/cmocka/test_video_stop_requested.c", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "compile_options": [ { @@ -21430,8 +21370,7 @@ "test/cmocka/test_window_match_steps.c", "libobs/util/base-variadic.c.h", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "includes": [ ".", @@ -21496,8 +21435,7 @@ "test/cmocka/module-name-lookup-link-stubs.c", "test/cmocka/object-validity-query-link-stubs.c", "test/cmocka/source-update-properties-link-support.c", - "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c" + "libobs/build/libobs.image-decode-adapter+.h.c" ], "watch_inputs": [ "Cargo.toml" diff --git a/test/cmocka/tests.d/output_starting_queries_link_support.cmake b/test/cmocka/tests.d/output_starting_queries_link_support.cmake deleted file mode 100644 index 34446a00e0..0000000000 --- a/test/cmocka/tests.d/output_starting_queries_link_support.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# A Rust archive member can pull this query into unrelated source-step tests. -# Link the real adapter there as well as in production libobs. -function(_output_starting_queries_link_support) - get_directory_property(_targets BUILDSYSTEM_TARGETS) - foreach(_target IN LISTS _targets) - get_target_property(_links ${_target} LINK_LIBRARIES) - if("libobs_rust-static" IN_LIST _links AND NOT _target STREQUAL "test_output_starting_queries_rust") - get_target_property(_sources ${_target} SOURCES) - set(_adapter "${CMAKE_CURRENT_SOURCE_DIR}/output-starting-queries-link-support.c") - if(NOT _adapter IN_LIST _sources) - target_sources(${_target} PRIVATE "${_adapter}") - target_include_directories(${_target} PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/libobs") - target_link_libraries( - ${_target} - PRIVATE OBS::caption Uthash::Uthash $<$:OBS::w32-pthreads> - ) - endif() - endif() - endforeach() -endfunction() -cmake_language(DEFER CALL _output_starting_queries_link_support) From 95a66b29af701fda3955e8322c0316713eb8b42d Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 09:08:30 -0800 Subject: [PATCH 26/30] test(build): expect shared output support in private fixture metadata (Refs #5219) --- .../cases/private-link-rules/test_graphics_state_stacks.json | 3 +-- .../cases/private-link-rules/test_window_match_steps.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_graphics_state_stacks.json b/rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_graphics_state_stacks.json index ee9f033fe3..31414d058c 100644 --- a/rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_graphics_state_stacks.json +++ b/rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_graphics_state_stacks.json @@ -9,8 +9,7 @@ "libobs/graphics/graphics-linear-srgb-fields.c.h", "libobs/build/libobs.image-decode-adapter+.h.c", "libobs/obs-graphics-effect-file-fields.c.h", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "requires": "HAVE_LIBOBS_RUST_STATIC", "includes": [ diff --git a/rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_window_match_steps.json b/rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_window_match_steps.json index 1240a9741a..9e3cad8559 100644 --- a/rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_window_match_steps.json +++ b/rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_window_match_steps.json @@ -6,8 +6,7 @@ "test/cmocka/test_window_match_steps.c", "libobs/util/base-variadic.c.h", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "includes": [ ".", From 4585cde86da6f583b6e21f6e5a8ff3e9ef539fb7 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 09:42:58 -0800 Subject: [PATCH 27/30] test(ci): expect shared output adapter in portability inventory (Refs #5219) Ci-Attestation: {"at":1795111849,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":418,"stamp":"d39acb1af2f4992a066ae596ea54b7ae","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111849,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":418,"stamp":"81ea132311d19786a3d0aec900d27643","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111849,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":418,"stamp":"0f665b0039691d82b9641a2ec54add72","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111849,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":418,"stamp":"c8364ff8ee1551e120fa8d3b21c2a8b8","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111428,"gate":"general/all/client-lint","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"6aad51674836671707c69a10d26583be","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111849,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":418,"stamp":"4791d96a946076d6a4232ecf3e456c21","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111429,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"047cad6bdb8b26b557b1ebd16aef23aa","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111429,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"a7b1ff55876b1378970e490f0645e2a1","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111429,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"2c8672345605ea13a277af36bc23e4de","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111429,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"6797e753d4ae52df42a647963d7fb81c","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111428,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"67b709960b659d6394fe794668ca61df","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111428,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"746d725c08757dccaa9abc6e1359b34b","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111429,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"5934e2fc7182f67eb00adb94661c016c","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111429,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"774c2ebe7eec268918aa47cde0898848","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111428,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"7ad737b369a804673bf7b0d15a6d419c","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111428,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"d07dcaaff0ab255401fb873acae40c4a","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111428,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"4b9da9088bec92f0ecb0e0a3598b4c08","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795111428,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"0d805b5f60d5e9ecb3e9886ca3716b0b300fedcf9d6d25847f3a084230ba7235","lane":"client-lint","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":728,"stamp":"38a36bfc40c14fb7f7fb6d9c7dc21159","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Ci-Attestation: {"at":1795113520,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"1fe080f3efefaa3ee222a20046d3761bb051275b36966a3820b92abf6e132f3b","lane":"client-test-x86_64-unknown-linux-gnu","parents":["7373f4064dbe9b6ec22a07b80c9cb6d6c0ed7753"],"secs":1668,"stamp":"5f54eb439547c186c4d0b1ae49cb499f","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec","v":1,"via":"run"} Client-Checks: {"checks":{"base":"e17df596c7e2b06effae8951226239a75beac024","coverage":"all-tracked-applicable-files","diff":["ci/cmocka_link_check.py","ci/test_cmocka_link_check.py","ci/test_native_b2_portability.py","ci/test_rust_static_link_support.py","ci/test_tier2_runtime_delta.py","cmake/cross/CMakeLists.txt","cmake/cross/tier2.cmake","cmake/finders/FindGio.cmake","docs/ci-tooling.md","libobs/CMakeLists.txt","libobs/build/libobs.core+.h.c","libobs/build/libobs.core-output+.h.c","libobs/build/libobs.core-source+.h.c","libobs/obs-context-runtime.c.h","libobs/obs-encoder-weak-refs.c.h","libobs/obs-encoder.c.h","libobs/obs-source-weak-refs.c.h","libobs/obs-source.c.h","libobs/obs.c.h","rust/obs-build/src/platform/mod.rs","rust/obs-build/src/validation/graph.rs","rust/obs-build/src/validation/graph/rust_static_support.rs","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_rust_static_header_steps_are_registered.rs","rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_graphics_state_stacks.json","rust/obs-build/tests/native/registration/rust-static/cases/private-link-rules/test_window_match_steps.json","rust/obs-build/tests/native/registration/rust-static/support/video-info-query.json","rust/obs-build/tests/native/registration/rust-static/support/zz-output-starting-queries.json","rust/obs-build/tests/native/registration/shared_rust_static_support.rs","rust/obs-c-oracle/build.rs","rust/tools/linux-validate/ci-runtime.py","test/cmocka/base-blog-link-support.c","test/cmocka/base-blogva-link-support.c","test/cmocka/base-crash-link-support.c","test/cmocka/base-variadic-link-support.c","test/cmocka/build/rust-static-support.json","test/cmocka/build/test-graph.json","test/cmocka/cf-preprocessor-link-support.c","test/cmocka/context-runtime-link-support.c","test/cmocka/core-initialized-link-support.c","test/cmocka/dstr-variadic-link-support.c","test/cmocka/effect-parser-funcs-link-support.c","test/cmocka/encoder-weak-refs-link-support.c","test/cmocka/graphics-image-convert-link-support.c","test/cmocka/graphics-image-deps-link-support.c","test/cmocka/graphics-image-max-size-link-support.c","test/cmocka/graphics-preprocessor-link-support.c","test/cmocka/graphics-runtime-link-support.c","test/cmocka/graphics-texture-file-data-link-support.c","test/cmocka/hosts/posix/graphics-image-fallback-link-support.c","test/cmocka/hosts/windows/graphics-image-fallback-link-support.c","test/cmocka/hotkey-fields-link-support.c","test/cmocka/native-test-graph.cmake","test/cmocka/profiler-variadic-link-support.c","test/cmocka/rust-static-link-support.cmake","test/cmocka/service-runtime-link-support.c","test/cmocka/service-state-link-support.c","test/cmocka/source-weak-control-link-support.c","test/cmocka/source-weak-refs-link-support.c","test/cmocka/tests.d/output_starting_queries_link_support.cmake","test/cmocka/tests.d/video_info_query_link_support.cmake","test/cmocka/texture-creators-fields-link-support.c"],"head":"85ba564711d93004350fc414d2a1f547f051a847","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"e98e01ae73ef78c67d05c0337c85e9040137c7cd31a670611f0c322c5b214bf6","tree":"f43b207fa414c9c3dadcbdd778c11ed5948628ec"}} --- ci/test_native_b2_portability.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/test_native_b2_portability.py b/ci/test_native_b2_portability.py index 453e9b2b8a..b7ca7ea5e3 100644 --- a/ci/test_native_b2_portability.py +++ b/ci/test_native_b2_portability.py @@ -222,6 +222,8 @@ def test_scene_archive_consumers_supply_getter_logging(self): # pulled by these pure rule tests (#3891, Windows LNK2019). graph = json.loads((ROOT / "test/cmocka/build/test-graph.json").read_text()) stub = "test/cmocka/scene-getter-log-link-stub.c" + support = json.loads((ROOT / "test/cmocka/build/rust-static-support.json").read_text()) + self.assertIn("test/cmocka/output-starting-queries-link-support.c", support["sources"]) for name in ("test_scene_audio_window_steps_rust", "test_scene_render_plan_steps_rust"): with self.subTest(name=name): self.assertEqual(graph["targets"][name]["sources"], [ @@ -244,7 +246,6 @@ def test_scene_archive_consumers_supply_getter_logging(self): "test/cmocka/source-update-properties-link-support.c", "test/cmocka/weak-object-identity-link-stub.c", "libobs/build/libobs.image-decode-adapter+.h.c", - "test/cmocka/output-starting-queries-link-support.c", ]) def test_portal_app_id_getter_uses_live_hotkey_adapters(self): From c1cb214fc91d281cefde0fc5bb82ede74365e67f Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 10:41:24 -0800 Subject: [PATCH 28/30] build: retain adapters from newly merged name and shader swaps (Refs #5219) --- test/cmocka/build/rust-static-support.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/cmocka/build/rust-static-support.json b/test/cmocka/build/rust-static-support.json index e0c9efb6ab..07f095883e 100644 --- a/test/cmocka/build/rust-static-support.json +++ b/test/cmocka/build/rust-static-support.json @@ -30,7 +30,10 @@ "test/cmocka/graphics-image-convert-link-support.c", "test/cmocka/graphics-preprocessor-link-support.c", "test/cmocka/output-starting-queries-link-support.c", - "test/cmocka/graphics-indexbuffer-maintenance-link-support.c" + "test/cmocka/graphics-indexbuffer-maintenance-link-support.c", + "test/cmocka/encoder-get-name-link-support.c", + "test/cmocka/output-interleave-name-link-support.c", + "test/cmocka/graphics-device-queries-link-support.c" ], "platform_sources": { "OS_WINDOWS": [ From 885ab7f00f34d7d7ef4f12dba5c67284e48453e9 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 13:35:24 -0800 Subject: [PATCH 29/30] build: retain master audio-capture adapter in shared support (Refs #5219) --- test/cmocka/build/rust-static-support.json | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cmocka/build/rust-static-support.json b/test/cmocka/build/rust-static-support.json index 07f095883e..95e07589b5 100644 --- a/test/cmocka/build/rust-static-support.json +++ b/test/cmocka/build/rust-static-support.json @@ -9,6 +9,7 @@ "test/cmocka/core-initialized-link-support.c", "test/cmocka/source-save-load-link-support.c", "test/cmocka/source-settings-getter-link-support.c", + "test/cmocka/source-audio-capture-callback-link-support.c", "test/cmocka/encoder-video-tex-active-fields-link-support.c", "test/cmocka/encoder-video-tex-active-mix-link-support.c", "test/cmocka/hotkey-fields-link-support.c", From 65a5084d1e43afaef5ef92d067f1173d1c244d14 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 13:41:08 -0800 Subject: [PATCH 30/30] build: share the newly merged video-unmap output adapter (Refs #5219) Ci-Attestation: {"at":1795126522,"gate":"general/all/client-lint","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"bb421a55ef2c12833fbb4c32ae210d3f","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126527,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"0bd899d7c1cf1e51b5f9db7481a292f9","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126527,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"45b5ba14cf9393b686b6ebb38355fb67","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126524,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"5d0a31d056455e7ab0ede813b6ab6d75","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126524,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"f8cbe4764682ade32d472170a850492f","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126523,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"7b7d395146d5c57bd825f3df2c2cd9e4","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126524,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"6f2849ba4760f6a9a20a497c245c990d","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126526,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"a967cfb1715fdb2eda66ef5d13961ae8","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126526,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"a446da34485f346985c90dd494d6dd15","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126524,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"9d1e1579e491a8c916d3f6b57a25b67c","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126524,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"7bf8ef88fda0fedff51f378a4845dec7","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126523,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"fcf390ddefc87ddea065ffba879c8129","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} Ci-Attestation: {"at":1795126523,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f9ecdbd821a4f9b48083b8d75ceecc5a0d4cd8195bb9980ecceff2d9fa5dc91f","lane":"client-lint","parents":["885ab7f00f34d7d7ef4f12dba5c67284e48453e9"],"secs":1775,"stamp":"7ea2d954d9f0f758b820f2b3166f85ce","tree":"6c89ea36f5fdc829f5a385cd05488505a2a03d31","v":1,"via":"run"} --- test/cmocka/build/test-graph.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/cmocka/build/test-graph.json b/test/cmocka/build/test-graph.json index c635d239b9..267574eee3 100644 --- a/test/cmocka/build/test-graph.json +++ b/test/cmocka/build/test-graph.json @@ -20553,8 +20553,7 @@ "test_video_unmap_last_surface_rust": { "sources": [ "test/cmocka/test_video_unmap_last_surface.c", - "test/cmocka/source-update-properties-link-support.c", - "test/cmocka/output-starting-queries-link-support.c" + "test/cmocka/source-update-properties-link-support.c" ], "compile_options": [ {