aboutsummaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2018-08-28 12:44:46 +0000
committerJan Beich <jbeich@FreeBSD.org>2018-08-28 12:44:46 +0000
commit87036016b6ef0d7dd3a8682c1414f2deb30e0c09 (patch)
treef325e95193722cd5f702076d8253e20e5dba997c /emulators
parentfd38697192c5b484b28fb0f74de82921b25406c4 (diff)
Notes
Diffstat (limited to 'emulators')
-rw-r--r--emulators/rpcs3/Makefile3
-rw-r--r--emulators/rpcs3/files/extra-patch-c++14104
2 files changed, 107 insertions, 0 deletions
diff --git a/emulators/rpcs3/Makefile b/emulators/rpcs3/Makefile
index f2044ce3daaa..fb04d17fc1ef 100644
--- a/emulators/rpcs3/Makefile
+++ b/emulators/rpcs3/Makefile
@@ -42,6 +42,9 @@ USE_QT= qmake_build buildtools_build core dbus gui network widgets qml
USE_XORG= x11
CMAKE_ON= CMAKE_SKIP_RPATH USE_SYSTEM_FFMPEG USE_SYSTEM_LIBPNG
CMAKE_OFF= USE_NATIVE_INSTRUCTIONS
+EXTRA_PATCHES+= ${EXTRA_PATCHES_${COMPILER_FEATURES:Mlib*}_${OPSYS}_${OSREL}}
+EXTRA_PATCHES_libc++_FreeBSD_10.4= ${PATCHDIR}/extra-patch-c++14
+EXTRA_PATCHES_libc++_FreeBSD_11.1= ${PATCHDIR}/extra-patch-c++14
CXXFLAGS+= -D_GLIBCXX_USE_C99 # XXX ports/193528
CXXFLAGS+= -Wno-macro-redefined # __STDC_*_MACROS sys/cdefs.h vs. llvm-config
LDFLAGS+= -Wl,--as-needed # GLU
diff --git a/emulators/rpcs3/files/extra-patch-c++14 b/emulators/rpcs3/files/extra-patch-c++14
new file mode 100644
index 000000000000..5cbc8b8a2161
--- /dev/null
+++ b/emulators/rpcs3/files/extra-patch-c++14
@@ -0,0 +1,104 @@
+Downgrade to C++14 as libc++ < 5 doesn't support std::byte
+
+--- Utilities/BEType.h.orig 2018-08-27 18:53:45 UTC
++++ Utilities/BEType.h
+@@ -334,10 +334,14 @@ inline v128 operator~(const v128& other)
+ template <typename T, std::size_t Align, std::size_t Size>
+ struct se_storage
+ {
++#if __cplusplus < 201703L
++ using type = std::aligned_storage_t<Size, Align>;
++#else
+ struct type
+ {
+ alignas(Align) std::byte data[Size];
+ };
++#endif
+
+ // Unoptimized generic byteswap for unaligned data
+ static void reverse(u8* dst, const u8* src)
+--- Utilities/types.h.orig 2018-08-27 18:53:45 UTC
++++ Utilities/types.h
+@@ -91,7 +91,11 @@ using steady_clock = std::conditional<
+
+ namespace gsl
+ {
++#if __cplusplus < 201703L
++ enum class byte : u8;
++#else
+ using std::byte;
++#endif
+ }
+
+ // Formatting helper, type-specific preprocessing for improving safety and functionality
+@@ -120,6 +124,8 @@ class atomic_t;
+
+ #if defined(__INTELLISENSE__) && !defined(_MSC_VER)
+ namespace std { template <typename...> using void_t = void; }
++#elif defined(_LIBCPP_VERSION) && __cplusplus < 201703L
++namespace std { template <class...> using void_t = void; }
+ #endif
+
+ // Extract T::simple_type if available, remove cv qualifiers
+@@ -770,7 +776,11 @@ struct value_hash
+ template <template <typename> class TT, std::size_t S, std::size_t A = S>
+ struct alignas(A) any_pod
+ {
++#if __cplusplus < 201703L
++ std::aligned_storage_t<S, A> data;
++#else
+ alignas(A) std::byte data[S];
++#endif
+
+ any_pod() = default;
+
+--- rpcs3/CMakeLists.txt.orig 2018-08-27 18:53:45 UTC
++++ rpcs3/CMakeLists.txt
+@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1)
+
+ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
+ set(RES_FILES "")
+-set(CMAKE_CXX_STANDARD 17)
++set(CMAKE_CXX_STANDARD 14)
+ include(CheckCXXCompilerFlag)
+
+ # Qt section
+--- rpcs3/Emu/RSX/rsx_utils.h.orig 2018-08-27 18:53:45 UTC
++++ rpcs3/Emu/RSX/rsx_utils.h
+@@ -6,7 +6,19 @@
+ #include <atomic>
+ #include <memory>
+ #include <bitset>
++#if __cplusplus < 201703L
++#include <optional.hpp>
++#else
+ #include <optional>
++#endif
++
++#if __cplusplus < 201703L
++namespace std
++{
++ template<class T>
++ using optional = experimental::optional<T>;
++}
++#endif
+
+ extern "C"
+ {
+--- rpcs3/stdafx.h.orig 2018-08-27 18:53:45 UTC
++++ rpcs3/stdafx.h
+@@ -45,3 +45,14 @@ namespace std { inline namespace literals { inline nam
+ #include <algorithm>
+
+ using namespace std::literals;
++
++#if __cplusplus < 201703L
++namespace std
++{
++ template<typename T>
++ constexpr const T clamp(const T value, const T min, const T max)
++ {
++ return value < min ? min : value > max ? max : value;
++ }
++}
++#endif