2023-03-04 20:57:51 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16...3.25)
|
2021-03-08 11:56:43 +00:00
|
|
|
|
2023-03-04 20:57:51 +00:00
|
|
|
legacy_check()
|
2022-07-29 06:21:05 +00:00
|
|
|
|
2023-12-05 19:15:04 +00:00
|
|
|
set(obs-websocket_VERSION 5.3.4)
|
2023-03-26 23:09:51 +00:00
|
|
|
set(OBS_WEBSOCKET_RPC_VERSION 1)
|
|
|
|
|
2023-03-04 20:57:51 +00:00
|
|
|
option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)
|
|
|
|
if(NOT ENABLE_WEBSOCKET)
|
|
|
|
target_disable(obs-websocket)
|
2022-05-14 03:23:03 +00:00
|
|
|
return()
|
2021-04-26 15:46:11 +00:00
|
|
|
endif()
|
|
|
|
|
2022-07-26 20:13:01 +00:00
|
|
|
# Find Qt
|
2023-10-10 21:31:57 +00:00
|
|
|
find_package(Qt6 REQUIRED Core Widgets Svg Network)
|
2021-04-26 15:46:11 +00:00
|
|
|
|
2023-02-02 09:23:06 +00:00
|
|
|
# Find nlohmann JSON
|
|
|
|
find_package(nlohmann_json 3 REQUIRED)
|
|
|
|
|
2023-04-20 12:48:06 +00:00
|
|
|
# Find qrcodegencpp
|
2023-09-16 12:57:21 +00:00
|
|
|
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
|
|
|
find_package(qrcodegencpp REQUIRED)
|
|
|
|
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
|
2023-04-20 12:48:06 +00:00
|
|
|
|
2023-02-02 09:23:06 +00:00
|
|
|
# Find WebSocket++
|
|
|
|
find_package(Websocketpp 0.8 REQUIRED)
|
|
|
|
|
|
|
|
# Find Asio
|
|
|
|
find_package(Asio 1.12.1 REQUIRED)
|
2021-04-27 16:46:00 +00:00
|
|
|
|
2022-05-14 03:23:03 +00:00
|
|
|
add_library(obs-websocket MODULE)
|
|
|
|
add_library(OBS::websocket ALIAS obs-websocket)
|
|
|
|
|
|
|
|
target_sources(
|
2022-07-25 14:48:06 +00:00
|
|
|
obs-websocket
|
2023-10-10 21:31:57 +00:00
|
|
|
PRIVATE # cmake-format: sortable
|
|
|
|
lib/obs-websocket-api.h
|
2022-07-25 14:48:06 +00:00
|
|
|
src/Config.cpp
|
|
|
|
src/Config.h
|
|
|
|
src/forms/ConnectInfo.cpp
|
|
|
|
src/forms/ConnectInfo.h
|
|
|
|
src/forms/resources.qrc
|
2023-03-04 20:57:51 +00:00
|
|
|
src/forms/SettingsDialog.cpp
|
|
|
|
src/forms/SettingsDialog.h
|
2023-10-10 21:31:57 +00:00
|
|
|
src/obs-websocket.cpp
|
|
|
|
src/obs-websocket.h
|
2022-07-25 14:48:06 +00:00
|
|
|
src/WebSocketApi.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/WebSocketApi.h)
|
|
|
|
|
|
|
|
target_sources(
|
|
|
|
obs-websocket
|
2023-10-10 21:31:57 +00:00
|
|
|
PRIVATE # cmake-format: sortable
|
2022-07-25 14:48:06 +00:00
|
|
|
src/websocketserver/rpc/WebSocketSession.h
|
|
|
|
src/websocketserver/types/WebSocketCloseCode.h
|
2023-10-10 21:31:57 +00:00
|
|
|
src/websocketserver/types/WebSocketOpCode.h
|
|
|
|
src/websocketserver/WebSocketServer.cpp
|
|
|
|
src/websocketserver/WebSocketServer.h
|
|
|
|
src/websocketserver/WebSocketServer_Protocol.cpp)
|
2023-03-04 20:57:51 +00:00
|
|
|
|
|
|
|
target_sources(
|
|
|
|
obs-websocket
|
2023-10-10 21:31:57 +00:00
|
|
|
PRIVATE # cmake-format: sortable
|
|
|
|
src/eventhandler/EventHandler.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/eventhandler/EventHandler.h
|
2022-07-25 14:48:06 +00:00
|
|
|
src/eventhandler/EventHandler_Config.cpp
|
|
|
|
src/eventhandler/EventHandler_Filters.cpp
|
2023-10-10 21:31:57 +00:00
|
|
|
src/eventhandler/EventHandler_General.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/eventhandler/EventHandler_Inputs.cpp
|
|
|
|
src/eventhandler/EventHandler_MediaInputs.cpp
|
2022-07-25 14:48:06 +00:00
|
|
|
src/eventhandler/EventHandler_Outputs.cpp
|
|
|
|
src/eventhandler/EventHandler_SceneItems.cpp
|
2023-10-10 21:31:57 +00:00
|
|
|
src/eventhandler/EventHandler_Scenes.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/eventhandler/EventHandler_Transitions.cpp
|
2022-07-25 14:48:06 +00:00
|
|
|
src/eventhandler/EventHandler_Ui.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/eventhandler/types/EventSubscription.h)
|
|
|
|
|
|
|
|
target_sources(
|
|
|
|
obs-websocket
|
2023-10-10 21:31:57 +00:00
|
|
|
PRIVATE # cmake-format: sortable
|
|
|
|
src/requesthandler/RequestBatchHandler.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/requesthandler/RequestBatchHandler.h
|
2022-07-25 14:48:06 +00:00
|
|
|
src/requesthandler/RequestHandler.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/requesthandler/RequestHandler.h
|
2022-07-25 14:48:06 +00:00
|
|
|
src/requesthandler/RequestHandler_Config.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/requesthandler/RequestHandler_Filters.cpp
|
|
|
|
src/requesthandler/RequestHandler_General.cpp
|
|
|
|
src/requesthandler/RequestHandler_Inputs.cpp
|
|
|
|
src/requesthandler/RequestHandler_MediaInputs.cpp
|
|
|
|
src/requesthandler/RequestHandler_Outputs.cpp
|
|
|
|
src/requesthandler/RequestHandler_Record.cpp
|
2022-07-25 14:48:06 +00:00
|
|
|
src/requesthandler/RequestHandler_SceneItems.cpp
|
2023-10-10 21:31:57 +00:00
|
|
|
src/requesthandler/RequestHandler_Scenes.cpp
|
|
|
|
src/requesthandler/RequestHandler_Sources.cpp
|
2022-07-25 14:48:06 +00:00
|
|
|
src/requesthandler/RequestHandler_Stream.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/requesthandler/RequestHandler_Transitions.cpp
|
2022-07-25 14:48:06 +00:00
|
|
|
src/requesthandler/RequestHandler_Ui.cpp
|
|
|
|
src/requesthandler/rpc/Request.cpp
|
|
|
|
src/requesthandler/rpc/Request.h
|
|
|
|
src/requesthandler/rpc/RequestBatchRequest.cpp
|
|
|
|
src/requesthandler/rpc/RequestBatchRequest.h
|
|
|
|
src/requesthandler/rpc/RequestResult.cpp
|
|
|
|
src/requesthandler/rpc/RequestResult.h
|
2023-10-10 21:31:57 +00:00
|
|
|
src/requesthandler/types/RequestBatchExecutionType.h
|
|
|
|
src/requesthandler/types/RequestStatus.h)
|
2023-03-04 20:57:51 +00:00
|
|
|
|
|
|
|
target_sources(
|
|
|
|
obs-websocket
|
2023-10-10 21:31:57 +00:00
|
|
|
PRIVATE # cmake-format: sortable
|
|
|
|
src/utils/Compat.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/utils/Compat.h
|
2022-07-25 14:48:06 +00:00
|
|
|
src/utils/Crypto.cpp
|
|
|
|
src/utils/Crypto.h
|
|
|
|
src/utils/Json.cpp
|
|
|
|
src/utils/Json.h
|
|
|
|
src/utils/Obs.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/utils/Obs.h
|
|
|
|
src/utils/Obs_ActionHelper.cpp
|
2022-07-25 14:48:06 +00:00
|
|
|
src/utils/Obs_ArrayHelper.cpp
|
2023-03-04 20:57:51 +00:00
|
|
|
src/utils/Obs_NumberHelper.cpp
|
2022-07-25 14:48:06 +00:00
|
|
|
src/utils/Obs_ObjectHelper.cpp
|
|
|
|
src/utils/Obs_SearchHelper.cpp
|
2023-10-10 21:31:57 +00:00
|
|
|
src/utils/Obs_StringHelper.cpp
|
2022-07-25 14:48:06 +00:00
|
|
|
src/utils/Obs_VolumeMeter.cpp
|
|
|
|
src/utils/Obs_VolumeMeter.h
|
|
|
|
src/utils/Obs_VolumeMeter_Helpers.h
|
|
|
|
src/utils/Platform.cpp
|
|
|
|
src/utils/Platform.h
|
2023-03-04 20:57:51 +00:00
|
|
|
src/utils/Utils.h)
|
|
|
|
|
2023-03-27 10:57:33 +00:00
|
|
|
configure_file(src/plugin-macros.h.in plugin-macros.generated.h)
|
|
|
|
target_sources(obs-websocket PRIVATE plugin-macros.generated.h)
|
2023-03-04 20:57:51 +00:00
|
|
|
|
|
|
|
target_compile_definitions(
|
2023-10-02 21:25:54 +00:00
|
|
|
obs-websocket PRIVATE ASIO_STANDALONE $<$<BOOL:${PLUGIN_TESTS}>:PLUGIN_TESTS>
|
2023-03-04 20:57:51 +00:00
|
|
|
$<$<PLATFORM_ID:Windows>:_WEBSOCKETPP_CPP11_STL_> $<$<PLATFORM_ID:Windows>:_WIN32_WINNT=0x0603>)
|
|
|
|
|
|
|
|
target_compile_options(
|
|
|
|
obs-websocket
|
2023-10-10 21:31:57 +00:00
|
|
|
PRIVATE $<$<PLATFORM_ID:Windows>:/wd4267>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,GNU,AppleClang,Clang>:-Wall>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,GNU,AppleClang,Clang>:-Wno-error=float-conversion>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,GNU,AppleClang,Clang>:-Wno-error=shadow>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-error=format-overflow>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-error=int-conversion>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-error=comment>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=null-pointer-subtraction>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=deprecated-declarations>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=implicit-int-conversion>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=shorten-64-to-32>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-comma>
|
|
|
|
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-quoted-include-in-framework-header>)
|
2023-03-04 20:57:51 +00:00
|
|
|
|
2022-07-25 14:48:06 +00:00
|
|
|
target_link_libraries(
|
|
|
|
obs-websocket
|
|
|
|
PRIVATE OBS::libobs
|
|
|
|
OBS::frontend-api
|
2022-07-26 20:13:01 +00:00
|
|
|
Qt::Core
|
|
|
|
Qt::Widgets
|
|
|
|
Qt::Svg
|
|
|
|
Qt::Network
|
2023-02-02 09:23:06 +00:00
|
|
|
nlohmann_json::nlohmann_json
|
|
|
|
Websocketpp::Websocketpp
|
2023-04-20 12:48:06 +00:00
|
|
|
Asio::Asio
|
2023-09-16 12:57:21 +00:00
|
|
|
qrcodegencpp::qrcodegencpp)
|
2021-03-08 11:56:43 +00:00
|
|
|
|
2023-10-10 21:31:57 +00:00
|
|
|
target_link_options(obs-websocket PRIVATE $<$<PLATFORM_ID:Windows>:/IGNORE:4099>)
|
|
|
|
|
2023-03-04 20:57:51 +00:00
|
|
|
set_target_properties_obs(
|
|
|
|
obs-websocket
|
|
|
|
PROPERTIES FOLDER plugins
|
|
|
|
PREFIX ""
|
|
|
|
AUTOMOC ON
|
|
|
|
AUTOUIC ON
|
|
|
|
AUTORCC ON)
|
2022-08-14 14:22:38 +00:00
|
|
|
|
2023-03-04 20:57:51 +00:00
|
|
|
if(OS_WINDOWS)
|
|
|
|
set_property(
|
|
|
|
TARGET obs-websocket
|
|
|
|
APPEND
|
|
|
|
PROPERTY AUTORCC_OPTIONS --format-version 1)
|
2021-03-08 11:56:43 +00:00
|
|
|
endif()
|