更新编译依赖
This commit is contained in:
parent
141f5b5b13
commit
7799407a67
@ -13,6 +13,7 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_compile_definitions(GLIB_DISABLE_DEPRECATION_WARNINGS)
|
||||
add_compile_definitions(ASIO_STANDALONE)
|
||||
|
||||
# 输出目录
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
|
||||
@ -23,10 +24,10 @@ pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
|
||||
|
||||
# include 路径
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/third_party/include/websocketpp
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/third_party/include
|
||||
${CMAKE_SOURCE_DIR}/third_party/include/paho_mqtt
|
||||
${CMAKE_SOURCE_DIR}/third_party/asio/include
|
||||
${GSTREAMER_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
)
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef ASIO_STANDALONE
|
||||
#define ASIO_STANDALONE
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
@ -7,7 +11,6 @@
|
||||
#include <websocketpp/client.hpp>
|
||||
#include <websocketpp/config/asio_no_tls_client.hpp>
|
||||
|
||||
// websocketpp 客户端类型
|
||||
using ws_client = websocketpp::client<websocketpp::config::asio_client>;
|
||||
|
||||
class TunnelClient
|
||||
@ -20,11 +23,7 @@ class TunnelClient
|
||||
|
||||
private:
|
||||
void run_loop();
|
||||
|
||||
// 处理 Server 的 JSON 请求(GET / POST / 大文件流)
|
||||
void handle_request_and_reply(const nlohmann::json& req);
|
||||
|
||||
// 线程安全发送函数
|
||||
void send_text_safe(const std::string& s);
|
||||
void send_binary_safe(const void* data, size_t len);
|
||||
|
||||
@ -36,7 +35,6 @@ class TunnelClient
|
||||
std::atomic<bool> running_{false};
|
||||
std::thread th_;
|
||||
|
||||
// websocketpp
|
||||
ws_client* client_ = nullptr;
|
||||
websocketpp::connection_hdl hdl_;
|
||||
};
|
||||
@ -1,3 +1,7 @@
|
||||
#ifndef ASIO_STANDALONE
|
||||
#define ASIO_STANDALONE
|
||||
#endif
|
||||
|
||||
#include "tunnel_client.hpp"
|
||||
|
||||
#include <atomic>
|
||||
@ -8,14 +12,11 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <websocketpp/client.hpp>
|
||||
#include <websocketpp/config/asio_no_tls_client.hpp>
|
||||
|
||||
#include "httplib.h"
|
||||
#include "logger.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
using ws_client = websocketpp::client<websocketpp::config::asio_client>;
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -30,7 +31,6 @@ static bool looks_binary_content_type(const std::string& ct)
|
||||
return false;
|
||||
}
|
||||
|
||||
// 小工具:拼 log 字符串
|
||||
static inline std::string kv(const std::string& k, const std::string& v) { return k + "=" + v; }
|
||||
static inline std::string kv(const std::string& k, int v) { return k + "=" + std::to_string(v); }
|
||||
|
||||
|
||||
1
third_party/asio
vendored
Submodule
1
third_party/asio
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit bd500f0a018db9a845ebaaed5c0318343ae9f497
|
||||
Loading…
Reference in New Issue
Block a user