mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-11 04:35:05 +01:00
Fix build on platforms without std::string_view
json.hpp wants it, but it isn't always available. Rather than patch json.hpp directly to remove the dependency, provide a json.h wrapper header that subs in std::experimental::string_view using preprocessor magic. All the consumers of json.hpp are in src/web_service, so the wrapper header is placed there as well.
This commit is contained in:
parent
fd79b70a87
commit
93fd55249b
@ -3,9 +3,9 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <future>
|
||||
#include <json.hpp>
|
||||
#include "common/logging/log.h"
|
||||
#include "web_service/announce_room_json.h"
|
||||
#include "web_service/json.h"
|
||||
#include "web_service/web_backend.h"
|
||||
|
||||
namespace AnnounceMultiplayerRoom {
|
||||
|
18
src/web_service/json.h
Normal file
18
src/web_service/json.h
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
// This hack is needed to support json.hpp on platforms where the C++17 stdlib
|
||||
// lacks std::string_view. See https://github.com/nlohmann/json/issues/735.
|
||||
// clang-format off
|
||||
#if !__has_include(<string_view>) && __has_include(<experimental/string_view>)
|
||||
# include <experimental/string_view>
|
||||
# define string_view experimental::string_view
|
||||
# include <json.hpp>
|
||||
# undef string_view
|
||||
#else
|
||||
# include <json.hpp>
|
||||
#endif
|
||||
// clang-format on
|
@ -7,9 +7,9 @@
|
||||
#include <array>
|
||||
#include <future>
|
||||
#include <string>
|
||||
#include <json.hpp>
|
||||
#include "common/announce_multiplayer_room.h"
|
||||
#include "common/telemetry.h"
|
||||
#include "web_service/json.h"
|
||||
|
||||
namespace WebService {
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <json.hpp>
|
||||
#include "web_service/json.h"
|
||||
#include "web_service/verify_login.h"
|
||||
#include "web_service/web_backend.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user