diff --git a/.gitignore b/.gitignore index 8ee8b12..1ae6ffb 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ !build-windows-installer.ps1 !src-link_usage_image.jpg !/srtrelay +!Frameworks.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 91144f7..916c5f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,13 +126,15 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") install( DIRECTORY "${CMAKE_SOURCE_DIR}/.deps/obs-deps-qt6-${qtversion}-universal/lib/QtWebSockets.framework" CONFIGURATIONS RelWithDebInfo Debug Release - DESTINATION "${CMAKE_PROJECT_NAME}.plugin/Contents/Frameworks" - OPTIONAL) + DESTINATION "." + REGEX "Headers" EXCLUDE) install( DIRECTORY "${CMAKE_SOURCE_DIR}/.deps/obs-deps-qt6-${qtversion}-universal/plugins/tls" CONFIGURATIONS RelWithDebInfo Debug Release - DESTINATION "${CMAKE_PROJECT_NAME}.plugin/Contents/Frameworks" - OPTIONAL) + DESTINATION ".") + + configure_file(Frameworks.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/Frameworks.cmake" @ONLY) + install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/Frameworks.cmake") endif() set_target_properties_plugin(${CMAKE_PROJECT_NAME} PROPERTIES OUTPUT_NAME ${_name}) @@ -141,11 +143,9 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") install( FILES "${CMAKE_SOURCE_DIR}/.deps/obs-deps-qt6-${qtversion}-x64/bin/Qt6WebSockets.dll" CONFIGURATIONS RelWithDebInfo Debug Release - DESTINATION bin/64bit - OPTIONAL) + DESTINATION bin/64bit) install( DIRECTORY "${CMAKE_SOURCE_DIR}/.deps/obs-deps-qt6-${qtversion}-x64/plugins/tls" CONFIGURATIONS RelWithDebInfo Debug Release - DESTINATION bin/64bit - OPTIONAL) + DESTINATION bin/64bit) endif() diff --git a/Frameworks.cmake.in b/Frameworks.cmake.in new file mode 100644 index 0000000..b044266 --- /dev/null +++ b/Frameworks.cmake.in @@ -0,0 +1,30 @@ +if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/QtWebSockets.framework" AND NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/QtWebSockets.framework") + file(INSTALL DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins" + TYPE DIRECTORY FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/QtWebSockets.framework" USE_SOURCE_PERMISSIONS) + execute_process( + COMMAND /usr/bin/codesign + --force + --sign "@CODESIGN_IDENTITY@" + --timestamp + -o runtime + --generate-entitlement-der + "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins/QtWebSockets.framework" + ) +endif() + +if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/tls" AND NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/tls") + file(INSTALL DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins" + TYPE DIRECTORY FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/tls" USE_SOURCE_PERMISSIONS) + file(GLOB_RECURSE dylib_files "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins/tls/*.dylib") + foreach(dylib_file IN LISTS dylib_files) + execute_process( + COMMAND /usr/bin/codesign + --force + --sign "@CODESIGN_IDENTITY@" + --timestamp + -o runtime + --generate-entitlement-der + "${dylib_file}" + ) + endforeach() +endif() diff --git a/cmake/macos/xcode.cmake b/cmake/macos/xcode.cmake index 20673cc..a158db1 100644 --- a/cmake/macos/xcode.cmake +++ b/cmake/macos/xcode.cmake @@ -171,4 +171,4 @@ set(CMAKE_COLOR_DIAGNOSTICS TRUE) # Disable usage of RPATH in build or install configurations set(CMAKE_SKIP_RPATH TRUE) # Have Xcode set default RPATH entries -set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @loader_path/../Frameworks") +set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @loader_path/../../../") diff --git a/src/plugin-main.cpp b/src/plugin-main.cpp index 9f5e8dc..205ec17 100644 --- a/src/plugin-main.cpp +++ b/src/plugin-main.cpp @@ -82,7 +82,7 @@ bool obs_module_load(void) { #ifdef __APPLE__ QFileInfo moduleFile(obs_get_module_binary_path(obs_current_module())); - auto libraryPath = QString("%1/../Frameworks").arg(moduleFile.dir().path()); + auto libraryPath = QString("%1/../../../").arg(moduleFile.dir().path()); QCoreApplication::addLibraryPath(libraryPath); #endif