-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(websocket): Change library to websocketpp
obs-studio release doesn't carrying with QWebSocket library. Before we build our own one and distribute. But QT libraries cannot compatible across version. So everytime obs-studio upgrade their QT version, we need to recompile and distribute QWebSockets. After changing to websocketpp, we won't carrying QWebSockets and the version of our plugins can suit obs version more widely. Signed-off-by: Yibai Zhang <xm1994@gmail.com>
- Loading branch information
1 parent
cf07914
commit 3209c94
Showing
22 changed files
with
625 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,6 @@ | |
# ignore generated files | ||
*.generated.* | ||
**/.Brewfile.lock.json | ||
|
||
CMakeUserPresets.json | ||
build/generated/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#[=======================================================================[.rst | ||
FindAsio | ||
---------- | ||
|
||
FindModule for Asio and the associated library | ||
|
||
Imported Targets | ||
^^^^^^^^^^^^^^^^ | ||
|
||
.. versionadded:: 2.0 | ||
|
||
This module defines the :prop_tgt:`IMPORTED` target ``Asio::Asio``. | ||
|
||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
|
||
This module sets the following variables: | ||
|
||
``Asio_FOUND`` | ||
True, if the library was found. | ||
``Asio_VERSION`` | ||
Detected version of found Asio library. | ||
|
||
Cache variables | ||
^^^^^^^^^^^^^^^ | ||
|
||
The following cache variables may also be set: | ||
|
||
``Asio_INCLUDE_DIR`` | ||
Directory containing ``asio.hpp``. | ||
|
||
#]=======================================================================] | ||
|
||
# cmake-format: off | ||
# cmake-lint: disable=C0103 | ||
# cmake-lint: disable=C0301 | ||
# cmake-format: on | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_search_module(PC_Asio QUIET asio) | ||
endif() | ||
|
||
find_path( | ||
Asio_INCLUDE_DIR | ||
NAMES asio.hpp | ||
HINTS ${PC_Asio_INCLUDE_DIRS} | ||
PATHS /usr/include /usr/local/include | ||
DOC "Asio include directory") | ||
|
||
if(PC_Asio_VERSION VERSION_GREATER 0) | ||
set(Asio_VERSION ${PC_Asio_VERSION}) | ||
elseif(EXISTS "${Asio_INCLUDE_DIR}/asio/version.hpp") | ||
file(STRINGS "${Asio_INCLUDE_DIR}/asio/version.hpp" _version_string | ||
REGEX "#define[ \t]+ASIO_VERSION[ \t]+[0-9]+[ \t]+\/\/[ \t][0-9]+\.[0-9]+\.[0-9]+") | ||
|
||
string(REGEX REPLACE "#define[ \t]+ASIO_VERSION[ \t]+[0-9]+[ \t]+\/\/[ \t]([0-9]+\.[0-9]+\.[0-9]+)" "\\1" | ||
Asio_VERSION "${_version_string}") | ||
else() | ||
if(NOT Asio_FIND_QUIETLY) | ||
message(AUTHOR_WARNING "Failed to find Asio version.") | ||
endif() | ||
set(Asio_VERSION 0.0.0) | ||
endif() | ||
|
||
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") | ||
set(Asio_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") | ||
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") | ||
set(Asio_ERROR_REASON "Ensure Asio library is available in local include paths.") | ||
endif() | ||
|
||
find_package_handle_standard_args( | ||
Asio | ||
REQUIRED_VARS Asio_INCLUDE_DIR | ||
VERSION_VAR Asio_VERSION REASON_FAILURE_MESSAGE "${Asio_ERROR_REASON}") | ||
mark_as_advanced(Asio_INCLUDE_DIR) | ||
unset(Asio_ERROR_REASON) | ||
|
||
if(Asio_FOUND) | ||
if(NOT TARGET Asio::Asio) | ||
add_library(Asio::Asio INTERFACE IMPORTED) | ||
set_target_properties(Asio::Asio PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Asio_INCLUDE_DIR}") | ||
endif() | ||
endif() | ||
|
||
include(FeatureSummary) | ||
set_package_properties( | ||
Asio PROPERTIES | ||
URL "http://think-async.com/Asio" | ||
DESCRIPTION | ||
"Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#[=======================================================================[.rst | ||
FindWebsocketpp | ||
---------- | ||
|
||
FindModule for WebSocket++ and the associated library | ||
|
||
Imported Targets | ||
^^^^^^^^^^^^^^^^ | ||
|
||
.. versionadded:: 2.0 | ||
|
||
This module defines the :prop_tgt:`IMPORTED` target ``Websocketpp::Websocketpp``. | ||
|
||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
|
||
This module sets the following variables: | ||
|
||
``Websocketpp_FOUND`` | ||
True, if the library was found. | ||
``Websocketpp_VERSION`` | ||
Detected version of found Websocketpp library. | ||
|
||
Cache variables | ||
^^^^^^^^^^^^^^^ | ||
|
||
The following cache variables may also be set: | ||
|
||
``Websocketpp_INCLUDE_DIR`` | ||
Directory containing ``websocketpp/client.hpp``. | ||
|
||
#]=======================================================================] | ||
|
||
# cmake-format: off | ||
# cmake-lint: disable=C0103 | ||
# cmake-lint: disable=C0301 | ||
# cmake-format: on | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_path( | ||
Websocketpp_INCLUDE_DIR | ||
NAMES websocketpp/client.hpp | ||
PATHS /usr/include /usr/local/include | ||
DOC "WebSocket++ include directory") | ||
|
||
if(EXISTS "${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp") | ||
file(STRINGS "${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp" _version_string | ||
REGEX "^.*(major|minor|patch)_version[ \t]+=[ \t]+[0-9]+") | ||
|
||
string(REGEX REPLACE ".*major_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_major "${_version_string}") | ||
string(REGEX REPLACE ".*minor_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_minor "${_version_string}") | ||
string(REGEX REPLACE ".*patch_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_patch "${_version_string}") | ||
|
||
set(Websocketpp_VERSION "${_version_major}.${_version_minor}.${_version_patch}") | ||
unset(_version_major) | ||
unset(_version_minor) | ||
unset(_version_patch) | ||
else() | ||
if(NOT Websocketpp_FIND_QUIETLY) | ||
message(AUTHOR_WARNING "Failed to find WebSocket++ version.") | ||
endif() | ||
set(Websocketpp_VERSION 0.0.0) | ||
endif() | ||
|
||
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") | ||
set(Websocketpp_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") | ||
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") | ||
set(Websocketpp_ERROR_REASON "Ensure WebSocket++ library is available in local include paths.") | ||
endif() | ||
|
||
find_package_handle_standard_args( | ||
Websocketpp | ||
REQUIRED_VARS Websocketpp_INCLUDE_DIR | ||
VERSION_VAR Websocketpp_VERSION REASON_FAILURE_MESSAGE "${Websocketpp_ERROR_REASON}") | ||
mark_as_advanced(Websocketpp_INCLUDE_DIR) | ||
unset(Websocketpp_ERROR_REASON) | ||
|
||
if(Websocketpp_FOUND) | ||
if(NOT TARGET Websocketpp::Websocketpp) | ||
add_library(Websocketpp::Websocketpp INTERFACE IMPORTED) | ||
set_target_properties(Websocketpp::Websocketpp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES | ||
"${Websocketpp_INCLUDE_DIR}") | ||
endif() | ||
endif() | ||
|
||
include(FeatureSummary) | ||
set_package_properties( | ||
Websocketpp PROPERTIES | ||
URL "https://www.zaphoyd.com/websocketpp/" | ||
DESCRIPTION "WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket Protocol.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[requires] | ||
libcurl/8.4.0 | ||
openssl/3.1.4 | ||
[generators] | ||
CMakeDeps | ||
CMakeToolchain | ||
[layout] | ||
cmake_layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
QWebsocketpp | ||
Copyright (C) 2019-2023 Yibai Zhang | ||
|
||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; If not, see <https://www.gnu.org/licenses/> | ||
*/ | ||
|
||
#include "QWebsocketpp.h" |
Oops, something went wrong.