Adapt to new plugin folder structure / location for Windows

This commit is contained in:
WarmUpTill 2026-04-06 23:22:22 +02:00 committed by WarmUpTill
parent 873e073eb6
commit 2077e1971d
4 changed files with 20 additions and 21 deletions

View File

@ -2,7 +2,7 @@
if(BUILD_OUT_OF_TREE)
if(OS_WINDOWS)
set(OBS_PLUGIN_DESTINATION "obs-plugins/64bit")
set(OBS_PLUGIN_DESTINATION "${CMAKE_PROJECT_NAME}/bin/64bit")
else()
set(OBS_PLUGIN_DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-plugins")
endif()

View File

@ -6,3 +6,9 @@ include_guard(GLOBAL)
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
include(buildspec)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
"$ENV{ALLUSERSPROFILE}/obs-studio/plugins"
CACHE STRING "Default plugin installation directory" FORCE)
endif()

View File

@ -30,13 +30,13 @@ function(set_target_properties_plugin target)
install(
TARGETS ${target}
RUNTIME DESTINATION bin/64bit
LIBRARY DESTINATION obs-plugins/64bit)
RUNTIME DESTINATION "${target}/bin/64bit"
LIBRARY DESTINATION "${target}/bin/64bit")
install(
FILES "$<TARGET_PDB_FILE:${target}>"
CONFIGURATIONS RelWithDebInfo Debug Release
DESTINATION obs-plugins/64bit
DESTINATION "${target}/bin/64bit"
OPTIONAL)
if(OBS_BUILD_DIR)
@ -44,11 +44,11 @@ function(set_target_properties_plugin target)
TARGET ${target}
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E make_directory
"${OBS_BUILD_DIR}/obs-plugins/64bit"
"${OBS_BUILD_DIR}/plugins/${target}/bin/64bit"
COMMAND
"${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:${target}>"
"$<$<CONFIG:Debug,RelWithDebInfo,Release>:$<TARGET_PDB_FILE:${target}>>"
"${OBS_BUILD_DIR}/obs-plugins/64bit"
"${OBS_BUILD_DIR}/plugins/${target}/bin/64bit"
COMMENT "Copy ${target} to obs-studio directory ${OBS_BUILD_DIR}"
VERBATIM)
endif()
@ -105,7 +105,7 @@ function(target_install_resources target)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data/"
DESTINATION data/obs-plugins/${target}
DESTINATION "${target}/data"
USE_SOURCE_PERMISSIONS)
if(OBS_BUILD_DIR)
@ -113,11 +113,11 @@ function(target_install_resources target)
TARGET ${target}
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E make_directory
"${OBS_BUILD_DIR}/data/obs-plugins/${target}"
"${OBS_BUILD_DIR}/plugins/${target}/data"
COMMAND
"${CMAKE_COMMAND}" -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/data"
"${OBS_BUILD_DIR}/data/obs-plugins/${target}"
"${OBS_BUILD_DIR}/plugins/${target}/data"
COMMENT "Copy ${target} resources to data directory"
VERBATIM)
endif()
@ -133,7 +133,7 @@ function(target_add_resource target resource)
install(
FILES "${resource}"
DESTINATION data/obs-plugins/${target}
DESTINATION "${target}/data"
COMPONENT Runtime)
if(OBS_BUILD_DIR)
@ -141,9 +141,9 @@ function(target_add_resource target resource)
TARGET ${target}
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E make_directory
"${OBS_BUILD_DIR}/data/obs-plugins/${target}"
"${OBS_BUILD_DIR}/plugins/${target}/data"
COMMAND "${CMAKE_COMMAND}" -E copy "${resource}"
"${OBS_BUILD_DIR}/data/obs-plugins/${target}"
"${OBS_BUILD_DIR}/plugins/${target}/data"
COMMENT "Copy ${target} resource ${resource} to library directory"
VERBATIM)
endif()

View File

@ -21,7 +21,7 @@ Compression=lzma
SolidCompression=yes
DirExistsWarning=no
SetupIconFile=installer.ico
UninstallDisplayIcon={app}\data\obs-plugins\advanced-scene-switcher\res\images\logo.ico
UninstallDisplayIcon={app}\advanced-scene-switcher\data\res\images\logo.ico
DisableDirPage=no
[Languages]
@ -54,14 +54,7 @@ end;
// credit where it's due :
// following function come from https://github.com/Xaymar/obs-studio_amf-encoder-plugin/blob/master/%23Resources/Installer.in.iss#L45
function GetDirName(Value: string): string;
var
InstallPath: string;
begin
// initialize default path, which will be returned when the following registry
// key queries fail due to missing keys or for some different reason
Result := '{autopf}\obs-studio';
// query the first registry value; if this succeeds, return the obtained value
if RegQueryStringValue(HKLM32, 'SOFTWARE\OBS Studio', '', InstallPath) then
Result := InstallPath
Result := ExpandConstant('{commonappdata}\obs-studio\plugins');
end;