From 9018fc9f5a334a974d28e637c0f250060b9c7a26 Mon Sep 17 00:00:00 2001 From: monktan89 Date: Fri, 27 Sep 2024 15:34:04 +0800 Subject: [PATCH] Fixed the compilation issue on macOS15 M platform --- src/Util/util.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Util/util.cpp b/src/Util/util.cpp index 05c0d015..20996cc6 100644 --- a/src/Util/util.cpp +++ b/src/Util/util.cpp @@ -583,15 +583,19 @@ bool setThreadAffinity(int i) { return false; } +#if defined(__MACH__) || defined(__APPLE__) +#include +#include /* _NSGetExecutablePath */ +#endif + #ifndef HAS_CXA_DEMANGLE // We only support some compilers that support __cxa_demangle. -// TODO: Checks if Android NDK has fixed this issue or not. -#if defined(__ANDROID__) && (defined(__i386__) || defined(__x86_64__)) +// TODO: Check if Android NDK has fixed this issue or not. +#if defined(ANDROID) && (defined(i386) || defined(x86_64)) #define HAS_CXA_DEMANGLE 0 -#elif (__GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4)) && \ - !defined(__mips__) +#elif (GNUC >= 4 || (GNUC >= 3 && GNUC_MINOR >= 4)) && !defined(mips) #define HAS_CXA_DEMANGLE 1 -#elif defined(__clang__) && !defined(_MSC_VER) +#elif defined(clang) && !defined(_MSC_VER) #define HAS_CXA_DEMANGLE 1 #else #define HAS_CXA_DEMANGLE 0