cmake: fix Metal detection

Confirmed to work on:
macOS 10.15.7
XCode Version 12.4 (12D4e)
This commit is contained in:
Eric Wasylishen 2021-11-26 18:27:34 -07:00 committed by Ryan C. Gordon
parent 8ceba27d62
commit 71e06a536a
1 changed files with 2 additions and 8 deletions

View File

@ -1992,9 +1992,7 @@ elseif(APPLE)
endif()
if(SDL_VULKAN OR SDL_METAL OR SDL_RENDER_METAL)
set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -ObjC")
check_c_source_compiles("
check_objc_source_compiles("
#include <AvailabilityMacros.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
@ -2002,11 +2000,7 @@ elseif(APPLE)
#if (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64)
#error Metal doesn't work on this configuration
#endif
int main(void) {
return 0;
}
" HAVE_FRAMEWORK_METAL)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
int main(void) {}" HAVE_FRAMEWORK_METAL)
if(HAVE_FRAMEWORK_METAL)
set(SDL_FRAMEWORK_METAL 1)
set(SDL_FRAMEWORK_QUARTZCORE 1)