SFML / SFML

Simple and Fast Multimedia Library
https://www.sfml-dev.org/
zlib License
10.15k stars 1.71k forks source link

OSX 10.10 (preview) support #691

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hey,

I'm trying to compile SFML (master) on a OS X 10.10 (Preview) iMac. CMake interrupts the process with the following message:

CMake Error at cmake/Config.cmake:58 (message): Unsupported version of OS X: 10.10

I'm not planning to use XCode 6 (Preview), but XCode 5 as already supported. It would be great if you guys enable support for OS X 10.10, since I can use SFML 2.1 (stable) with no problems on it.

The idea here is that I can compile it and help you with bug reports too.

Let me know if you need further info.

Thanks, Hiram

ghost commented 10 years ago

BTW, I could try to "by pass" this check on Config.cmake file, but I think that OS X 10.10 is about to be released, and would be great to test it in advance.

MarioLiebisch commented 10 years ago

That's a CMake issue and not really something anyone here can change (other than submitting a patch to CMake).

mantognini commented 10 years ago

Yep, as @MarioLiebisch said, this is a Cmake-related issue. We can do nothing about it. Maybe try with a nightly build version of Cmake, they might have already fixed that..

SFML is planned, of course, to support 10.10 but I don't have access to any beta version so I can't help much before it's officially released. But if you spot something, drop us a line on the forum (preferably).

LaurentGomila commented 10 years ago

Why do you guys say that it's a CMake issue? This error is triggered by SFML. And by the way, it shouldn't, because the condition for it is "if minor version is less than 7".

texus commented 10 years ago

Isn't the problem just with the regex on line 56 of that file? I could be wrong but it looks like it would only find the first number and puts a 1 instead of a 10 in the version variable.

ghost commented 10 years ago

@LaurentGomila, yeah. I think the minor version could be upgraded to, at least, 9 (10.9) which is the OS X current stable.

@MarioLiebisch, AFAK, Config.cmake is created/generated/maintained by the SFML developers. Am I wrong? I'm not very familiar with CMake yet, I don't know how their files are generated. I think the issue should be re-opened.

ghost commented 10 years ago

@texus, I recently tried to "by pass" that condition, but there was still other issues. I can't test that again right now, but would be a start changing the regex or bypassing it to see what happens.

mantognini commented 10 years ago

Oupsi! :blush:

You guys are probably right. The regex should be updated indeed!

ghost commented 10 years ago

NP! I wish I had to time to update the code myself and submit a pull request, but I'm too busy making a GDD and a prototype of a game for a competion that will begin in a few days. Anyway, let me know if I can help with anything else.

2014-08-26 9:50 GMT-03:00 Marco Antognini notifications@github.com:

Oupsi! [image: :blush:]

You guys are probably right. The regex should be updated indeed!

— Reply to this email directly or view it on GitHub https://github.com/LaurentGomila/SFML/issues/691#issuecomment-53415089.

mantognini commented 10 years ago

Try replacing line 56 of cmake/Config.cmake with:

STRING(REGEX REPLACE "10\\.([0-9]+).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")

(Basically, this add a +.)

ghost commented 10 years ago

Worked like a charm @mantognini. Actually, the changes I made myself last week caused other problems, but must be something I did wrong. IMO, this could be validated by you guys and merged to the master. Thank you.

MarioLiebisch commented 10 years ago

Meh, filename confused me. :)

ghost commented 10 years ago

BTW, while executing "make":

