mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 03:18:55 +02:00
[cmake, deps] conjure common/httplib.h and remove global def for httplib macros (#3800)
httplib stuff done by @crueter on #3797 + some extra stuff since the warning push/pop should be in header i fear :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3800 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
148dc7b480
commit
1f787ffc39
12 changed files with 36 additions and 34 deletions
9
externals/CMakeLists.txt
vendored
9
externals/CMakeLists.txt
vendored
|
|
@ -62,6 +62,12 @@ endif()
|
||||||
# unordered_dense
|
# unordered_dense
|
||||||
AddJsonPackage(unordered-dense)
|
AddJsonPackage(unordered-dense)
|
||||||
|
|
||||||
|
# httplib
|
||||||
|
if (IOS)
|
||||||
|
set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF)
|
||||||
|
endif()
|
||||||
|
AddJsonPackage(httplib)
|
||||||
|
|
||||||
if (YUZU_STATIC_ROOM)
|
if (YUZU_STATIC_ROOM)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -227,9 +233,6 @@ if (VulkanMemoryAllocator_ADDED)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# httplib
|
|
||||||
AddJsonPackage(httplib)
|
|
||||||
|
|
||||||
# cpp-jwt
|
# cpp-jwt
|
||||||
if (ENABLE_WEB_SERVICE OR ENABLE_UPDATE_CHECKER)
|
if (ENABLE_WEB_SERVICE OR ENABLE_UPDATE_CHECKER)
|
||||||
AddJsonPackage(cpp-jwt)
|
AddJsonPackage(cpp-jwt)
|
||||||
|
|
|
||||||
3
externals/cpmfile.json
vendored
3
externals/cpmfile.json
vendored
|
|
@ -36,7 +36,8 @@
|
||||||
"0002-fix-zstd.patch"
|
"0002-fix-zstd.patch"
|
||||||
],
|
],
|
||||||
"options": [
|
"options": [
|
||||||
"HTTPLIB_REQUIRE_OPENSSL ON"
|
"HTTPLIB_REQUIRE_OPENSSL ON",
|
||||||
|
"HTTPLIB_DISABLE_MACOSX_AUTOMATIC_ROOT_CERTIFICATES ON"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"cpp-jwt": {
|
"cpp-jwt": {
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,8 @@ add_library(
|
||||||
zstd_compression.cpp
|
zstd_compression.cpp
|
||||||
zstd_compression.h
|
zstd_compression.h
|
||||||
fs/ryujinx_compat.h fs/ryujinx_compat.cpp
|
fs/ryujinx_compat.h fs/ryujinx_compat.cpp
|
||||||
fs/symlink.h fs/symlink.cpp)
|
fs/symlink.h fs/symlink.cpp
|
||||||
|
httplib.h)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(common PRIVATE windows/timer_resolution.cpp
|
target_sources(common PRIVATE windows/timer_resolution.cpp
|
||||||
|
|
@ -244,7 +245,7 @@ else()
|
||||||
target_link_libraries(common PUBLIC Boost::headers)
|
target_link_libraries(common PUBLIC Boost::headers)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(common PUBLIC Boost::filesystem Boost::context)
|
target_link_libraries(common PUBLIC Boost::filesystem Boost::context httplib::httplib)
|
||||||
|
|
||||||
if (lz4_ADDED)
|
if (lz4_ADDED)
|
||||||
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
|
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
|
||||||
|
|
|
||||||
18
src/common/httplib.h
Normal file
18
src/common/httplib.h
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define CPPHTTPLIB_DISABLE_MACOSX_AUTOMATIC_ROOT_CERTIFICATES 1
|
||||||
|
#define CPPHTTPLIB_OPENSSL_SUPPORT 1
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#ifndef __clang__
|
||||||
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#include <httplib.h>
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
@ -1269,7 +1269,6 @@ endif()
|
||||||
target_sources(core PRIVATE hle/service/ssl/ssl_backend_openssl.cpp)
|
target_sources(core PRIVATE hle/service/ssl/ssl_backend_openssl.cpp)
|
||||||
|
|
||||||
target_link_libraries(core PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(core PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
target_compile_definitions(core PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,7 @@
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
#include "common/httplib.h"
|
||||||
#include <httplib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
@ -103,8 +101,6 @@ std::vector<u8> TryLoadFromDisk(const std::filesystem::path& path) {
|
||||||
|
|
||||||
std::vector<u8> DownloadImage(const std::string& url_path, const std::filesystem::path& cache_path) {
|
std::vector<u8> DownloadImage(const std::string& url_path, const std::filesystem::path& cache_path) {
|
||||||
LOG_INFO(Service_BCAT, "Downloading image: https://eden-emu.dev{}", url_path);
|
LOG_INFO(Service_BCAT, "Downloading image: https://eden-emu.dev{}", url_path);
|
||||||
|
|
||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
|
||||||
try {
|
try {
|
||||||
httplib::Client cli("https://eden-emu.dev");
|
httplib::Client cli("https://eden-emu.dev");
|
||||||
cli.set_follow_location(true);
|
cli.set_follow_location(true);
|
||||||
|
|
@ -128,8 +124,6 @@ std::vector<u8> DownloadImage(const std::string& url_path, const std::filesystem
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
LOG_WARNING(Service_BCAT, "Failed to download: {}", url_path);
|
LOG_WARNING(Service_BCAT, "Failed to download: {}", url_path);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -232,8 +226,6 @@ void WriteCachedJson(std::string_view json) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> DownloadReleasesJson() {
|
std::optional<std::string> DownloadReleasesJson() {
|
||||||
|
|
||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
|
||||||
try {
|
try {
|
||||||
httplib::SSLClient cli{"api.github.com", 443};
|
httplib::SSLClient cli{"api.github.com", 443};
|
||||||
cli.set_connection_timeout(10);
|
cli.set_connection_timeout(10);
|
||||||
|
|
@ -255,7 +247,6 @@ std::optional<std::string> DownloadReleasesJson() {
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
LOG_WARNING(Service_BCAT, " failed to download releases");
|
LOG_WARNING(Service_BCAT, " failed to download releases");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ if (ENABLE_UPDATE_CHECKER)
|
||||||
target_sources(frontend_common PRIVATE
|
target_sources(frontend_common PRIVATE
|
||||||
update_checker.cpp
|
update_checker.cpp
|
||||||
update_checker.h)
|
update_checker.h)
|
||||||
|
|
||||||
target_compile_definitions(frontend_common PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
|
|
||||||
target_link_libraries(frontend_common PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(frontend_common PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "update_checker.h"
|
#include "update_checker.h"
|
||||||
|
|
||||||
#include <httplib.h>
|
#include "common/httplib.h"
|
||||||
|
|
||||||
#ifdef YUZU_BUNDLED_OPENSSL
|
#ifdef YUZU_BUNDLED_OPENSSL
|
||||||
#include <openssl/cert.h>
|
#include <openssl/cert.h>
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ if (USE_DISCORD_PRESENCE)
|
||||||
|
|
||||||
if (YUZU_USE_BUNDLED_OPENSSL)
|
if (YUZU_USE_BUNDLED_OPENSSL)
|
||||||
target_link_libraries(qt_common PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(qt_common PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
||||||
target_compile_definitions(qt_common PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(qt_common PUBLIC USE_DISCORD_PRESENCE)
|
target_compile_definitions(qt_common PUBLIC USE_DISCORD_PRESENCE)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <httplib.h>
|
#include "common/httplib.h"
|
||||||
|
|
||||||
#include <discord_rpc.h>
|
#include <discord_rpc.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
|
# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
@ -19,4 +22,3 @@ target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
target_link_libraries(web_service PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(web_service PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
target_compile_definitions(web_service PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
|
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <fmt/ranges.h>
|
#include <fmt/ranges.h>
|
||||||
|
#include "common/httplib.h"
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#ifndef __clang__
|
|
||||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#include <httplib.h>
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef YUZU_BUNDLED_OPENSSL
|
#ifdef YUZU_BUNDLED_OPENSSL
|
||||||
#include <openssl/cert.h>
|
#include <openssl/cert.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue