Fix assertions that NDEBUG deleted, and match OBS's real macOS SDK regex
Build / macOS (macos-latest) (push) Failing after 18s
Build / Linux (ubuntu-24.04) (push) Successful in 54s
Build / Windows (windows-latest) (push) Failing after 8m11s

test_core.cpp used bare assert(). CI builds Release, Release defines NDEBUG,
and NDEBUG compiles assert() out entirely -- so that suite had been passing
unconditionally, checking nothing. It now uses the same always-live ST_ASSERT
harness as the other suites and reports a count (10 checks), and additionally
asserts that core_version() really is the version CMake injected rather than a
stale literal.

macOS SDK, third iteration. The previous fix assumed OBS only wanted a
version-carrying SDK filename. Reading OBS 30.0.2's
cmake/macos/compilerconfig.cmake shows the actual pattern is stricter:

  ".+/MacOSX.platform/Developer/SDKs/MacOSX([0-9]+\.[0-9])+\.sdk$"

which only ever matches a full-Xcode SDK path. A Command-Line-Tools-only
install keeps its SDK at /Library/Developer/CommandLineTools/SDKs/MacOSX<ver>.sdk,
with no MacOSX.platform/Developer/SDKs segment at all, so it can never match
however it is named -- which is why the second attempt got past the
"REGEX needs at least 5 arguments" error and still landed on "Your macOS SDK
version () is too low", with the version still empty.

_resolve_versioned_macos_sdk now builds a symlink tree under .deps/ whose
shape matches that pattern and which points at exactly the same SDK, and uses
the toolchain's own path untouched when it already matches (i.e. when real
Xcode is installed). Nothing about the compilation changes -- only the
spelling of the path, which is all OBS's check reads.

Also refreshes the scaffold-era comments in core.h and core_c.h, which still
described this library as a placeholder that would one day talk to
livekit-ffi.

Linux CI is green on the previous commit: real libobs adapter linked
(ldd shows libobs.so.0 plus liblivekit/liblivekit_ffi resolving from the
staged package directory), obs_module_load exported, ctest 6/6, artifact
uploaded.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RL8abRmgFXkVASHkkqiJbE
This commit is contained in:
2026-09-06 22:13:28 -07:00
co-authored by Claude Sonnet 5
parent 0fbcb7c2f4
commit 6b12859887
5 changed files with 80 additions and 85 deletions
+28 -29
View File
@@ -68,24 +68,29 @@ function(_check_deps_version version)
return(PROPAGATE found CMAKE_PREFIX_PATH)
endfunction()
# _resolve_versioned_macos_sdk: return an SDK path whose *filename* carries the
# version number, e.g. .../MacOSX15.5.sdk.
# _resolve_versioned_macos_sdk: return an SDK path that satisfies OBS's own
# macOS SDK version check.
#
# Not upstream. OBS's own cmake/macos/compilerconfig.cmake reads the SDK
# version by regex-matching "MacOSX<major>.<minor>.sdk" out of
# CMAKE_OSX_SYSROOT, and hard-fails if that does not match:
# Not upstream. OBS 30.0.2's cmake/macos/compilerconfig.cmake reads the SDK
# version straight out of CMAKE_OSX_SYSROOT with this regex:
#
# string sub-command REGEX, mode MATCH needs at least 5 arguments
# Your macOS SDK version () is too low.
# ".+/MacOSX.platform/Developer/SDKs/MacOSX([0-9]+\\.[0-9])+\\.sdk$"
#
# With upstream's Xcode generator CMAKE_OSX_SYSROOT stays the literal string
# "macosx" and Xcode resolves it late, so the regex never runs against a real
# path. With Ninja -- which this project uses because CI has no Xcode -- CMake
# resolves it eagerly to whatever `xcrun --show-sdk-path` returns, and on a
# Command-Line-Tools-only install that is the UNVERSIONED symlink
# /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk. Hence this: prefer a
# versioned sibling if the toolchain ships one, and otherwise synthesise a
# correctly-named symlink to the same SDK.
# and hard-fails if it does not match ("Your macOS SDK version () is too low",
# with an empty version, which is the tell). That pattern only ever matches a
# full-Xcode SDK path; a Command-Line-Tools-only install has its SDK at
# /Library/Developer/CommandLineTools/SDKs/MacOSX<ver>.sdk, with no
# MacOSX.platform/Developer/SDKs segment at all, and can never match.
#
# Upstream never hits this because it uses the Xcode generator, where
# CMAKE_OSX_SYSROOT stays the literal string "macosx" and Xcode resolves it
# late. This project uses Ninja (the CI runner has no xcodebuild), so CMake
# resolves the sysroot eagerly and the regex runs against a real path.
#
# So: if the toolchain's own SDK path already matches, use it untouched.
# Otherwise build a symlink tree under .deps/ whose shape matches the regex
# and which points at exactly the same SDK. Nothing about the compilation
# changes -- only the spelling of the path, which is all the check reads.
function(_resolve_versioned_macos_sdk out_path)
set(${out_path} "" PARENT_SCOPE)
@@ -97,12 +102,11 @@ function(_resolve_versioned_macos_sdk out_path)
ERROR_QUIET
)
if(NOT _rc EQUAL 0 OR NOT _sdk)
message(WARNING "Could not determine the macOS SDK path via xcrun; leaving CMAKE_OSX_SYSROOT alone.")
return()
endif()
# Already versioned: nothing to do.
get_filename_component(_sdk_name "${_sdk}" NAME)
if(_sdk_name MATCHES "^MacOSX[0-9]+\\.[0-9]+\\.sdk$")
if(_sdk MATCHES "/MacOSX\\.platform/Developer/SDKs/MacOSX[0-9]+\\.[0-9]+\\.sdk$")
set(${out_path} "${_sdk}" PARENT_SCOPE)
return()
endif()
@@ -115,27 +119,22 @@ function(_resolve_versioned_macos_sdk out_path)
ERROR_QUIET
)
if(NOT _rc EQUAL 0 OR NOT _sdk_version MATCHES "^([0-9]+)\\.([0-9]+)")
message(WARNING "Could not determine the macOS SDK version via xcrun (got '${_sdk_version}').")
return()
endif()
set(_short "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
# A versioned sibling next to the symlink is the common layout.
get_filename_component(_sdk_dir "${_sdk}" DIRECTORY)
if(EXISTS "${_sdk_dir}/MacOSX${_short}.sdk")
set(${out_path} "${_sdk_dir}/MacOSX${_short}.sdk" PARENT_SCOPE)
return()
endif()
# Otherwise make one, inside our own dependency directory.
set(_link_dir "${dependencies_dir}/sdk")
file(MAKE_DIRECTORY "${_link_dir}")
set(_link_dir "${dependencies_dir}/sdk/MacOSX.platform/Developer/SDKs")
set(_link "${_link_dir}/MacOSX${_short}.sdk")
file(MAKE_DIRECTORY "${_link_dir}")
if(NOT EXISTS "${_link}")
file(CREATE_LINK "${_sdk}" "${_link}" SYMBOLIC)
endif()
if(EXISTS "${_link}")
message(STATUS "Using synthesised versioned macOS SDK path: ${_link}")
message(STATUS "macOS SDK ${_short} at ${_sdk}; presenting it to OBS as ${_link}")
set(${out_path} "${_link}" PARENT_SCOPE)
else()
message(WARNING "Could not create the versioned macOS SDK symlink at ${_link}.")
endif()
endfunction()