cmake: Add option to enable scripting

This commit is contained in:
GPUCode
2023-08-05 15:59:19 +03:00
parent f166cbc35b
commit 1998a3d38e
5 changed files with 54 additions and 38 deletions

View File

@ -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)

View File

@ -173,7 +173,7 @@ 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)
if (ENABLE_WEB_SERVICE) # OpenSSL
if (USE_SYSTEM_OPENSSL) if (USE_SYSTEM_OPENSSL)
find_package(OpenSSL 1.1) find_package(OpenSSL 1.1)
if (OPENSSL_FOUND) if (OPENSSL_FOUND)
@ -193,17 +193,18 @@ if (ENABLE_WEB_SERVICE)
DEFINITION OPENSSL_LIBS) DEFINITION OPENSSL_LIBS)
endif() endif()
if(ANDROID)
add_subdirectory(android-ifaddrs)
endif()
# httplib # httplib
add_library(httplib INTERFACE) add_library(httplib INTERFACE)
target_include_directories(httplib INTERFACE ./httplib) target_include_directories(httplib INTERFACE ./httplib)
target_compile_options(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT) target_compile_options(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES}) target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES})
if(ANDROID)
add_subdirectory(android-ifaddrs)
endif()
# cpp-jwt # cpp-jwt
if (ENABLE_WEB_SERVICE)
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)

View File

@ -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
@ -495,6 +487,20 @@ if (ENABLE_WEB_SERVICE)
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

View File

@ -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();

View File

@ -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;