Skip to content

Commit

Permalink
Use baked CEF dir on OSX unless deploying
Browse files Browse the repository at this point in the history
Makes it so it's easier to compile/use the browser plugin on mac.
  • Loading branch information
jp9000 committed Sep 11, 2018
1 parent d019ef3 commit da0b449
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ endif()
option(EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED "Enable shared texture support for the browser plugin (Win32)" ON)
option(BROWSER_PANEL_SUPPORT_ENABLED "Enables Qt web browser panel support" ON)

if(APPLE)
option(BROWSER_DEPLOY "Marks full deployment of browser plugin" OFF)
if(BROWSER_DEPLOY)
add_definitions(-DBROWSER_DEPLOY)
endif()
endif()

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/browser-config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/browser-config.h")
Expand Down Expand Up @@ -191,5 +198,18 @@ if (WIN32)
)
endif()

if(APPLE AND NOT BROWSER_DEPLOY)
add_custom_command(TARGET obs-browser POST_BUILD
COMMAND "install_name_tool" -change
"@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"
"${CEF_LIBRARY}/Chromium Embedded Framework"
"obs-browser.so")
add_custom_command(TARGET obs-browser-page POST_BUILD
COMMAND "install_name_tool" -change
"@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"
"${CEF_LIBRARY}/Chromium Embedded Framework"
"obs-browser-page")
endif()

install_obs_plugin_with_data(obs-browser data)
install_obs_plugin(obs-browser-page)
4 changes: 4 additions & 0 deletions browser-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#define FALSE false
#endif

#ifdef __APPLE__
#define CEF_LIBRARY "@CEF_LIBRARY@"
#endif

#ifdef _WIN32
#define EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED \
@EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED@
Expand Down
6 changes: 3 additions & 3 deletions obs-browser-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "browser-scheme.hpp"
#include "browser-app.hpp"
#include "browser-version.h"
#include "browser-config.h"

#include "json11/json11.hpp"
#include "cef-headers.hpp"
Expand Down Expand Up @@ -171,9 +172,8 @@ static void BrowserManagerThread(void)
settings.windowless_rendering_enabled = true;
settings.no_sandbox = true;

#if defined(__APPLE__) && defined(_DEBUG)
CefString(&settings.framework_dir_path) =
"/Library/Frameworks/Chromium Embedded Framework.framework";
#if defined(__APPLE__) && !defined(BROWSER_DEPLOY)
CefString(&settings.framework_dir_path) = CEF_LIBRARY;
#endif

BPtr<char> conf_path = obs_module_config_path("");
Expand Down

0 comments on commit da0b449

Please sign in to comment.