Skip to content

Commit

Permalink
Merge pull request #19 from OPENSPHERE-Inc/macos-fix
Browse files Browse the repository at this point in the history
Supoprt for MacOS
  • Loading branch information
hanatyan128 authored Dec 19, 2024
2 parents aa7157d + 66653be commit fdd9c6e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
35 changes: 23 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,19 @@ target_include_directories(

set_target_properties_plugin(${CMAKE_PROJECT_NAME} PROPERTIES OUTPUT_NAME ${_name})

if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
if(NOT buildspec)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
endif()
string(
JSON
qtversion
GET
${buildspec}
dependencies
qt6
version)
if(NOT buildspec)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
endif()
string(
JSON
qtversion
GET
${buildspec}
dependencies
qt6
version)

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
Expand All @@ -135,4 +135,15 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
CONFIGURATIONS RelWithDebInfo Debug Release
DESTINATION bin/64bit
OPTIONAL)
elseif(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)
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)
endif()
2 changes: 1 addition & 1 deletion cmake/macos/xcode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @loader_path/../Frameworks")
5 changes: 3 additions & 2 deletions src/outputs/egress-link-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ obs_properties_t *EgressLinkOutput::getProperties()
_videoEncoderGroup, "video_encoder_settings_group", obs_encoder_get_display_name(_encoderId),
OBS_GROUP_NORMAL, encoderProps
);
}

obs_properties_apply_settings(_videoEncoderGroup, _settings);
// Do not apply to _videoEncoderGroup because it will cause memoryleak.
obs_properties_apply_settings(encoderProps, _settings);
}

obs_log(LOG_DEBUG, "%s: Video encoder changed", qUtf8Printable(_output->getName()));
return true;
Expand Down
7 changes: 7 additions & 0 deletions src/plugin-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <QDesktopServices>
#include <QUrl>
#include <QMainWindow>
#include <QFileInfo>
#include <QDir>
#include <QAction>

Expand Down Expand Up @@ -79,6 +80,12 @@ void frontendEventCallback(enum obs_frontend_event event, void *)

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());
QCoreApplication::addLibraryPath(libraryPath);
#endif

apiClient = new SRCLinkApiClient();

obs_frontend_add_event_callback(frontendEventCallback, nullptr);
Expand Down

0 comments on commit fdd9c6e

Please sign in to comment.