Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.
/ SDL Public archive

Commit

Permalink
cmake: fix Metal detection
Browse files Browse the repository at this point in the history
Confirmed to work on:
macOS 10.15.7
XCode Version 12.4 (12D4e)
  • Loading branch information
ericwa authored and icculus committed Jan 26, 2022
1 parent 8ceba27 commit 71e06a5
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1992,21 +1992,15 @@ 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>
#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)
Expand Down

0 comments on commit 71e06a5

Please sign in to comment.