Merge branch 'httpc' into online

This commit is contained in:
PabloMK7 2023-10-07 12:39:44 +02:00
commit 8260d5527e
4 changed files with 20 additions and 19 deletions

View file

@ -96,6 +96,7 @@ option(USE_SYSTEM_LIBUSB "Use the system libusb (instead of the bundled libusb)"
option(USE_SYSTEM_CPP_JWT "Use the system cpp-jwt (instead of the bundled one)" OFF) option(USE_SYSTEM_CPP_JWT "Use the system cpp-jwt (instead of the bundled one)" OFF)
option(USE_SYSTEM_SOUNDTOUCH "Use the system SoundTouch (instead of the bundled one)" OFF) option(USE_SYSTEM_SOUNDTOUCH "Use the system SoundTouch (instead of the bundled one)" OFF)
option(USE_SYSTEM_CPP_HTTPLIB "Use the system cpp-httplib (instead of the bundled one)" OFF) option(USE_SYSTEM_CPP_HTTPLIB "Use the system cpp-httplib (instead of the bundled one)" OFF)
option(USE_SYSTEM_JSON "Use the system JSON (nlohmann-json3) package (instead of the bundled one)" OFF)
if (CITRA_USE_PRECOMPILED_HEADERS) if (CITRA_USE_PRECOMPILED_HEADERS)
message(STATUS "Using Precompiled Headers.") message(STATUS "Using Precompiled Headers.")

View file

@ -175,7 +175,16 @@ endif()
# JSON # JSON
add_library(json-headers INTERFACE) add_library(json-headers INTERFACE)
target_include_directories(json-headers INTERFACE ./json) if (USE_SYSTEM_JSON)
find_package(nlohmann_json REQUIRED)
target_link_libraries(json-headers INTERFACE nlohmann_json::nlohmann_json)
get_target_property(NLOHMANN_PREFIX nlohmann_json::nlohmann_json INTERFACE_INCLUDE_DIRECTORIES)
# The nlohmann-json3 package expects "#include <nlohmann/json.hpp>"
# Citra uses "#include <json.hpp>" so we have to add this manually
target_include_directories(json-headers SYSTEM INTERFACE "${NLOHMANN_PREFIX}/nlohmann")
else()
target_include_directories(json-headers SYSTEM INTERFACE ./json)
endif()
# OpenSSL # OpenSSL
if (USE_SYSTEM_OPENSSL) if (USE_SYSTEM_OPENSSL)
@ -200,8 +209,13 @@ endif()
# httplib # httplib
add_library(httplib INTERFACE) add_library(httplib INTERFACE)
if(USE_SYSTEM_CPP_HTTPLIB) if(USE_SYSTEM_CPP_HTTPLIB)
find_package(CppHttp REQUIRED) find_package(CppHttp 0.14.1)
if(CppHttp_FOUND)
target_link_libraries(httplib SYSTEM INTERFACE cpp-httplib::cpp-httplib) target_link_libraries(httplib SYSTEM INTERFACE cpp-httplib::cpp-httplib)
else()
message(STATUS "Cpp-httplib not found or not suitable version! Falling back to bundled...")
target_include_directories(httplib SYSTEM INTERFACE ./httplib)
endif()
else() else()
target_include_directories(httplib SYSTEM INTERFACE ./httplib) target_include_directories(httplib SYSTEM INTERFACE ./httplib)
endif() endif()

View file

@ -15,13 +15,7 @@ if(NOT CppHttp_FOUND)
/usr/local/lib /usr/local/lib
) )
if(CPP-HTTP_INCLUDE_DIR AND CPP-HTTP_LIBRARIES) find_package_handle_standard_args(CppHttp REQUIRED_VARS CPP-HTTP_INCLUDE_DIR CPP-HTTP_LIBRARIES VERSION_VAR HTTP_TMP_VERSION)
set(CppHttp_FOUND TRUE CACHE INTERNAL "cpp-httplib found")
message(STATUS "Found cpp-httplib: ${CPP-HTTP_INCLUDE_DIR}, ${CPP-HTTP_LIBRARIES}")
else()
set(CppHttp_FOUND FALSE CACHE INTERNAL "cpp-httplib found")
message(STATUS "Cpp-httplib not found.")
endif()
endif() endif()

View file

@ -828,13 +828,6 @@ private:
void Generate() { void Generate() {
if (sanitize_mul) { if (sanitize_mul) {
#ifdef ANDROID
// Use a cheaper sanitize_mul on Android, as mobile GPUs struggle here
// This seems to be sufficient at least for Ocarina of Time and Attack on Titan accurate
// multiplication bugs
shader.AddLine(
"#define sanitize_mul(lhs, rhs) mix(lhs * rhs, vec4(0.0), isnan(lhs * rhs))");
#else
shader.AddLine("vec4 sanitize_mul(vec4 lhs, vec4 rhs) {{"); shader.AddLine("vec4 sanitize_mul(vec4 lhs, vec4 rhs) {{");
++shader.scope; ++shader.scope;
shader.AddLine("vec4 product = lhs * rhs;"); shader.AddLine("vec4 product = lhs * rhs;");
@ -842,7 +835,6 @@ private:
"isnan(lhs)), isnan(product));"); "isnan(lhs)), isnan(product));");
--shader.scope; --shader.scope;
shader.AddLine("}}\n"); shader.AddLine("}}\n");
#endif
} }
shader.AddLine("vec4 get_offset_register(int base_index, int offset) {{"); shader.AddLine("vec4 get_offset_register(int base_index, int offset) {{");