mirror of
https://github.com/PabloMK7/citra
synced 2024-11-15 05:08:23 +00:00
Fix compilation without ENABLE_WEB_SERVICE (#6856)
This commit is contained in:
parent
aaeba6759e
commit
0048e61fc7
9 changed files with 60 additions and 54 deletions
|
@ -57,6 +57,7 @@ CMAKE_DEPENDENT_OPTION(ENABLE_TESTS "Enable generating tests executable" ON "NOT
|
||||||
CMAKE_DEPENDENT_OPTION(ENABLE_DEDICATED_ROOM "Enable generating dedicated room executable" ON "NOT ANDROID AND NOT IOS" OFF)
|
CMAKE_DEPENDENT_OPTION(ENABLE_DEDICATED_ROOM "Enable generating dedicated room executable" ON "NOT ANDROID AND NOT IOS" OFF)
|
||||||
|
|
||||||
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
|
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
|
||||||
|
option(ENABLE_SCRIPTING "Enable RPC server for scripting" ON)
|
||||||
|
|
||||||
CMAKE_DEPENDENT_OPTION(ENABLE_CUBEB "Enables the cubeb audio backend" ON "NOT IOS" OFF)
|
CMAKE_DEPENDENT_OPTION(ENABLE_CUBEB "Enables the cubeb audio backend" ON "NOT IOS" OFF)
|
||||||
option(ENABLE_OPENAL "Enables the OpenAL audio backend" ON)
|
option(ENABLE_OPENAL "Enables the OpenAL audio backend" ON)
|
||||||
|
|
61
externals/CMakeLists.txt
vendored
61
externals/CMakeLists.txt
vendored
|
@ -173,37 +173,38 @@ endif()
|
||||||
add_library(json-headers INTERFACE)
|
add_library(json-headers INTERFACE)
|
||||||
target_include_directories(json-headers INTERFACE ./json)
|
target_include_directories(json-headers INTERFACE ./json)
|
||||||
|
|
||||||
|
# OpenSSL
|
||||||
|
if (USE_SYSTEM_OPENSSL)
|
||||||
|
find_package(OpenSSL 1.1)
|
||||||
|
if (OPENSSL_FOUND)
|
||||||
|
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT OPENSSL_FOUND)
|
||||||
|
# LibreSSL
|
||||||
|
set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "")
|
||||||
|
set(OPENSSLDIR "/etc/ssl/")
|
||||||
|
add_subdirectory(libressl EXCLUDE_FROM_ALL)
|
||||||
|
target_include_directories(ssl INTERFACE ./libressl/include)
|
||||||
|
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
|
||||||
|
get_directory_property(OPENSSL_LIBRARIES
|
||||||
|
DIRECTORY libressl
|
||||||
|
DEFINITION OPENSSL_LIBS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# httplib
|
||||||
|
add_library(httplib INTERFACE)
|
||||||
|
target_include_directories(httplib INTERFACE ./httplib)
|
||||||
|
target_compile_options(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
|
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES})
|
||||||
|
|
||||||
|
if(ANDROID)
|
||||||
|
add_subdirectory(android-ifaddrs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# cpp-jwt
|
||||||
if (ENABLE_WEB_SERVICE)
|
if (ENABLE_WEB_SERVICE)
|
||||||
if (USE_SYSTEM_OPENSSL)
|
|
||||||
find_package(OpenSSL 1.1)
|
|
||||||
if (OPENSSL_FOUND)
|
|
||||||
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT OPENSSL_FOUND)
|
|
||||||
# LibreSSL
|
|
||||||
set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "")
|
|
||||||
set(OPENSSLDIR "/etc/ssl/")
|
|
||||||
add_subdirectory(libressl EXCLUDE_FROM_ALL)
|
|
||||||
target_include_directories(ssl INTERFACE ./libressl/include)
|
|
||||||
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
|
|
||||||
get_directory_property(OPENSSL_LIBRARIES
|
|
||||||
DIRECTORY libressl
|
|
||||||
DEFINITION OPENSSL_LIBS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ANDROID)
|
|
||||||
add_subdirectory(android-ifaddrs)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# httplib
|
|
||||||
add_library(httplib INTERFACE)
|
|
||||||
target_include_directories(httplib INTERFACE ./httplib)
|
|
||||||
target_compile_options(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
|
||||||
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES})
|
|
||||||
|
|
||||||
# cpp-jwt
|
|
||||||
add_library(cpp-jwt INTERFACE)
|
add_library(cpp-jwt INTERFACE)
|
||||||
target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include)
|
target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include)
|
||||||
target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON)
|
target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON)
|
||||||
|
|
|
@ -461,14 +461,6 @@ add_library(citra_core STATIC
|
||||||
perf_stats.cpp
|
perf_stats.cpp
|
||||||
perf_stats.h
|
perf_stats.h
|
||||||
precompiled_headers.h
|
precompiled_headers.h
|
||||||
rpc/packet.cpp
|
|
||||||
rpc/packet.h
|
|
||||||
rpc/rpc_server.cpp
|
|
||||||
rpc/rpc_server.h
|
|
||||||
rpc/server.cpp
|
|
||||||
rpc/server.h
|
|
||||||
rpc/udp_server.cpp
|
|
||||||
rpc/udp_server.h
|
|
||||||
savestate.cpp
|
savestate.cpp
|
||||||
savestate.h
|
savestate.h
|
||||||
system_titles.cpp
|
system_titles.cpp
|
||||||
|
@ -483,18 +475,32 @@ add_library(citra_core STATIC
|
||||||
create_target_directory_groups(citra_core)
|
create_target_directory_groups(citra_core)
|
||||||
|
|
||||||
target_link_libraries(citra_core PUBLIC citra_common PRIVATE audio_core network video_core)
|
target_link_libraries(citra_core PUBLIC citra_common PRIVATE audio_core network video_core)
|
||||||
target_link_libraries(citra_core PRIVATE Boost::boost Boost::serialization Boost::iostreams)
|
target_link_libraries(citra_core PRIVATE Boost::boost Boost::serialization Boost::iostreams httplib)
|
||||||
target_link_libraries(citra_core PUBLIC dds-ktx PRIVATE cryptopp fmt::fmt lodepng open_source_archives)
|
target_link_libraries(citra_core PUBLIC dds-ktx PRIVATE cryptopp fmt::fmt lodepng open_source_archives)
|
||||||
set_target_properties(citra_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
set_target_properties(citra_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
||||||
if (ENABLE_WEB_SERVICE)
|
if (ENABLE_WEB_SERVICE)
|
||||||
target_compile_definitions(citra_core PRIVATE -DENABLE_WEB_SERVICE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
target_compile_definitions(citra_core PRIVATE -DENABLE_WEB_SERVICE)
|
||||||
target_link_libraries(citra_core PRIVATE web_service ${OPENSSL_LIBS} httplib)
|
target_link_libraries(citra_core PRIVATE web_service)
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
target_link_libraries(citra_core PRIVATE ifaddrs)
|
target_link_libraries(citra_core PRIVATE ifaddrs)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_SCRIPTING)
|
||||||
|
target_compile_definitions(citra_core PRIVATE -DENABLE_SCRIPTING)
|
||||||
|
target_sources(citra_core PRIVATE
|
||||||
|
rpc/packet.cpp
|
||||||
|
rpc/packet.h
|
||||||
|
rpc/rpc_server.cpp
|
||||||
|
rpc/rpc_server.h
|
||||||
|
rpc/server.cpp
|
||||||
|
rpc/server.h
|
||||||
|
rpc/udp_server.cpp
|
||||||
|
rpc/udp_server.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE)
|
if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE)
|
||||||
target_sources(citra_core PRIVATE
|
target_sources(citra_core PRIVATE
|
||||||
arm/dynarmic/arm_dynarmic.cpp
|
arm/dynarmic/arm_dynarmic.cpp
|
||||||
|
|
|
@ -45,7 +45,9 @@
|
||||||
#include "core/hw/lcd.h"
|
#include "core/hw/lcd.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "core/movie.h"
|
#include "core/movie.h"
|
||||||
|
#ifdef ENABLE_SCRIPTING
|
||||||
#include "core/rpc/server.h"
|
#include "core/rpc/server.h"
|
||||||
|
#endif
|
||||||
#include "core/telemetry_session.h"
|
#include "core/telemetry_session.h"
|
||||||
#include "network/network.h"
|
#include "network/network.h"
|
||||||
#include "video_core/custom_textures/custom_tex_manager.h"
|
#include "video_core/custom_textures/custom_tex_manager.h"
|
||||||
|
@ -418,7 +420,9 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window,
|
||||||
|
|
||||||
telemetry_session = std::make_unique<Core::TelemetrySession>();
|
telemetry_session = std::make_unique<Core::TelemetrySession>();
|
||||||
|
|
||||||
|
#ifdef ENABLE_SCRIPTING
|
||||||
rpc_server = std::make_unique<RPC::Server>(*this);
|
rpc_server = std::make_unique<RPC::Server>(*this);
|
||||||
|
#endif
|
||||||
|
|
||||||
service_manager = std::make_unique<Service::SM::ServiceManager>(*this);
|
service_manager = std::make_unique<Service::SM::ServiceManager>(*this);
|
||||||
archive_manager = std::make_unique<Service::FS::ArchiveManager>(*this);
|
archive_manager = std::make_unique<Service::FS::ArchiveManager>(*this);
|
||||||
|
@ -555,7 +559,9 @@ void System::Shutdown(bool is_deserializing) {
|
||||||
}
|
}
|
||||||
custom_tex_manager.reset();
|
custom_tex_manager.reset();
|
||||||
telemetry_session.reset();
|
telemetry_session.reset();
|
||||||
|
#ifdef ENABLE_SCRIPTING
|
||||||
rpc_server.reset();
|
rpc_server.reset();
|
||||||
|
#endif
|
||||||
archive_manager.reset();
|
archive_manager.reset();
|
||||||
service_manager.reset();
|
service_manager.reset();
|
||||||
dsp_core.reset();
|
dsp_core.reset();
|
||||||
|
|
|
@ -405,8 +405,10 @@ private:
|
||||||
/// Image interface
|
/// Image interface
|
||||||
std::shared_ptr<Frontend::ImageInterface> registered_image_interface;
|
std::shared_ptr<Frontend::ImageInterface> registered_image_interface;
|
||||||
|
|
||||||
|
#ifdef ENABLE_SCRIPTING
|
||||||
/// RPC Server for scripting support
|
/// RPC Server for scripting support
|
||||||
std::unique_ptr<RPC::Server> rpc_server;
|
std::unique_ptr<RPC::Server> rpc_server;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::unique_ptr<Service::FS::ArchiveManager> archive_manager;
|
std::unique_ptr<Service::FS::ArchiveManager> archive_manager;
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,6 @@ static std::pair<std::string, std::string> SplitUrl(const std::string& url) {
|
||||||
void Context::MakeRequest() {
|
void Context::MakeRequest() {
|
||||||
ASSERT(state == RequestState::NotStarted);
|
ASSERT(state == RequestState::NotStarted);
|
||||||
|
|
||||||
#ifdef ENABLE_WEB_SERVICE
|
|
||||||
const auto& [host, path] = SplitUrl(url);
|
const auto& [host, path] = SplitUrl(url);
|
||||||
const auto client = std::make_unique<httplib::Client>(host);
|
const auto client = std::make_unique<httplib::Client>(host);
|
||||||
SSL_CTX* ctx = client->ssl_context();
|
SSL_CTX* ctx = client->ssl_context();
|
||||||
|
@ -128,10 +127,6 @@ void Context::MakeRequest() {
|
||||||
// TODO(B3N30): Verify this state on HW
|
// TODO(B3N30): Verify this state on HW
|
||||||
state = RequestState::ReadyToDownloadContent;
|
state = RequestState::ReadyToDownloadContent;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
LOG_ERROR(Service_HTTP, "Tried to make request but WebServices is not enabled in this build");
|
|
||||||
state = RequestState::TimedOut;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTP_C::Initialize(Kernel::HLERequestContext& ctx) {
|
void HTTP_C::Initialize(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
|
@ -17,12 +17,10 @@
|
||||||
#include <boost/serialization/unordered_map.hpp>
|
#include <boost/serialization/unordered_map.hpp>
|
||||||
#include <boost/serialization/vector.hpp>
|
#include <boost/serialization/vector.hpp>
|
||||||
#include <boost/serialization/weak_ptr.hpp>
|
#include <boost/serialization/weak_ptr.hpp>
|
||||||
#ifdef ENABLE_WEB_SERVICE
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
#endif
|
#endif
|
||||||
#include <httplib.h>
|
#include <httplib.h>
|
||||||
#endif
|
|
||||||
#include "core/hle/kernel/shared_memory.h"
|
#include "core/hle/kernel/shared_memory.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
@ -217,9 +215,7 @@ public:
|
||||||
std::future<void> request_future;
|
std::future<void> request_future;
|
||||||
std::atomic<u64> current_download_size_bytes;
|
std::atomic<u64> current_download_size_bytes;
|
||||||
std::atomic<u64> total_download_size_bytes;
|
std::atomic<u64> total_download_size_bytes;
|
||||||
#ifdef ENABLE_WEB_SERVICE
|
|
||||||
httplib::Response response;
|
httplib::Response response;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SessionData : public Kernel::SessionRequestHandler::SessionDataBase {
|
struct SessionData : public Kernel::SessionRequestHandler::SessionDataBase {
|
||||||
|
|
|
@ -19,14 +19,14 @@ add_library(network STATIC
|
||||||
create_target_directory_groups(network)
|
create_target_directory_groups(network)
|
||||||
|
|
||||||
if (ENABLE_WEB_SERVICE)
|
if (ENABLE_WEB_SERVICE)
|
||||||
target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE)
|
||||||
target_link_libraries(network PRIVATE web_service httplib)
|
target_link_libraries(network PRIVATE web_service)
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
target_link_libraries(network PRIVATE ifaddrs)
|
target_link_libraries(network PRIVATE ifaddrs)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(network PRIVATE citra_common enet Boost::serialization)
|
target_link_libraries(network PRIVATE citra_common enet Boost::serialization httplib)
|
||||||
set_target_properties(network PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
set_target_properties(network PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
||||||
if (CITRA_USE_PRECOMPILED_HEADERS)
|
if (CITRA_USE_PRECOMPILED_HEADERS)
|
||||||
|
|
|
@ -16,7 +16,6 @@ add_library(web_service STATIC
|
||||||
|
|
||||||
create_target_directory_groups(web_service)
|
create_target_directory_groups(web_service)
|
||||||
|
|
||||||
target_compile_definitions(web_service PRIVATE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
|
||||||
target_link_libraries(web_service PRIVATE citra_common network json-headers httplib cpp-jwt)
|
target_link_libraries(web_service PRIVATE citra_common network json-headers httplib cpp-jwt)
|
||||||
target_link_libraries(web_service PUBLIC ${OPENSSL_LIBS})
|
target_link_libraries(web_service PUBLIC ${OPENSSL_LIBS})
|
||||||
set_target_properties(web_service PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
set_target_properties(web_service PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
Loading…
Reference in a new issue