Skip to content

build(cmake): keep cmake/common host-neutral, move OS logic to cmake/<os> (#3234) - #3269

Merged
zackees merged 2 commits into
masterfrom
build/3234-cmake-common-os-split
Oct 31, 2026
Merged

zackees merged 2 commits into
masterfrom
build/3234-cmake-common-os-split

Conversation

@zackees

@zackees zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member

Refs #3234, #3232

Platform-only CMake edits no longer have to touch cmake/common/, which ci/ci_scope.py treats as shared (it starts the macOS and Windows lanes).

Moves

From cmake/common/ To
buildspec_common.cmake: macOS CEF per-arch slice for universal (#2994, #3016) cmake/macos/buildspec.cmake, as the _obs_dependency_platform_hook macro. Common calls it only if it is defined. The cross lane does not define it (and it fetches no CEF).
helpers_common.cmake: obs_msvc_exempt_c4201 / c4505 bodies (#2626) cmake/windows/helpers.cmake. Common keeps no-op defaults, because shared CMakeLists call these on every host. On other hosts the $<COMPILE_LANG_AND_ID:CXX,MSVC> genex already evaluated to nothing.
helpers_common.cmake: add_core_module ARCHITECTURES check (OS_WINDOWS/OS_MACOS) _obs_architecture_matches. The default (CMAKE_SYSTEM_PROCESSOR) is in common; the Windows (CMAKE_VS_PLATFORM_NAME) and macOS (CMAKE_OSX_ARCHITECTURES / host processor) versions are in their helpers.cmake
helpers_common.cmake: target_export if(OS_WINDOWS) package destination OBS_CMAKE_PACKAGE_FLAT, set in cmake/windows/helpers.cmake
cpackconfig_common.cmake: if(OS_LINUX AND OBS_BRAND_RUST) package name cmake/linux/cpackconfig.cmake

Each OS helpers.cmake includes helpers_common before it redefines anything, so the OS definition always wins.

Tests

  • RED b6b4635: ci/test_cmake_common_os_neutral.py fails with 11 hits (CMAKE_OSX_ARCHITECTURES, MSVC genex, OS_WINDOWS, OS_MACOS, CMAKE_VS_PLATFORM_NAME, OS_LINUX). The allowlist is osconfig.cmake, which defines the OS vars, and soldr.cmake, the cross lane (CROSS_SELF). A test fails if either allowlist entry stops being needed. The test also checks that the moved OS files select only their own OS lane.
  • GREEN 32985b3: the test passes. So do test_ci_scope, test_msvc_warning_level (now pointed at cmake/windows/helpers.cmake), test_cef_pin, test_cef_archive_root and test_deps_download_retry. ./lint passes.
  • Linux configure (cmake --preset ubuntu) on this host gets past helpers, cpackconfig (generated CPACK_PACKAGE_NAME "obs-studio-rust") and the compiler config. It then stops at find_package(ECM), because ECM is not installed on the host; that is unrelated to this change.
  • Tiers 1-4 do not apply (build-system only, no C or Rust code).

Risks

macOS and Windows configure were not run locally. BUILD.md asks for a full ci.yml run for cmake/common/ changes before merge.

@zackees
zackees added this pull request to the merge queue Oct 31, 2026
@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Full ci.yml run (macOS + Windows app builds, required by BUILD.md for cmake/common changes) passed: https://github.com/obs-rust/obs-studio/actions/runs/41238476567

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant