From 4ab64d00d07277fe0c79dca8e5f0491c99b39f82 Mon Sep 17 00:00:00 2001 From: FiniteSingularity Date: Wed, 17 Jun 2026 14:20:07 -0500 Subject: [PATCH] cmake: Change name of core module output directory Moves first-party runtime modules into the "core" directory rather than the "obs-plugins" directory to better differentiate them from legacy plugins as well as existing 3rd-party plugins. This change also requires the existing plugin directory to be explicitly added as a possible module search path by application logic, as libobs's internal logic will not add this path anymore and thus third-party plugins would not be discovered anymore. Co-authored-by: PatTheMav --- cmake/linux/defaults.cmake | 4 +-- cmake/linux/helpers.cmake | 23 ++++++++++------- cmake/windows/defaults.cmake | 4 +-- cmake/windows/helpers.cmake | 16 ++++++------ frontend/updater/init-hook-files.c | 2 +- frontend/updater/updater.cpp | 4 +-- frontend/widgets/OBSBasic.cpp | 25 +++++++++++++++++++ libobs/obs-nix.c | 10 ++++---- libobs/obs-windows.c | 4 +-- plugins/win-capture/game-capture-file-init.c | 2 +- .../virtualcam-module/CMakeLists.txt | 4 +-- .../virtualcam-install.bat.in | 8 +++--- .../virtualcam-uninstall.bat.in | 8 +++--- 13 files changed, 72 insertions(+), 42 deletions(-) diff --git a/cmake/linux/defaults.cmake b/cmake/linux/defaults.cmake index b6a0061ff..5ffe864e6 100644 --- a/cmake/linux/defaults.cmake +++ b/cmake/linux/defaults.cmake @@ -25,13 +25,13 @@ set(OBS_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/rundir") set(OBS_EXECUTABLE_DESTINATION "${CMAKE_INSTALL_BINDIR}") set(OBS_INCLUDE_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/obs") set(OBS_LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}") -set(OBS_PLUGIN_DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-plugins") +set(OBS_PLUGIN_DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-modules") set(OBS_SCRIPT_PLUGIN_DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-scripting") set(OBS_DATA_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/obs") set(OBS_CMAKE_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake") # Set additional paths used by OBS for self-discovery -set(OBS_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/obs-plugins") +set(OBS_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/obs-modules/core") set(OBS_SCRIPT_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/obs-scripting") set(OBS_DATA_PATH "${OBS_DATA_DESTINATION}") set(OBS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") diff --git a/cmake/linux/helpers.cmake b/cmake/linux/helpers.cmake index a13c1a68f..300bec9d6 100644 --- a/cmake/linux/helpers.cmake +++ b/cmake/linux/helpers.cmake @@ -22,6 +22,10 @@ function(set_target_properties_obs target) set(OBS_SOVERSION 30) if(target_type STREQUAL EXECUTABLE) + if(target STREQUAL browser-helper) + set(OBS_EXECUTABLE_DESTINATION "${OBS_PLUGIN_DESTINATION}/core") + endif() + install(TARGETS ${target} RUNTIME DESTINATION "${OBS_EXECUTABLE_DESTINATION}" COMPONENT Runtime) add_custom_command( @@ -124,7 +128,7 @@ function(set_target_properties_obs target) set(plugin_destination "${OBS_SCRIPT_PLUGIN_DESTINATION}") set_property(TARGET ${target} PROPERTY INSTALL_RPATH "$ORIGIN/;$ORIGIN/..") else() - set(plugin_destination "${OBS_PLUGIN_DESTINATION}") + set(plugin_destination "${OBS_PLUGIN_DESTINATION}/core") endif() install( @@ -170,19 +174,20 @@ function(set_target_properties_obs target) add_custom_command( TARGET ${target} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E make_directory "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/" + COMMAND "${CMAKE_COMMAND}" -E make_directory "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/core" COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${imported_location}" "${cef_location}/chrome-sandbox" "${cef_location}/libEGL.so" "${cef_location}/libGLESv2.so" "${cef_location}/libvk_swiftshader.so" "${cef_location}/libvulkan.so.1" "${cef_location}/v8_context_snapshot.bin" - "${cef_location}/vk_swiftshader_icd.json" "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/" + "${cef_location}/vk_swiftshader_icd.json" "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/core" COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cef_root_location}/Resources/chrome_100_percent.pak" "${cef_root_location}/Resources/chrome_200_percent.pak" "${cef_root_location}/Resources/icudtl.dat" - "${cef_root_location}/Resources/resources.pak" "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/" + "${cef_root_location}/Resources/resources.pak" + "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/core" COMMAND "${CMAKE_COMMAND}" -E copy_directory "${cef_root_location}/Resources/locales" - "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/locales" + "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/core/locales" COMMENT "Add Chromium Embedded Framework to library directory" ) @@ -200,13 +205,13 @@ function(set_target_properties_obs target) "${cef_root_location}/Resources/chrome_200_percent.pak" "${cef_root_location}/Resources/icudtl.dat" "${cef_root_location}/Resources/resources.pak" - DESTINATION "${OBS_PLUGIN_DESTINATION}" + DESTINATION "${OBS_PLUGIN_DESTINATION}/core" COMPONENT Runtime ) install( DIRECTORY "${cef_root_location}/Resources/locales" - DESTINATION "${OBS_PLUGIN_DESTINATION}" + DESTINATION "${OBS_PLUGIN_DESTINATION}/core" USE_SOURCE_PERMISSIONS COMPONENT Runtime ) @@ -236,7 +241,7 @@ function(target_install_resources target) get_target_property(target_type ${target} TYPE) if(target_type STREQUAL MODULE_LIBRARY) - set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/${target}") + set(target_destination "${OBS_DATA_DESTINATION}/obs-modules/core/${target}") elseif(target STREQUAL obs) set(target_destination "${OBS_DATA_DESTINATION}/obs-studio") else() @@ -269,7 +274,7 @@ function(target_add_resource target resource) if(ARGN) set(target_destination "${ARGN}") elseif(target_type STREQUAL MODULE_LIBRARY) - set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/${target}") + set(target_destination "${OBS_DATA_DESTINATION}/obs-modules/core/${target}") elseif(target STREQUAL obs) set(target_destination "${OBS_DATA_DESTINATION}/obs-studio") else() diff --git a/cmake/windows/defaults.cmake b/cmake/windows/defaults.cmake index c2e141105..e212ac66e 100644 --- a/cmake/windows/defaults.cmake +++ b/cmake/windows/defaults.cmake @@ -5,7 +5,7 @@ include_guard(GLOBAL) set(OBS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(OBS_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/rundir") -set(OBS_PLUGIN_DESTINATION obs-plugins/64bit) +set(OBS_PLUGIN_DESTINATION core) set(OBS_DATA_DESTINATION data) set(OBS_CMAKE_DESTINATION cmake) set(OBS_SCRIPT_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-scripting/64bit") @@ -14,7 +14,7 @@ set(OBS_EXECUTABLE_DESTINATION bin/64bit) set(OBS_LIBRARY_DESTINATION lib) set(OBS_INCLUDE_DESTINATION include) # Set relative paths used by OBS for self-discovery -set(OBS_PLUGIN_PATH "../../${CMAKE_INSTALL_LIBDIR}/obs-plugins/64bit") +set(OBS_PLUGIN_PATH "../../${CMAKE_INSTALL_LIBDIR}/core") set(OBS_SCRIPT_PLUGIN_PATH "../../${OBS_DATA_DESTINATION}/obs-scripting/64bit") set(OBS_DATA_PATH "../../${OBS_DATA_DESTINATION}") diff --git a/cmake/windows/helpers.cmake b/cmake/windows/helpers.cmake index 806023ab5..5e597666f 100644 --- a/cmake/windows/helpers.cmake +++ b/cmake/windows/helpers.cmake @@ -22,9 +22,9 @@ function(set_target_properties_obs target) if(target_type STREQUAL EXECUTABLE) if(target STREQUAL obs-browser-helper) - set(OBS_EXECUTABLE_DESTINATION "${OBS_PLUGIN_DESTINATION}") + set(OBS_EXECUTABLE_DESTINATION "${OBS_PLUGIN_DESTINATION}/obs-browser") elseif(target STREQUAL inject-helper OR target STREQUAL get-graphics-offsets) - set(OBS_EXECUTABLE_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture") + set(OBS_EXECUTABLE_DESTINATION "${OBS_PLUGIN_DESTINATION}/win-capture/data") _target_install_obs(${target} DESTINATION ${OBS_EXECUTABLE_DESTINATION} x86) @@ -66,7 +66,7 @@ function(set_target_properties_obs target) elseif(target STREQUAL "obspython" OR target STREQUAL "obslua") set(target_destination "${OBS_SCRIPT_PLUGIN_DESTINATION}") elseif(target STREQUAL graphics-hook) - set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/win-capture") + set(target_destination "${OBS_PLUGIN_DESTINATION}/win-capture/data") target_add_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan64.json" "${target_destination}") target_add_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan32.json" "${target_destination}") @@ -76,7 +76,7 @@ function(set_target_properties_obs target) _target_install_obs(${target} DESTINATION ${target_destination} x64) endif() elseif(target STREQUAL obs-virtualcam-module) - set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow") + set(target_destination "${OBS_PLUGIN_DESTINATION}/win-dshow/data") _target_install_obs(${target} DESTINATION ${target_destination} x86) @@ -84,7 +84,7 @@ function(set_target_properties_obs target) _target_install_obs(${target} DESTINATION ${target_destination} x64) endif() else() - set(target_destination "${OBS_PLUGIN_DESTINATION}") + set(target_destination "${OBS_PLUGIN_DESTINATION}/${target}") endif() _target_install_obs(${target} DESTINATION ${target_destination}) @@ -314,7 +314,7 @@ function(target_install_resources target) get_target_property(target_type ${target} TYPE) if(target_type STREQUAL MODULE_LIBRARY) - set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/${target}") + set(target_destination "${OBS_PLUGIN_DESTINATION}/${target}/data") elseif(target STREQUAL obs-studio) set(target_destination "${OBS_DATA_DESTINATION}/obs-studio") else() @@ -348,7 +348,7 @@ function(target_add_resource target resource) if(ARGN) set(target_destination "${ARGN}") elseif(target_type STREQUAL MODULE_LIBRARY) - set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/${target}") + set(target_destination "${OBS_PLUGIN_DESTINATION}/${target}/data") elseif(target STREQUAL obs-studio) set(target_destination "${OBS_DATA_DESTINATION}/obs-studio") else() @@ -395,7 +395,7 @@ function(_bundle_dependencies target) set(plugins_list) foreach(library IN LISTS found_dependencies) - # CEF needs to be placed in obs-plugins directory on Windows, which is handled already + # CEF needs to be placed in core directory on Windows, which is handled already if(${library} STREQUAL CEF::Library) continue() endif() diff --git a/frontend/updater/init-hook-files.c b/frontend/updater/init-hook-files.c index a5df3c767..6f2e867a0 100644 --- a/frontend/updater/init-hook-files.c +++ b/frontend/updater/init-hook-files.c @@ -106,7 +106,7 @@ static LSTATUS get_reg(HKEY hkey, LPCWSTR sub_key, LPCWSTR value_name, bool b64) } while (false) #define IMPLICIT_LAYERS L"SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers" -#define HOOK_LOCATION L"\\data\\obs-plugins\\win-capture\\" +#define HOOK_LOCATION L"\\core\\win-capture\\data\\" static bool update_hook_file(bool b64) { diff --git a/frontend/updater/updater.cpp b/frontend/updater/updater.cpp index fcb1248b2..bbe9f7f63 100644 --- a/frontend/updater/updater.cpp +++ b/frontend/updater/updater.cpp @@ -741,7 +741,7 @@ static inline bool FileExists(const wchar_t *path) static bool NonCorePackageInstalled(const char *name) { if (strcmp(name, "obs-browser") == 0) { - return FileExists(L"obs-plugins\\64bit\\obs-browser.dll"); + return FileExists(L"core\\obs-browser\\obs-browser.dll"); } return false; @@ -1744,7 +1744,7 @@ static bool Update(wchar_t *cmdLine) StringCbCat(regsvr, sizeof(regsvr), L"\\regsvr32.exe"); StringCbCopy(src, sizeof(src), obs_base_directory); - StringCbCat(src, sizeof(src), L"\\data\\obs-plugins\\win-dshow\\"); + StringCbCat(src, sizeof(src), L"\\core\\win-dshow\\data\\"); StringCbCopy(tmp, sizeof(tmp), L"\""); StringCbCat(tmp, sizeof(tmp), regsvr); diff --git a/frontend/widgets/OBSBasic.cpp b/frontend/widgets/OBSBasic.cpp index ed263b4e5..f03ffa3c2 100644 --- a/frontend/widgets/OBSBasic.cpp +++ b/frontend/widgets/OBSBasic.cpp @@ -141,6 +141,31 @@ static void AddExtraModulePaths() #endif } +#if !defined(__APPLE__) +#if defined(_WIN32) + char *thirdPartyPluginPath = os_get_executable_path_ptr("../../obs-plugins/64bit/"); + char *thirdPartyDataPath = os_get_executable_path_ptr("../../data/obs-plugins/%module%"); + + if (thirdPartyPluginPath && *thirdPartyPluginPath && thirdPartyDataPath && *thirdPartyDataPath) { + obs_add_module_path(thirdPartyPluginPath, thirdPartyDataPath); + } + + bfree(thirdPartyPluginPath); + bfree(thirdPartyDataPath); +#else + constexpr std::string_view findToken{"obs-modules"}; + constexpr std::string_view replaceToken{"obs-plugins"}; + constexpr std::string_view thirdPartyDataPath{OBS_INSTALL_DATA_PATH "/obs-plugins/%module%"}; + + std::string thirdPartyPluginPath{OBS_INSTALL_PREFIX "/" OBS_PLUGIN_DESTINATION}; + size_t startPos = thirdPartyPluginPath.find(findToken); + if (startPos != std::string::npos) { + thirdPartyPluginPath.replace(startPos, findToken.length(), replaceToken); + obs_add_module_path(thirdPartyPluginPath.c_str(), thirdPartyDataPath.data()); + } +#endif +#endif + if (portable_mode) { return; } diff --git a/libobs/obs-nix.c b/libobs/obs-nix.c index 65cd1251d..ccc8575e5 100644 --- a/libobs/obs-nix.c +++ b/libobs/obs-nix.c @@ -51,14 +51,14 @@ const char *get_module_extension(void) static const char *module_bin[] = { "../../obs-plugins/64bit", - OBS_INSTALL_PREFIX "/" OBS_PLUGIN_DESTINATION, - FLATPAK_PLUGIN_PATH "/" OBS_PLUGIN_DESTINATION, + OBS_INSTALL_PREFIX "/" OBS_PLUGIN_DESTINATION "/core", + FLATPAK_PLUGIN_PATH "/" OBS_PLUGIN_DESTINATION "/core", }; static const char *module_data[] = { OBS_DATA_PATH "/obs-plugins/%module%", - OBS_INSTALL_DATA_PATH "/obs-plugins/%module%", - FLATPAK_PLUGIN_PATH "/share/obs/obs-plugins/%module%", + OBS_INSTALL_DATA_PATH "/obs-modules/core/%module%", + FLATPAK_PLUGIN_PATH "/share/obs/obs-modules/core/%module%", }; static const int module_patterns_size = sizeof(module_bin) / sizeof(module_bin[0]); @@ -68,7 +68,7 @@ static const struct obs_nix_hotkeys_vtable *hotkeys_vtable = NULL; void add_default_module_paths(void) { char *module_bin_path = os_get_executable_path_ptr("../" OBS_PLUGIN_PATH); - char *module_data_path = os_get_executable_path_ptr("../" OBS_DATA_PATH "/obs-plugins/%module%"); + char *module_data_path = os_get_executable_path_ptr("../" OBS_DATA_PATH "/obs-modules/core/%module%"); if (module_bin_path && module_data_path) { char *abs_module_bin_path = os_get_abs_path_ptr(module_bin_path); diff --git a/libobs/obs-windows.c b/libobs/obs-windows.c index 90fb34305..3871e7c83 100644 --- a/libobs/obs-windows.c +++ b/libobs/obs-windows.c @@ -34,9 +34,9 @@ const char *get_module_extension(void) return ".dll"; } -static const char *module_bin[] = {"../../obs-plugins/64bit"}; +static const char *module_bin[] = {"../../core/%module%"}; -static const char *module_data[] = {"../../data/obs-plugins/%module%"}; +static const char *module_data[] = {"../../core/%module%/data"}; static const int module_patterns_size = sizeof(module_bin) / sizeof(module_bin[0]); diff --git a/plugins/win-capture/game-capture-file-init.c b/plugins/win-capture/game-capture-file-init.c index dc4f3c26b..d0dc6898a 100644 --- a/plugins/win-capture/game-capture-file-init.c +++ b/plugins/win-capture/game-capture-file-init.c @@ -180,7 +180,7 @@ static bool update_hook_file(bool b64) wchar_t dst_json[MAX_PATH]; StringCbCopyW(temp, sizeof(temp), - L"..\\..\\data\\obs-plugins\\" + L"..\\..\\data\\core\\" L"win-capture\\"); make_filename(temp, L"obs-vulkan", L".json"); diff --git a/plugins/win-dshow/virtualcam-module/CMakeLists.txt b/plugins/win-dshow/virtualcam-module/CMakeLists.txt index 8ac916e17..87cda18fa 100644 --- a/plugins/win-dshow/virtualcam-module/CMakeLists.txt +++ b/plugins/win-dshow/virtualcam-module/CMakeLists.txt @@ -138,12 +138,12 @@ target_sources(obs-virtualcam-module PRIVATE cmake/windows/${_OUTPUT_NAME}.def) configure_file(virtualcam-install.bat.in virtualcam-install.bat) target_add_resource(obs-virtualcam-module "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat" - "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow" + "${OBS_PLUGIN_DESTINATION}/win-dshow/data" ) configure_file(virtualcam-uninstall.bat.in virtualcam-uninstall.bat) target_add_resource(obs-virtualcam-module "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat" - "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow" + "${OBS_PLUGIN_DESTINATION}/win-dshow/data" ) set_target_properties_obs( diff --git a/plugins/win-dshow/virtualcam-module/virtualcam-install.bat.in b/plugins/win-dshow/virtualcam-module/virtualcam-install.bat.in index f28696e8b..51166e8b3 100644 --- a/plugins/win-dshow/virtualcam-module/virtualcam-install.bat.in +++ b/plugins/win-dshow/virtualcam-module/virtualcam-install.bat.in @@ -36,8 +36,8 @@ goto checkAdmin :install32DLL echo Installing 32-bit Virtual Cam... - if exist "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll" ( - regsvr32.exe /i /s "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll" + if exist "%~dp0\data\core\win-dshow\obs-virtualcam-module32.dll" ( + regsvr32.exe /i /s "%~dp0\data\core\win-dshow\obs-virtualcam-module32.dll" ) else ( regsvr32.exe /i /s obs-virtualcam-module32.dll ) @@ -54,8 +54,8 @@ goto checkAdmin :install64DLL echo Installing 64-bit Virtual Cam... - if exist "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll" ( - regsvr32.exe /i /s "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll" + if exist "%~dp0\data\core\win-dshow\obs-virtualcam-module64.dll" ( + regsvr32.exe /i /s "%~dp0\data\core\win-dshow\obs-virtualcam-module64.dll" ) else ( regsvr32.exe /i /s obs-virtualcam-module64.dll ) diff --git a/plugins/win-dshow/virtualcam-module/virtualcam-uninstall.bat.in b/plugins/win-dshow/virtualcam-module/virtualcam-uninstall.bat.in index aefebf1b8..fb9e417d0 100644 --- a/plugins/win-dshow/virtualcam-module/virtualcam-uninstall.bat.in +++ b/plugins/win-dshow/virtualcam-module/virtualcam-uninstall.bat.in @@ -12,13 +12,13 @@ goto checkAdmin ) :uninstallDLLs - if exist "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll" ( - regsvr32.exe /u /s "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll" + if exist "%~dp0\data\core\win-dshow\obs-virtualcam-module32.dll" ( + regsvr32.exe /u /s "%~dp0\data\core\win-dshow\obs-virtualcam-module32.dll" ) else ( regsvr32.exe /u /s obs-virtualcam-module32.dll ) - if exist "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll" ( - regsvr32.exe /u /s "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll" + if exist "%~dp0\data\core\win-dshow\obs-virtualcam-module64.dll" ( + regsvr32.exe /u /s "%~dp0\data\core\win-dshow\obs-virtualcam-module64.dll" ) else ( regsvr32.exe /u /s obs-virtualcam-module64.dll )