mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Fix build on apple
This commit is contained in:
+12
-15
@@ -315,22 +315,19 @@ ff_lib_enable(GLX glx)
|
||||
ff_lib_enable(OSMESA osmesa)
|
||||
ff_lib_enable(OPENCL OpenCL)
|
||||
|
||||
function(ff_framwork_enable LIBNAME)
|
||||
if(NOT APPLE)
|
||||
return()
|
||||
endif()
|
||||
if(APPLE)
|
||||
target_link_libraries(libfastfetch
|
||||
PRIVATE "-framework CoreFoundation"
|
||||
PRIVATE "-framework IOKit"
|
||||
PRIVATE "-framework CoreGraphics"
|
||||
PRIVATE "-framework OpenGL"
|
||||
PRIVATE "-framework OpenCL"
|
||||
)
|
||||
|
||||
find_package(${LIBNAME} REQUIRED)
|
||||
|
||||
target_include_directories(libfastfetch PRIVATE ${${LIBNAME}_INCLUDE_DIRS})
|
||||
target_link_directories(libfastfetch PRIVATE ${${LIBNAME}_LIBRARY_DIRS})
|
||||
target_link_libraries(libfastfetch PRIVATE ${${LIBNAME}_LIBRARIES})
|
||||
endfunction()
|
||||
|
||||
ff_framwork_enable(IOKit)
|
||||
ff_framwork_enable(CoreGraphics)
|
||||
ff_framwork_enable(OpenGL)
|
||||
ff_framwork_enable(OpenCL)
|
||||
target_compile_definitions(libfastfetch
|
||||
PRIVATE FF_HAVE_OPENCL=1
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(libfastfetch
|
||||
PUBLIC ${PROJECT_BINARY_DIR}
|
||||
|
||||
@@ -32,10 +32,7 @@ static void detectResolution(FFDisplayServerResult* ds)
|
||||
CGDisplayCount screenCount;
|
||||
CGGetOnlineDisplayList(INT_MAX, NULL, &screenCount);
|
||||
if(screenCount == 0)
|
||||
{
|
||||
dlclose(cg);
|
||||
return;
|
||||
}
|
||||
|
||||
CGDirectDisplayID* screens = malloc(screenCount * sizeof(CGDirectDisplayID));
|
||||
CGGetOnlineDisplayList(INT_MAX, screens, &screenCount);
|
||||
|
||||
@@ -27,10 +27,7 @@ void ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
|
||||
CFMutableDictionaryRef matchDict = IOServiceMatching("IOPCIDevice");
|
||||
io_iterator_t iterator;
|
||||
if(IOServiceGetMatchingServices(0, matchDict, &iterator) != kIOReturnSuccess)
|
||||
{
|
||||
dlclose(iokit);
|
||||
return;
|
||||
}
|
||||
|
||||
io_registry_entry_t registryEntry;
|
||||
while((registryEntry = IOIteratorNext(iterator)) != 0)
|
||||
|
||||
@@ -341,6 +341,8 @@ static const char* osMesaPrint(FFinstance* instance)
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <OpenGL/OpenGL.h> // This brings in CGL, not GL
|
||||
|
||||
typedef struct CGLData
|
||||
{
|
||||
CGLPixelFormatObj pixelFormat;
|
||||
@@ -370,6 +372,8 @@ static const char* cglHandlePixelFormat(FFinstance* instance, CGLData* data)
|
||||
|
||||
static const char* cglPrint(FFinstance* instance)
|
||||
{
|
||||
CGLData data;
|
||||
|
||||
CGLPixelFormatAttribute attrs[] = {
|
||||
kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core,
|
||||
kCGLPFAAccelerated,
|
||||
@@ -377,11 +381,11 @@ static const char* cglPrint(FFinstance* instance)
|
||||
};
|
||||
|
||||
GLint num;
|
||||
if (CGLChoosePixelFormat(attrs, &data->pixelFormat, &num) != kCGLNoError)
|
||||
if (CGLChoosePixelFormat(attrs, &data.pixelFormat, &num) != kCGLNoError)
|
||||
return "CGLChoosePixelFormat() failed";
|
||||
|
||||
const char* error = cglHandlePixelFormat(instance, data);
|
||||
CGLDestroyPixelFormat(data->pixelFormat);
|
||||
const char* error = cglHandlePixelFormat(instance, &data);
|
||||
CGLDestroyPixelFormat(data.pixelFormat);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user