We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1651

Summary: cmake build for cocoa detects incorrectly and doesn't link opengl correctly on OSX.
Product: SDL Reporter: Doug <linderd>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus, ttimo
Version: HG 2.0Keywords: triage-2.0.4
Hardware: x86   
OS: Other   
See Also: https://bugzilla.libsdl.org/show_bug.cgi?id=2056
Attachments: Proposed patch

Description Doug 2012-11-28 22:38:12 UTC
Unfortunately cmake's check_c_source_compiles() call doesn't work for objective c, so we don't detect Cocoa even if it is present.

I've replaced this with a simple IF(APPLE) which *isn't* right (its totally possible to be on a mac and not have cocoa), but I'm not sure what a better solution is.

Finally, if you do detect cocoa and try to compile, the opengl loader has a typo in it, using EXTRA_LIBRARIES instead of EXTRA_LIBS.
Comment 1 Doug 2012-11-28 22:39:44 UTC
Created attachment 995 [details]
Proposed patch

Changes to fix for OSX
Comment 2 Ryan C. Gordon 2013-07-12 12:07:13 UTC
(In reply to comment #0)
> its totally possible to be on a mac and not have cocoa

When does this happen (or do you mean you can run Darwin directly instead of Mac OS X)?

--ryan.
Comment 3 Timothee Besset 2013-09-10 16:25:05 UTC
Seeing the same problem. OSX 10.8
This fix works for me. See related bug too.
Thanks!
Comment 4 Ryan C. Gordon 2014-03-02 01:23:01 UTC
The Cocoa detection was fixed a few days ago (by not trying to compile Objective-C...it's Mac OS X, it has Cocoa, why bother slowing down the configure step?) in a previous commit for another bug.

_Should_ we be linking directly to OpenGL? I'm pretty sure SDL dynamically loads it for every place we use it.

--ryan.
Comment 5 Ryan C. Gordon 2014-03-02 02:36:54 UTC
(In reply to Ryan C. Gordon from comment #4)
> _Should_ we be linking directly to OpenGL? I'm pretty sure SDL dynamically
> loads it for every place we use it.

Just checked; we definitely can link SDL without referencing OpenGL at all on Mac OS X...we dynamically load it if we ever need it.

I'm going to wait for 2.0.2 to ship in case I'm totally wrong about this, and then remove the direct reference to OpenGL.framework from all the project files.

--ryan.
Comment 6 Sam Lantinga 2014-04-18 06:16:42 UTC
Hey Ryan, want to get this into 2.0.4?
Comment 7 Ryan C. Gordon 2015-02-19 05:22:22 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!
Comment 8 Ryan C. Gordon 2015-03-20 15:57:36 UTC
This is fixed now in revision control.

--ryan.