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 <PatTheMav@users.noreply.github.com>
This commit is contained in:
FiniteSingularity
2026-09-23 18:53:19 -04:00
committed by Ryan Foster
co-authored by PatTheMav
parent cca82c7156
commit 4ab64d00d0
13 changed files with 72 additions and 42 deletions
+2 -2
View File
@@ -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}")
+14 -9
View File
@@ -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}/$<CONFIG>/${OBS_PLUGIN_DESTINATION}/"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${OBS_OUTPUT_DIR}/$<CONFIG>/${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}/$<CONFIG>/${OBS_PLUGIN_DESTINATION}/"
"${cef_location}/vk_swiftshader_icd.json" "${OBS_OUTPUT_DIR}/$<CONFIG>/${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}/$<CONFIG>/${OBS_PLUGIN_DESTINATION}/"
"${cef_root_location}/Resources/resources.pak"
"${OBS_OUTPUT_DIR}/$<CONFIG>/${OBS_PLUGIN_DESTINATION}/core"
COMMAND
"${CMAKE_COMMAND}" -E copy_directory "${cef_root_location}/Resources/locales"
"${OBS_OUTPUT_DIR}/$<CONFIG>/${OBS_PLUGIN_DESTINATION}/locales"
"${OBS_OUTPUT_DIR}/$<CONFIG>/${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()
+2 -2
View File
@@ -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}")
+8 -8
View File
@@ -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()
+1 -1
View File
@@ -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)
{
+2 -2
View File
@@ -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);
+25
View File
@@ -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;
}
+5 -5
View File
@@ -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);
+2 -2
View File
@@ -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]);
+1 -1
View File
@@ -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");
@@ -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(
@@ -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
)
@@ -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
)