Sam Lantinga 42c5b4acde Fixed bug 5366 - cmake build doesn't detect Metal on macOS
Tom Seddon

2nd time lucky, perhaps. patch 2 applies to current HEAD at time of writing - 4eb049c9bb1ca94efe3c40b57beda3169984d0cb from https://github.com/SDL-mirror/SDL.

This basically goes back to what was there originally, but now manually adding "-x objective-c" to the clang command line rather than "-ObjC". clang is then invoked without the "-x c" that was causing the problem, the snippet builds, and Metal is detected. (I had a quick trawl through the cmake code, but I couldn't see where this is handled.)

I was moved to try this after finding SDL's own CHECK_OBJC_SOURCE_COMPILES macro, and noting what it does: https://github.com/SDL-mirror/SDL/blob/4eb049c9bb1ca94efe3c40b57beda3169984d0cb/cmake/macros.cmake#L67

An alternative fix of course would be to use CHECK_OBJC_SOURCE_COMPILES instead of cmake's check_objc_source_compiles - but that had the same problem of getting confused by "return 0;". (Maybe that's because it's a macro? I'll defer to a cmake expert on this one.)

I decided in the end to err on the side of leaving things looking basically the same as they were before my first patch.
2020-12-09 06:17:55 -08:00
2020-10-09 03:28:30 +03:00
2020-01-16 20:49:25 -08:00



                         Simple DirectMedia Layer



                                  (SDL)



                                Version 2.0



---

https://www.libsdl.org/



Simple DirectMedia Layer is a cross-platform development library designed

to provide low level access to audio, keyboard, mouse, joystick, and graphics

hardware via OpenGL and Direct3D. It is used by video playback software,

emulators, and popular games including Valve's award winning catalog

and many Humble Bundle games.



More extensive documentation is available in the docs directory, starting

with README.md



Enjoy!

	Sam Lantinga				(slouken@libsdl.org)

S
Description
Simple Directmedia Layer
Readme 230 MiB
Languages
C 87.8%
C++ 4%
Objective-C 3.4%
CMake 1.7%
Python 0.8%
Other 2%