[ 47%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/WindowImplCocoa.mm.o
/Users/hiram/Development/SFML/src/SFML/Window/OSX/WindowImplCocoa.mm:228:32: error: 
      cannot initialize a parameter of type 'id<NSFileManagerDelegate>' with an
      rvalue of type 'SFApplicationDelegate *'
  ...[NSApp setDelegate:[[[SFApplicationDelegate alloc] init] autorelease]];
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/objc/NSObject.h:38:1: note: instance method 'autorelease' is
      assumed to return an instance of its receiver type ('SFApplicationDelegate
      *')
- (instancetype)autorelease OBJC_ARC_UNAVAILABLE;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:109:47: note: 
      passing argument to parameter 'delegate' here
@property (assign) id <NSFileManagerDelegate> delegate NS_AVAILABLE(10_5, 2_0);
                                              ^
1 error generated.
make[2]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/WindowImplCocoa.mm.o] Error 1
make[1]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
make: *** [all] Error 2

But nothing to do with the Config.cmake. I may open another issue later. Thanks

LaurentGomila commented 10 years ago

http://en.sfml-dev.org/forums/index.php?topic=16160.msg115740#msg115740 ?

ghost commented 10 years ago

Simple and Fast Development Team. :-) I appreaciate your quick response. I'll stop just demanding "quick fixes" and try to contribute more pragmatically to SFML. Keep up the great work!

mantognini commented 10 years ago

@LaurentGomila, yes that's the same line but I'm really confused.. I don't understand what's about this NSFileManagerDelegate here.. It's supposed to be NSApplicationDelegate. Or did they change something in 10.10 regarding application delegate?

@hiramgeeks can you try to apply the fix mentioned on the Laurent's link and tell me if it change something at all.

ghost commented 10 years ago

Yeah, I let you know soon.

ghost commented 10 years ago

Actually, just replacing the line 228 (former 219) doesn't solve the problem:

[ 15%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/WindowImplCocoa.mm.o
/Users/hiram/Development/SFML/src/SFML/Window/OSX/WindowImplCocoa.mm:228:32: error: 
      cannot initialize a parameter of type 'id<NSFileManagerDelegate>' with an
      rvalue of type 'SFApplicationDelegate *'
            [NSApp setDelegate:[[SFApplicationDelegate alloc] init]];
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/objc/NSObject.h:60:1: note: instance method 'init' is assumed to
      return an instance of its receiver type ('SFApplicationDelegate *')
- (instancetype)init;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:109:47: note: 
      passing argument to parameter 'delegate' here
@property (assign) id <NSFileManagerDelegate> delegate NS_AVAILABLE(10_5, 2_0);
                                              ^
1 error generated.
make[2]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/WindowImplCocoa.mm.o] Error 1
make[1]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
make: *** [all] Error 2
ghost commented 10 years ago

@mantognini couldn't it just return an (id) on init instead of (instancetype)?

LaurentGomila commented 10 years ago

After a bit of Googling, it seems to be a known issue when porting to OS X 10.10. Maybe we can find the clean solution by searching a little more.

LaurentGomila commented 10 years ago

Apparently, it would be enough to replace NSApp with [NSApplication sharedApplication] in this line.

ghost commented 10 years ago

Let me give it a try

ghost commented 10 years ago

Yeah, it was enough! Everything compiled now.

ghost commented 10 years ago

A popular saying here in Brazil: "we killed two rabbits with a single hit". Two issues resolved.

ghost commented 10 years ago

@LaurentGomila, would it be convenient if I submit a pull request for those issues or you can change that on your side?

mantognini commented 10 years ago

That was an interesting bug that they introduced there. ^^'

Anyway, I have other modifications to the same file so I'll apply that one too. The fix won't come until next week or so, though.

LaurentGomila commented 10 years ago

That's great.

@hiramgeeks, thanks a lot for your help on this issue.

ghost commented 10 years ago

@mantognini yeah, developing for iOS, I noticed Apple changing the API more drastically since last year. Noticeable from iOS 7 and OS X 10.9. Really strange bug, but understandable. Mr. Jobs is not there anymore yelling to make things work as before. LOL

@LaurentGomila my honor, sir. u r welcome

eXpl0it3r commented 10 years ago

@mantognini Have you already pushed the other modification? If so can you link it?

mantognini commented 10 years ago

@eXpl0it3r No, it's not yet implemented. I'll do it either later tonight or on Monday.