cmake: fix Metal detection
Confirmed to work on: macOS 10.15.7 XCode Version 12.4 (12D4e)main
parent
8ceba27d62
commit
71e06a536a
|
@ -1992,9 +1992,7 @@ elseif(APPLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SDL_VULKAN OR SDL_METAL OR SDL_RENDER_METAL)
|
if(SDL_VULKAN OR SDL_METAL OR SDL_RENDER_METAL)
|
||||||
set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
check_objc_source_compiles("
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -ObjC")
|
|
||||||
check_c_source_compiles("
|
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#import <Metal/Metal.h>
|
#import <Metal/Metal.h>
|
||||||
#import <QuartzCore/CAMetalLayer.h>
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
@ -2002,11 +2000,7 @@ elseif(APPLE)
|
||||||
#if (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64)
|
#if (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64)
|
||||||
#error Metal doesn't work on this configuration
|
#error Metal doesn't work on this configuration
|
||||||
#endif
|
#endif
|
||||||
int main(void) {
|
int main(void) {}" HAVE_FRAMEWORK_METAL)
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
" HAVE_FRAMEWORK_METAL)
|
|
||||||
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
|
||||||
if(HAVE_FRAMEWORK_METAL)
|
if(HAVE_FRAMEWORK_METAL)
|
||||||
set(SDL_FRAMEWORK_METAL 1)
|
set(SDL_FRAMEWORK_METAL 1)
|
||||||
set(SDL_FRAMEWORK_QUARTZCORE 1)
|
set(SDL_FRAMEWORK_QUARTZCORE 1)
|
||||||
|
|
Loading…
Reference in New Issue