Repository navigation
build(libobs): per-unit compile options and headers in ported-source-sets (#3236) - #3293
Merged
Merged
Conversation
…3236) (RED) ci/test_port_unit_metadata.py fails on master: libobs/CMakeLists.txt, os-windows.cmake and os-macos.cmake name ported groups in per-group set_property blocks, os-linux/os-freebsd list ported headers with 'have Rust ports' comments, and unit files have no compile_options or headers fields that sources.cmake applies. Refs #3236, #3232
…sets (#3236) A port now edits only libobs/build/ported-source-sets/<unit>.json. Optional fields beside the set keys: - compile_options {gnu, msvc}: appended to each of the unit's groups - headers: listed on libobs-objects wherever the unit's set is built cmake/sources.cmake applies them; libobs_add_ported_sources(<SET>) replaces the per-set obs_libobs_add_c_sources calls and comments in os-linux/os-freebsd. obs-build and ported_sources.py skip the fields. Migrated: drift -ffp-contract=off, audio-controls /wd4056 /wd4756, nsgif conversion pins (gnu + msvc from os-windows), ported-data deprecation pins, ported-macos-cocoa -fobjc-arc, the pulse stream-flags/monitor-format/monitor-steps and nix-hotkey-state units (new unit files with their headers) and nix-wayland-keys's header. ci/test_ported_sources.py derives its every-host objects from LIBOBS_PORTED_SOURCES (set + units) and checks that no ported implementation file is in a production group. Refs #3236, #3232
zackees
commented
Oct 31, 2026
zackees
left a comment
Member
Author
There was a problem hiding this comment.
Coordinator review: I checked that the move loses nothing. Every per-unit option removed from libobs/CMakeLists.txt and cmake/os-*.cmake reappears in its unit's JSON:
- audio-controls:
/wd4056 /wd4756 - audio-resampler-drift:
-ffp-contract=off - data:
-Wno-deprecated-declarationsand/wd4996 - macos-cocoa:
-fobjc-arc - nsgif:
-Wno-conversion -Wno-sign-conversionand/wd4244 /wd4267
The removed header listings moved to headers. pulseaudio-wrapper.h stays in os-linux.cmake/os-freebsd.cmake, as before.
One small widening: the old blocks used COMPILE_LANG_AND_ID:C,..., and gnu is now C_COMPILER_ID, which also matches Objective-C TUs. For these units that changes nothing, since the C-only units have no .m. If a future unit mixes C and Objective-C, -ffp-contract=off and the like would reach the .m files too, so it's worth a sentence in BUILD.md's schema note. No blocking findings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #3236, #3232
A libobs port now edits only its own
libobs/build/ported-source-sets/<unit>.json, and no longer toucheslibobs/CMakeLists.txtorcmake/os-*.cmake.Schema (BUILD.md)
{ "LIBOBS_<...>PORTED_SOURCES": ["build/libobs.ported-<unit>+.h.c"], "compile_options": {"gnu": ["..."], "msvc": ["..."]}, "headers": ["<unit>.h"] }compile_options: added to each of the unit's groups, one list per compiler family.gnumeansC_COMPILER_IDGNU, Clang or AppleClang, which covers C and Objective-C.msvcmeans MSVC. They are source properties oflibobs/, the same as the old blocks.headers: listed onlibobs-objectswherever one of the unit's sets is built.libobs_add_ported_sources(<SET>)insources.cmakereplaces theobs_libobs_add_c_sources(${SET})call and the "have Rust ports" comment for each set in os-linux and os-freebsd. Those files keep one line per optional set, and a port no longer edits them.rust/tools/ported_sources.pyskip the new fields. obs-build never applied per-source flags (the C oracle sets its own), so its behavior is the same as before.Migrated
-ffp-contract=off, moved from CMakeLists/wd4056 /wd4756, moved from CMakeLists-Wno-conversion -Wno-sign-conversionfrom CMakeLists, msvc/wd4244 /wd4267from os-windows-Wno-deprecated-declarationsand/wd4996from CMakeLists-fobjc-arcfrom os-macos (the unported cocoa group keeps its line there)LIBOBS_PULSE_PORTED_SOURCESandLIBOBS_WAYLAND_PORTED_SOURCESare now emptyStill central, on purpose
/wd4702uthash pin, the-Wconversionratchet and host definitions.OBS_PUBLIC_HEADERSinstall list.libobs_add_ported_sourcesline per optional set (PULSE, NIX_GIO, WAYLAND, WAYLAND_GIO). These are per set, not per port.Tests
ci/test_port_unit_metadata.pyfails with 5 failures and 1 error. CMakeLists, os-windows and os-macos name ported groups; os-linux and os-freebsd list ported headers and comments; the unit fields are missing; sources.cmake does not apply them.test_ported_sources,test_sorted_shared_lists,test_libobs_source_set_fragments,test_conversion_measure,test_tier2_wayland_lane,test_build_groupsandtest_ci_scope(94 tests)../lintis OK.test_ported_sourcesno longer uses the hand-writtenPORTED_ON_EVERY_HOSTlist. It derives the objects fromLIBOBS_PORTED_SOURCES(set file plus units) with a floor of 90. A new test,test_no_ported_c_links_into_production, checks that no ported implementation file is a member of a production group on any host.soldr cargo test -p obs-build --lib: 4 passed. That includes the newunit_fields_are_skipped_and_members_kept. Test cost: under 1 ms, no threads.rust/tools/linux-validate/run.pyin Docker withOBS_BUILD_C_REFERENCE=ON, Pulse and Wayland on. Configure and build succeeded.ninja -t commands libobs-c-referenceshows:-ffp-contract=offonlibobs.ported-audio-resampler-drift+.h.c(... -Werror -ffp-contract=off -MD ...)-Wno-conversion -Wno-sign-conversionon nsgif-gif-Wno-deprecated-declarationson ported-dataThe MSVC and macOS results come from PR CI and the cross lanes; I have not run them locally.