Skip to content
Merged
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
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ legacy_check()
set(obs-websocket_VERSION 5.4.2)
set(OBS_WEBSOCKET_RPC_VERSION 1)

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

option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)
if(NOT ENABLE_WEBSOCKET)
target_disable(obs-websocket)
Expand Down Expand Up @@ -34,7 +36,6 @@ add_library(OBS::websocket ALIAS obs-websocket)
target_sources(
obs-websocket
PRIVATE # cmake-format: sortable
lib/obs-websocket-api.h
src/Config.cpp
src/Config.h
src/forms/ConnectInfo.cpp
Expand Down Expand Up @@ -154,6 +155,7 @@ target_link_libraries(
obs-websocket
PRIVATE OBS::libobs
OBS::frontend-api
OBS::websocket-api
Qt::Core
Qt::Widgets
Qt::Svg
Expand Down
17 changes: 16 additions & 1 deletion cmake/legacy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ set(OBS_WEBSOCKET_RPC_VERSION 1)

option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)

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

target_sources(obs-websocket-api INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/obs-websocket-api.h>
$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}/obs-websocket-api.h>)

target_link_libraries(obs-websocket-api INTERFACE OBS::libobs)

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

set_target_properties(obs-websocket-api PROPERTIES PUBLIC_HEADER lib/obs-websocket-api.h)

export_target(obs-websocket-api)

if(NOT ENABLE_WEBSOCKET OR NOT ENABLE_UI)
message(STATUS "OBS: DISABLED obs-websocket")
return()
Expand Down Expand Up @@ -56,7 +71,6 @@ target_sources(
src/obs-websocket.h
src/Config.cpp
src/Config.h
lib/obs-websocket-api.h
src/forms/SettingsDialog.cpp
src/forms/SettingsDialog.h
src/forms/ConnectInfo.cpp
Expand Down Expand Up @@ -133,6 +147,7 @@ target_link_libraries(
obs-websocket
PRIVATE OBS::libobs
OBS::frontend-api
OBS::websocket-api
Qt::Core
Qt::Widgets
Qt::Svg
Expand Down
14 changes: 14 additions & 0 deletions cmake/obs-websocket-api.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_library(obs-websocket-api INTERFACE)
add_library(OBS::websocket-api ALIAS obs-websocket-api)

target_sources(obs-websocket-api INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/obs-websocket-api.h>
$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}/obs-websocket-api.h>)

target_link_libraries(obs-websocket-api INTERFACE OBS::libobs)

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

set_target_properties(obs-websocket-api PROPERTIES PREFIX "" PUBLIC_HEADER lib/obs-websocket-api.h)

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

include(CMakeFindDependencyMacro)

find_dependency(libobs REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")
3 changes: 1 addition & 2 deletions src/WebSocketApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <mutex>
#include <shared_mutex>
#include <obs.h>

#include "../lib/obs-websocket-api.h"
#include <obs-websocket-api.h>

class WebSocketApi {
public:
Expand Down