Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add procedure handler based API #431

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.16...3.25)

option(ENABLE_BROWSER "Enable browser source plugin (required Chromium Embedded Framework)" OFF)

include(cmake/obs-browser-api.cmake)

if(NOT ENABLE_BROWSER)
target_disable(obs-browser)
target_disable_feature(obs-browser "Browser sources are not enabled by default (set CEF_ROOT_DIR and ENABLE_BROWSER)")
Expand Down Expand Up @@ -36,6 +38,8 @@ target_sources(
deps/signal-restore.hpp
deps/wide-string.cpp
deps/wide-string.hpp
obs-browser-api-impl.cpp
obs-browser-api-impl.hpp
obs-browser-plugin.cpp
obs-browser-source-audio.cpp
obs-browser-source.cpp
Expand All @@ -44,7 +48,7 @@ target_sources(
target_include_directories(obs-browser PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/deps")

target_compile_features(obs-browser PRIVATE cxx_std_17)
target_link_libraries(obs-browser PRIVATE OBS::libobs OBS::frontend-api nlohmann_json::nlohmann_json)
target_link_libraries(obs-browser PRIVATE OBS::libobs OBS::frontend-api OBS::browser-api nlohmann_json::nlohmann_json)

if(OS_WINDOWS)
include(cmake/os-windows.cmake)
Expand Down
4 changes: 2 additions & 2 deletions cmake/feature-panels.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ target_compile_definitions(browser-panels INTERFACE BROWSER_AVAILABLE)
target_sources(
obs-browser
PRIVATE # cmake-format: sortable
panel/browser-panel-client.cpp panel/browser-panel-client.hpp panel/browser-panel-internal.hpp
panel/browser-panel.cpp)
obs-browser-api-impl-panel.cpp panel/browser-panel-client.cpp panel/browser-panel-client.hpp
panel/browser-panel-internal.hpp panel/browser-panel.cpp)

target_link_libraries(obs-browser PRIVATE OBS::browser-panels Qt::Widgets)

Expand Down
16 changes: 16 additions & 0 deletions cmake/obs-browser-api.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
find_package(Qt6 REQUIRED Widgets)

add_library(obs-browser-api INTERFACE)
add_library(OBS::browser-api ALIAS obs-browser-api)

target_sources(obs-browser-api PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/obs-browser-api.hpp>
$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}/obs-browser-api.hpp>)

target_link_libraries(obs-browser-api INTERFACE OBS::libobs Qt::Widgets)

target_include_directories(obs-browser-api INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/lib"
"$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}>")

set_target_properties(obs-browser-api PROPERTIES PREFIX "" PUBLIC_HEADER lib/obs-browser-api.hpp)

target_export(obs-browser-api)
9 changes: 9 additions & 0 deletions cmake/obs-browser-apiConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

find_dependency(libobs REQUIRED)
find_package(Qt6 REQUIRED Widgets)

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
check_required_components("@PROJECT_NAME@")
Loading