From 2fbe11a8259011591fb59fee2970754e2ce19cdb Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 7 Aug 2026 03:17:22 +0000 Subject: [PATCH 25/38] gpu (Apple): guard Metal driver-version/device detection by macOS version Metal isn't available before 10.11/10.13; wrap the affected code paths in MAC_OS_X_VERSION_MIN_REQUIRED checks so the file still builds and degrades gracefully on older targets. Ported from https://github.com/macos-powerpc/powerpc-ports/blob/main/sysutils/fastfetch/files/0004-gpu_apple.-fix-for-older-systems.patch --- src/detection/gpu/gpu_apple.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/detection/gpu/gpu_apple.m b/src/detection/gpu/gpu_apple.m index 24ede6de2..c1426b9d1 100644 --- a/src/detection/gpu/gpu_apple.m +++ b/src/detection/gpu/gpu_apple.m @@ -1,5 +1,7 @@ +#include #include "gpu.h" +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 #import #import @@ -13,9 +15,11 @@ #define MTLFeatureSet_macOS_GPUFamily1_v4 ((MTLFeatureSet) 10004) #define MTLFeatureSet_macOS_GPUFamily2_v1 ((MTLFeatureSet) 10005) #endif +#endif const char* ffGpuDetectDriverVersion(FFlist* gpus) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (@available(macOS 10.7, *)) { NSMutableArray* arr = NSMutableArray.new; @@ -34,11 +38,13 @@ const char* ffGpuDetectDriverVersion(FFlist* gpus) } return nullptr; } +#endif return "Unsupported macOS version"; } const char* ffGpuDetectMetal(FFlist* gpus) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 if (@available(macOS 10.13, *)) { for (id device in MTLCopyAllDevices()) @@ -83,5 +89,6 @@ const char* ffGpuDetectMetal(FFlist* gpus) } return nullptr; } +#endif return "Metal API is not supported by this macOS version"; } -- 2.43.0