cmake: Fix UI being dependent on browser plugin files

The UI currently is dependent on browser source files being present,
when in actuality the files may not have been fetched (i.e. not fetching
submodules).  This fixes that by using a macro to detect whether it's
available or not.

Closes obsproject/obs-studio#1490
master
jp9000 2018-09-18 08:54:30 -07:00
parent fdc2464ad0
commit 8b936a1575
4 changed files with 20 additions and 9 deletions

View File

@ -142,8 +142,8 @@ if(NOT INSTALLER_RUN)
add_subdirectory(libobs-opengl)
add_subdirectory(libobs)
add_subdirectory(UI)
add_subdirectory(plugins)
add_subdirectory(UI)
if (BUILD_TESTS)
add_subdirectory(test)
endif()

View File

@ -7,6 +7,10 @@ else()
set(FIND_MODE QUIET)
endif()
if(BROWSER_AVAILABLE_INTERNAL)
add_definitions(-DBROWSER_AVAILABLE)
endif()
add_subdirectory(obs-frontend-api)
# ----------------------------------------------------------------------------
@ -56,7 +60,9 @@ include_directories(SYSTEM "obs-frontend-api")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/deps/libff")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/deps/json11")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/plugins/obs-browser/panel")
if(BROWSER_AVAILABLE_INTERNAL)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/plugins/obs-browser/panel")
endif()
find_package(Libcurl REQUIRED)
include_directories(${LIBCURL_INCLUDE_DIRS})

View File

@ -70,16 +70,13 @@
#include <QScreen>
#include <QWindow>
#ifdef _WIN32
#include <browser-panel.hpp>
#endif
#include <json11.hpp>
using namespace json11;
using namespace std;
#ifdef _WIN32
#if defined(_WIN32) && defined(BROWSER_AVAILABLE)
#include <browser-panel.hpp>
static CREATE_BROWSER_WIDGET_PROC create_browser_widget = nullptr;
#endif
@ -1507,7 +1504,7 @@ void OBSBasic::OBSInit()
blog(LOG_INFO, "---------------------------------");
obs_post_load_modules();
#ifdef _WIN32
#if defined(_WIN32) && defined(BROWSER_AVAILABLE)
create_browser_widget = obs_browser_init_panel();
#endif
@ -1738,7 +1735,7 @@ void OBSBasic::OnFirstLoad()
if (api)
api->on_event(OBS_FRONTEND_EVENT_FINISHED_LOADING);
#ifdef _WIN32
#if defined(_WIN32) && defined(BROWSER_AVAILABLE)
/* Attempt to load init screen if available */
if (create_browser_widget) {
WhatsNewInfoThread *wnit = new WhatsNewInfoThread();
@ -1776,6 +1773,7 @@ void OBSBasic::DeferredLoad(const QString &file, int requeueCount)
/* shows a "what's new" page on startup of new versions using CEF */
void OBSBasic::ReceivedIntroJson(const QString &text)
{
#ifdef BROWSER_AVAILABLE
#ifdef _WIN32
std::string err;
Json json = Json::parse(QT_TO_UTF8(text), err);
@ -1875,6 +1873,9 @@ void OBSBasic::ReceivedIntroJson(const QString &text)
#else
UNUSED_PARAMETER(text);
#endif
#else
UNUSED_PARAMETER(text);
#endif
}
void OBSBasic::UpdateMultiviewProjectorMenu()

View File

@ -53,9 +53,13 @@ if(WIN32 OR APPLE)
if (BUILD_BROWSER)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/obs-browser/CMakeLists.txt")
add_subdirectory(obs-browser)
set(BROWSER_AVAILABLE_INTERNAL ON CACHE BOOL "Interal global cmake variable" FORCE)
else()
message(STATUS "obs-browser submodule not found! Please fetch submodules. obs-browser plugin disabled.")
set(BROWSER_AVAILABLE_INTERNAL OFF CACHE BOOL "Interal global cmake variable" FORCE)
endif()
else()
set(BROWSER_AVAILABLE_INTERNAL OFF CACHE BOOL "Interal global cmake variable" FORCE)
endif()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/obs-vst/CMakeLists.txt")