From 6829dd545a37ef4ef133c9b7d941ac034c62c570 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Sun, 6 Sep 2026 22:36:01 -0700 Subject: [PATCH] Stage the plugin into the directory layout OBS actually searches The staged package put the module in build/package/bin. OBS does not look there. From AddExtraModulePaths() in obs-studio's UI/window-basic-main.cpp, the per-user plugin layout on Linux and Windows is: /obs-studio/plugins//bin/64bit/.{so,dll} /obs-studio/plugins//data/ so build/package/ now uses bin/64bit and is a straight drop-in. Re-verified in the headless libobs harness from the new path: the module loads, both sources connect, frames arrive, the camera switch round-trips, and `ldd` on the staged copy resolves liblivekit and liblivekit_ffi from bin/64bit via $ORIGIN. macOS deliberately keeps the flat bin/ -- there OBS looks for a .plugin/Contents/MacOS bundle, which this build does not produce. That gap is documented in README.md rather than papered over with a directory name that would only look right. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01RL8abRmgFXkVASHkkqiJbE --- .gitea/workflows/build.yml | 10 +++++----- README.md | 19 ++++++++++++++----- obs-adapter/CMakeLists.txt | 23 ++++++++++++++++++++--- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index c20c893..54b784c 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -45,9 +45,9 @@ jobs: - name: Show what was built run: | - ls -la build/package/bin build/package/data/locale build/package/licenses - ldd build/package/bin/streamer-tools-camera.so | grep -E 'obs|livekit' - nm -D build/package/bin/streamer-tools-camera.so | grep -E ' T obs_module_(load|unload)' + ls -la build/package/bin/64bit build/package/data/locale build/package/licenses + ldd build/package/bin/64bit/streamer-tools-camera.so | grep -E 'obs|livekit' + nm -D build/package/bin/64bit/streamer-tools-camera.so | grep -E ' T obs_module_(load|unload)' - name: Upload plugin continue-on-error: true @@ -141,8 +141,8 @@ jobs: - name: Show what was built run: | - if (Test-Path build\package\bin) { - Get-ChildItem build\package\bin + if (Test-Path build\package\bin\64bit) { + Get-ChildItem build\package\bin\64bit } else { Write-Host "no plugin module was built (core library only)" } diff --git a/README.md b/README.md index 1eeb252..3526ee5 100644 --- a/README.md +++ b/README.md @@ -109,15 +109,20 @@ and `-DSTPLUGIN_LIVEKIT_SDK_TRIPLE` override the pin and the release triple. The build stages a runnable layout into `build/package/`: ``` -build/package/bin/streamer-tools-camera.so (RPATH=$ORIGIN) -build/package/bin/liblivekit.so -build/package/bin/liblivekit_ffi.so +build/package/bin/64bit/streamer-tools-camera.so (RPATH=$ORIGIN) +build/package/bin/64bit/liblivekit.so +build/package/bin/64bit/liblivekit_ffi.so build/package/data/locale/en-US.ini build/package/licenses/... ``` -`build/package/bin` is what gets installed — the module resolves the LiveKit -libraries from `$ORIGIN` / `@loader_path`, not from the build tree. +That is exactly the layout OBS searches on Linux and Windows — +`/obs-studio/plugins//bin/64bit` plus a sibling `data/`, per +`AddExtraModulePaths()` in obs-studio's `UI/window-basic-main.cpp` — so +`build/package/` is a straight drop-in. The module resolves the LiveKit +libraries from `$ORIGIN` (verified: `ldd` on the staged copy resolves both +to `bin/64bit/`), not from the build tree. macOS is not this shape; see the +macOS packaging gap under CI. ## Testing this by hand @@ -131,6 +136,10 @@ cp -r build/package/bin build/package/data \ obs ``` +(That yields `.../streamer-tools-camera/bin/64bit/streamer-tools-camera.so` +and `.../streamer-tools-camera/data/locale/en-US.ini`, which is what OBS +looks for.) + Then: Sources → `+` → "streamer-tools Camera" → fill in the server URL, room slug and read key from the room's settings page → "Refresh camera list" → pick a camera. Check `~/.config/obs-studio/logs/` for diff --git a/obs-adapter/CMakeLists.txt b/obs-adapter/CMakeLists.txt index 22046b9..53590af 100644 --- a/obs-adapter/CMakeLists.txt +++ b/obs-adapter/CMakeLists.txt @@ -61,10 +61,27 @@ endif() # via the build-tree RPATH. set(STPLUGIN_PACKAGE_DIR "${CMAKE_BINARY_DIR}/package") +# The binary subdirectory matches what OBS actually searches. From +# AddExtraModulePaths() in obs-studio's UI/window-basic-main.cpp, the +# per-user plugin layout on Linux and Windows is +# /obs-studio/plugins//bin/64bit/.{so,dll} +# /obs-studio/plugins//data/ +# so staging into bin/64bit makes build/package/ a straight drop-in. +# +# macOS is NOT this shape -- there OBS looks for a +# .plugin/Contents/MacOS bundle -- and this build does not produce one. +# See the macOS packaging gap in README.md; the flat bin/ here is honest +# about being unfinished rather than pretending to be installable. +if(APPLE) + set(STPLUGIN_PACKAGE_BIN_DIR "${STPLUGIN_PACKAGE_DIR}/bin") +else() + set(STPLUGIN_PACKAGE_BIN_DIR "${STPLUGIN_PACKAGE_DIR}/bin/64bit") +endif() + add_custom_command(TARGET ${STPLUGIN_PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory "${STPLUGIN_PACKAGE_DIR}/bin" - COMMAND ${CMAKE_COMMAND} -E copy "$" "${STPLUGIN_PACKAGE_DIR}/bin/" - COMMAND ${CMAKE_COMMAND} -E copy ${LIVEKIT_SDK_RUNTIME_LIBS} "${STPLUGIN_PACKAGE_DIR}/bin/" + COMMAND ${CMAKE_COMMAND} -E make_directory "${STPLUGIN_PACKAGE_BIN_DIR}" + COMMAND ${CMAKE_COMMAND} -E copy "$" "${STPLUGIN_PACKAGE_BIN_DIR}/" + COMMAND ${CMAKE_COMMAND} -E copy ${LIVEKIT_SDK_RUNTIME_LIBS} "${STPLUGIN_PACKAGE_BIN_DIR}/" COMMAND ${CMAKE_COMMAND} -E make_directory "${STPLUGIN_PACKAGE_DIR}/data/locale" COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/data/locale/en-US.ini"