SFML community forums

General => General discussions => Topic started by: Hiura on November 25, 2010, 06:02:31 pm

Title: SFML 2 for OS X comes true!
Post by: Hiura on November 25, 2010, 06:02:31 pm
Hello,

Detailed informations about SFML on Mac are available here (http://www.sfml-dev.org/forum/viewtopic.php?p=23677#23677).

I make it quick and go straight to the point. I just commited into the svn the SFML 2 port for Mac OS X. However, keep in mind that SFML 2 will continue to evolve thanks to Laurent! Thank you again Laurent for you really amazing job here!  :D

> use cmake as explained in the tutorial

> You'll see some warning during the compiling about some stuff are not yet implemented.

> test the examples (installed into /usr/local/share/SFML/examples/).

> test as many things you can and report me your bugs ;-)

> comment my code if you have time. =)

> have fun!
Title: SFML 2 for OS X comes true!
Post by: Spodi on November 25, 2010, 10:07:48 pm
Great work, Hiura! Greater portability is always a good thing. :)
Title: SFML 2 for OS X comes true!
Post by: Hiura on November 27, 2010, 09:11:21 pm
(up-to-date as on August, 2011)
Here is it how to use SFML 2 on mac.

First download the last sources from the git repository (see github project page for more info). Follow the tutorial on CMake (here (http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php)) and choose Makefile (you may have some issues with right access with Xcode). build and install with «sudo make install». (SFML goes by default into /usr/local/ or /Library/Frameworks)

Now, if you want to use Makefile it's the same as on Linux.

If you're using Xcode 4 you can create very easily a new project with the SFML templates.

Otherwise, with Xcode 3 follow these steps :
> Create a new «command line tool» project with C++ selected.
> Double click on your target to open the target info.
> In «General» tab, click on the + in the left bottom.
> Scroll down to libsfml-* and choose the .dylib (not 2.0.dylib nor 2.0.0.dylib) for each module you will use. You can also use SFML frameworks. (Don't forget OpenGL framework if you use Graphics module)
> If you have some errors about include files not found, go to build tab, select «All Configuration» then search for «header search path» and add «/usr/local/include/». If you have not to add such search path please advise me.

If you encounter some «sndfile.framework/sndfile, file was built for unsupported file format which is not the architecture being linked (i386)» errors, please refer to this post (http://www.sfml-dev.org/forum/viewtopic.php?p=27206#27206).

If you got some crash with sf::String or sf::Text about some std::basic_string stuff add '-D_GLIBCXX_FULLY_DYNAMIC_STRING=1' to CMAKE_CXX_FLAGS (advanced option of cmake).

Some more details here (http://www.sfml-dev.org/forum/viewtopic.php?p=36808#36808). Post quoted :
Quote from: "Hiura"
Frameworks are now available. BUILD_FRAMEWORKS can be set to TRUE to build SFML as frameworks. NB : frameworks are only available in release. There is no sfml-*-d.framework.

Cmake automatically installs the xcode 4 templates for you if INSTALL_XCODE4_TEMPLATES is set to TRUE.

The templates were updated to let you choose between frameworks and dylibs.

If you choose to create a application bundle (.app) SFML dylibs or SFML frameworks, and sndfile framework, are copied to your bundle so you can send it as-is to people when you build it for "archive".

Please refer to xcode/templates/readme.txt for more details.

Have fun!  :wink:


If you need more information, don't hesitate to ask. ;-)
Title: SFML 2 for OS X comes true!
Post by: Hiura on November 27, 2010, 09:23:30 pm
One more thing : this is not the final version. You'll have frameworks instead of dylib if everything goes right in a few months. You'll also have some templates for your projects, of course.  :wink:
Title: SFML 2 for OS X comes true!
Post by: Terrydil on November 28, 2010, 04:49:49 pm
This is completely awesome Hiura, nice job.  Can't wait to try it out. :)

Thanks Hiura and of course Laurent, y'all rock.
Title: SFML 2 for OS X comes true!
Post by: Vit on November 29, 2010, 11:18:57 am
Hooray :D
Let's see if the bugs I noticed in 1.6 are fixed (a few SFML + OpenGL integration bugs, and transparent bitmap blitting).
Title: SFML 2 for OS X comes true!
Post by: Hiura on November 30, 2010, 09:12:46 pm
Here is the list of know bugs :

> Managing SFML window with external NSWindow cause some trouble with Graphics module (works fine with Window module).

> The blocking mode for event listening (sf::Window::WaitEvent instead of GetEvent) is buggy – try opengl example to see what I mean. It's really weird!!

And the list of not implemented feature (yet!) :

> Managing SFML window with an external NSView (both modules).

> Updating OGL context version inside sf::Settings.

> RenderImageImplPBuffer

> Joystick

> Menu bar

> (PPC arch and CMake producing frameworks)

If you spot some other thing, please tell me!  :)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on November 30, 2010, 09:37:41 pm
Okay, so here is my very small report :D

When using the fullscreen mode, the menu bar remains on top of the window, the window is unable to get focus and pressing any key causes beeps.
Title: SFML 2 for OS X comes true!
Post by: Hiura on November 30, 2010, 10:05:20 pm
I admit : I forgot to try fullscreen so I fully guilty!  :oops:

Will be fixed ASAP!

Thanks for your report.
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 01, 2010, 12:02:41 am
Should be ok now. Can you confirm ?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 01, 2010, 12:22:57 am
Working fine now :) (as for this point :P ).
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 03, 2010, 11:52:08 pm
Could someone check my PBuffer impl of RenderImage ? Thanks  :)
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 04, 2010, 05:29:41 pm
Currently there is a problem with the use of a NSWindow as an external handle for SFML. It works perfectly right with only window module/opengl content but with the graphics module I got a black window.

You can try it by downloading this archive (http://www.mediafire.com/?3dxc2vs0wbd3c3n).

The only thing that is different between «graphics» and «handle_nswindow_graphics» targets (from SFML point of view) is the call one of these functions of SFWindowController (from window module) :

Code: [Select]
-(id)initWithMode:(sf::VideoMode const*)mode andStyle:(unsigned long)style;
-(id)initWithWindow:(NSWindow*)window;


I don't see any difference between them that could explain this strange behaviour... Does anyone of you ?

Maybe I did something stupid in the handle_nswindow_graphics sample ?

Any help would be appreciate.  :)
Title: SFML 2 for OS X comes true!
Post by: automata on December 11, 2010, 04:57:19 am
An issue with CMake and the current SVN version of sfml2:

Code: [Select]
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GLEW_INCLUDE_PATH
   used as include directory in directory /Users/Laptop/Documents/sfml2/src/SFML/Graphics

Configuring incomplete, errors occurred!


I get this regardless of whether I try to setup a build environment for XCode or makefiles.
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 11, 2010, 11:54:53 am
Quote
An issue with CMake and the current SVN version of sfml2

Should be fixed now.
Title: SFML 2 for OS X comes true!
Post by: spacechase0 on December 12, 2010, 01:05:12 am
Just made a quick (and very sloppy) project template for graphic applications here (http://cpp-wiki.com/SFML%202.0%20Graphics%20Project.zip) . I just put it in "/Developer/Library/Xcode/Project Templates/Application" and it worked fine.
Title: SFML 2 for OS X comes true!
Post by: automata on December 13, 2010, 01:37:14 am
A new issue occurs in the current SVN version, for both unix makefiles and xcode. If it compiles for you, my guess at the root cause would be that for some reason __int64 is not defined on my system but is on yours. (I am using a MacBook Pro; it appears to use i386 rather than x86-64, maybe the architecture is the reason?)

Code: [Select]

In file included from /Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:32,
                 from /Users/Laptop/Documents/sfml2/src/SFML/Audio/Music.cpp:30:
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:308: error: '__int64' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:319: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:372: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:373: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: 'sf_vio_get_filelen' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: 'sf_vio_seek' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: 'sf_vio_read' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: 'sf_vio_write' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: 'sf_vio_tell' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:459: error: 'sf_vio_get_filelen' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:460: error: 'sf_vio_seek' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:461: error: 'sf_vio_read' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:462: error: 'sf_vio_write' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:463: error: 'sf_vio_tell' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:540: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:557: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:558: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:570: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:571: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:573: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:574: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:576: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:577: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:579: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:580: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:587: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:588: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:590: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:591: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:593: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:594: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:596: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:597: error: 'sf_count_t' does not name a type
In file included from /Users/Laptop/Documents/sfml2/src/SFML/Audio/Music.cpp:30:
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:170: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:171: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:172: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:173: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:174: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:178: error: 'sf_count_t' does not name a type

In file included from /Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:32,
                 from /Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundBuffer.cpp:29:
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:308: error: '__int64' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:319: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:372: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:373: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: 'sf_vio_get_filelen' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: 'sf_vio_seek' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: 'sf_vio_read' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: 'sf_vio_write' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: 'sf_vio_tell' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:459: error: 'sf_vio_get_filelen' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:460: error: 'sf_vio_seek' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:461: error: 'sf_vio_read' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:462: error: 'sf_vio_write' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:463: error: 'sf_vio_tell' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:540: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:557: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:558: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:570: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:571: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:573: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:574: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:576: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:577: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:579: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:580: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:587: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:588: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:590: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:591: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:593: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:594: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:596: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:597: error: 'sf_count_t' does not name a type
In file included from /Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundBuffer.cpp:29:
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:170: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:171: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:172: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:173: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:174: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:178: error: 'sf_count_t' does not name a type

In file included from /Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:32,
                 from /Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:28:
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:308: error: '__int64' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:319: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:372: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:373: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:452: error: 'sf_vio_get_filelen' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:453: error: 'sf_vio_seek' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:454: error: 'sf_vio_read' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:455: error: 'sf_vio_write' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: ISO C++ forbids declaration of 'sf_count_t' with no type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: typedef 'sf_count_t' is initialized (use __typeof__ instead)
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:456: error: 'sf_vio_tell' was not declared in this scope
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:459: error: 'sf_vio_get_filelen' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:460: error: 'sf_vio_seek' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:461: error: 'sf_vio_read' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:462: error: 'sf_vio_write' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:463: error: 'sf_vio_tell' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:540: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:557: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:558: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:570: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:571: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:573: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:574: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:576: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:577: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:579: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:580: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:587: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:588: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:590: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:591: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:593: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:594: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:596: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/extlibs/headers/sndfile.h:597: error: 'sf_count_t' does not name a type
In file included from /Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:28:
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:170: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:171: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:172: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:173: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:174: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.hpp:178: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp: In member function 'bool sf::priv::SoundFile::OpenRead(const std::string&)':
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:96: error: 'struct SF_INFO' has no member named 'frames'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp: In member function 'bool sf::priv::SoundFile::OpenRead(const void*, size_t)':
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:124: error: 'struct SF_INFO' has no member named 'frames'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp: In member function 'size_t sf::priv::SoundFile::Read(sf::Int16*, size_t)':
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:173: error: 'sf_read_short' was not declared in this scope
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp: In member function 'void sf::priv::SoundFile::Write(const sf::Int16*, size_t)':
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:189: error: 'sf_write_short' was not declared in this scope
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp: In member function 'void sf::priv::SoundFile::Seek(float)':
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:202: error: 'sf_count_t' was not declared in this scope
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:202: error: expected `;' before 'frameOffset'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:203: error: 'frameOffset' was not declared in this scope
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:203: error: 'sf_seek' was not declared in this scope
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp: In member function 'SF_VIRTUAL_IO sf::priv::SoundFile::MemoryIO::Prepare(const void*, size_t)':
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:253: error: 'struct SF_VIRTUAL_IO' has no member named 'get_filelen'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:253: error: 'GetLength' is not a member of 'sf::priv::SoundFile::MemoryIO'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:254: error: 'struct SF_VIRTUAL_IO' has no member named 'read'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:254: error: 'Read' is not a member of 'sf::priv::SoundFile::MemoryIO'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:255: error: 'struct SF_VIRTUAL_IO' has no member named 'seek'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:255: error: 'Seek' is not a member of 'sf::priv::SoundFile::MemoryIO'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:256: error: 'struct SF_VIRTUAL_IO' has no member named 'tell'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:256: error: 'Tell' is not a member of 'sf::priv::SoundFile::MemoryIO'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:257: error: 'struct SF_VIRTUAL_IO' has no member named 'write'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:257: error: 'Write' is not a member of 'sf::priv::SoundFile::MemoryIO'
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:262: error: 'myTotalSize' was not declared in this scope
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp: At global scope:
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:269: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:278: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:295: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:320: error: 'sf_count_t' does not name a type
/Users/Laptop/Documents/sfml2/src/SFML/Audio/SoundFile.cpp:329: error: 'sf_count_t' does not name a type
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 13, 2010, 08:02:03 am
There are two versions of sndfile.h, one for Windows and one for Mac OS X. Apparently it is picking the wrong one on your system, we definitely have to handle this more correctly.

I'll do a fix as soon as possible.
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 13, 2010, 10:03:25 pm
Is it better now?
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 13, 2010, 10:10:22 pm
It seems good to me. And I like the new include dir.  :)
Title: SFML 2 for OS X comes true!
Post by: automata on December 17, 2010, 04:57:27 am
I am trying to build a simple OpenGL test program from the command line. The command I am using is

Code: [Select]
g++ opengl.cpp -lsfml-window -lsfml-system

I get errors saying that the various OpenGL functions and types have not been declared. I have inserted -framework OpenGL into various places in that line, with the same issue.

In my test code I include <SFML/Window.hpp>; I don't need to include anything else, do I?
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 17, 2010, 07:57:01 am
Code: [Select]
#include <SFML/OpenGL.hpp>
;)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 20, 2010, 04:42:47 pm
Here is what I get after updating the files from the SVN repository and trying to build SFML :
Quote
[ 85%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/Music.cpp.o
In file included from /Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/Music.cpp:30:
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:32:21: error: sndfile.h: No such file or directory
In file included from /Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/Music.cpp:30:
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:166: error: ‘SF_VIRTUAL_IO’ does not name a type
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:170: error: ‘sf_count_t’ does not name a type
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:171: error: ‘sf_count_t’ does not name a type
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:172: error: ‘sf_count_t’ does not name a type
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:173: error: ‘sf_count_t’ does not name a type
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:174: error: ‘sf_count_t’ does not name a type
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:178: error: ‘sf_count_t’ does not name a type
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:184: error: ISO C++ forbids declaration of ‘SNDFILE’ with no type
/Users/ceylo/sfml/branches/sfml2/src/SFML/Audio/SoundFile.hpp:184: error: expected ‘;’ before ‘*’ token
make[2]: *** [src/SFML/Audio/CMakeFiles/sfml-audio.dir/Music.cpp.o] Error 1
make[1]: *** [src/SFML/Audio/CMakeFiles/sfml-audio.dir/all] Error 2
make: *** [all] Error 2


 :?
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 20, 2010, 04:44:52 pm
You have to reconfigure manually using CMake. Some include paths have changed and the cache is messed up.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 20, 2010, 04:50:03 pm
Indeed, I had run the cmake tool but I had not removed CMakeCache.txt :D . Thanks!
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 20, 2010, 07:08:14 pm
Here is my feedback about the SFML 2 port.

1. When using fullscreen mode, you can only use the desktop video mode. Any other video mode will fail, saying it's invalid.

2. WaitEvent() works.. weirdly. I don't really know how it's supposed to behave. The documentation says it would return false whenever an error occurs. With the current implementation it will return false if :
- I move the mouse cursor when it's outside of the OpenGL area
- I move the window
- I use the mouse wheel when the cursor is outside of the OpenGL area but still on the application (menu bar, window title bar)
- I press the key modifiers (Fn, Shift, Caps Lock, Ctrl, Alt, Cmd), the ')' key; and the luminosity, playing controls or sounds keys
- the window loses or gains focus (but not when giving back the focus while clicking the app icon in the Dock)
Is it the expected behavior ?

3. As for the events being received, all of the keys seem to work fine except the one given above. Pressing the ')' key will print "Unknown key (released)" and "Unknown key (pressed)".

4. The arrow keys produce a text entered event but I suppose they should not.

5. sf::Window::SetPosition(0, 0) does not put the window at the right place as far as the Y axis is concerned.

6. Using sf::Window::SetSize() will produce 5 resize events whereas I suppose I should only get 1 (or 0 ?).

7. sf::Window::EnableKeyRepeat() has no effect. Key repeating is always enabled.

8. There is no working directory set. Thus the working directory is the directory containing the bundle application when launching from Xcode, and the user home directory when launching from the Finder. It is the expected behavior ?

9. Creating a window and then calling sf::Window::Create() on the same window object makes the app crash randomly.


That "all" I've to say for now, have fun ! :D
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 20, 2010, 07:28:27 pm
Quote
2. WaitEvent() works.. weirdly. I don't really know how it's supposed to behave. The documentation says it would return false whenever an error occurs. With the current implementation it will return false if :
- I move the mouse cursor when it's outside of the OpenGL area
- I move the window
- I use the mouse wheel when the cursor is outside of the OpenGL area but still on the application (menu bar, window title bar)
- I press the key modifiers (Fn, Shift, Caps Lock, Ctrl, Alt, Cmd), the ')' key; and the luminosity, playing controls or sounds keys
- the window loses or gains focus (but not when giving back the focus while clicking the app icon in the Dock)
Is it the expected behavior ?

Nop, in fact WaitEvent returns a boolean to have the same prototype as GetEvent, but it should really never return false (there's no error that can happen).
After looking at the implementation, I noticed that it will eventually return false if there's an event that SFML doesn't handle -- which means that normally all these events that you list should never generate a sf::Event on OS X (even with GetEvent).
I should probably change the code to fix this.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 20, 2010, 07:38:36 pm
Shouldn't it return false only when the window is closed (and the window impl deleted by SFML) ?
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 20, 2010, 07:43:55 pm
Quote
Shouldn't it return false only when the window is closed (and the window impl deleted by SFML) ?

Sure, I forgot this obvious scenario :)
This is indeed the only case where WaitEvent should return false.
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 20, 2010, 08:07:24 pm
Well, that's a lot of bugs!  :oops: Thanks for the report. I'll have a look ASAP.

Just a quick word about the working directory, isn't that the same behaviour on Linux/Windows when launching an exe from the window manager ?

About context (and therefor video mode), I'll definitely have to look at it deeply again (and again...). So don't expect too much from it now.
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 20, 2010, 10:29:44 pm
I cannot reproduce the bug about key repeating on my machine.
Does the following code not work for you ?
Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <iostream>

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{    
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML event check");

bool repeat = false;
window.EnableKeyRepeat(repeat);

// Start the game loop
while (window.IsOpened())
{
// Process events
sf::Event event;
while (window.GetEvent(event))
{
// Close window : exit
if (event.Type == sf::Event::Closed)
window.Close();

if (event.Type == sf::Event::KeyPressed)
{
// Escape key : exit
if (event.Key.Code == sf::Key::Escape) {
window.Close();
}

std::cout << "a key..." << std::endl;

// Enable/Disable key repeat.
if (event.Key.Code == sf::Key::R) {
repeat = !repeat;
window.EnableKeyRepeat(repeat);
std::cout << (repeat ? "repeat enable" : "repeat disable") << std::endl;
}
}
}

// Finally, display the rendered frame on screen
window.Clear();
window.Display();
}

return EXIT_SUCCESS;
}
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 20, 2010, 10:43:47 pm
The bug targets TextEntered events, not KeyPressed events. Thus your code works fine, but not if you add something like that :
Code: [Select]

if (event.Type == sf::Event::TextEntered)
{
    std::cout << "text entered" << std::endl;
}
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 20, 2010, 10:55:13 pm
Ho! I see. So that's one bug fixed!  :wink:
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 20, 2010, 11:10:09 pm
I fixed point 2, now WaitEvent never doesn't false anymore unless the window is closed.

Quote
Ho! I see. So that's one bug fixed!

??
Key repeat must work for TextEntered events as well.
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 20, 2010, 11:11:35 pm
Look at the svn log  :wink:
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 20, 2010, 11:15:33 pm
Ah sorry, it was not clear from your previous post that you fixed the bug between "Ho! I see." and "So that's one bug fixed!" :P
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 20, 2010, 11:18:01 pm
I completely agree ^^
Title: SFML 2 for OS X comes true!
Post by: ratzlaff on December 21, 2010, 02:47:57 am
The mouse point returned by getMouseY() does not appear to account for the title bar.

Code: [Select]

int main()
{
sf::RenderWindow window(sf::VideoMode(800, 800), "Test Window");
const sf::Input& wInput = window.GetInput();
window.ShowMouseCursor(true);

sf::Shape rec = sf::Shape::Rectangle(0,0,100,100, sf::Color(255,0,0));

    while (window.IsOpened())
    {
        // Process events
        sf::Event event;
        while (window.GetEvent(event))
        {
            // Close window : exit
            if (event.Type == sf::Event::Closed)
                window.Close();

            if (event.Type == sf::Event::KeyPressed) {
                // Escape key : exit
                if (event.Key.Code == sf::Key::Escape)
                    window.Close();
            }
        }

float mouseX = (float)wInput.GetMouseX();
float mouseY = (float)wInput.GetMouseY();
rec.SetPosition(mouseX, mouseY);

window.Clear(sf::Color::Green);
window.Draw(rec);
        window.Display();
    }

    return EXIT_SUCCESS;
}
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 21, 2010, 01:20:29 pm
Should be ok now.

Do you have some «lag» or is it really smooth ? (If you move your mouse too fast the shape doesn't go exactly to the border ? Is it the same on Linux/Win ? Is it the same with SFML 1 ? I don't thing so but I can't try.)
Title: SFML 2 for OS X comes true!
Post by: ratzlaff on December 21, 2010, 03:57:43 pm
Quote from: "Hiura"
Should be ok now.

Do you have some «lag» or is it really smooth ? (If you move your mouse too fast the shape doesn't go exactly to the border ? Is it the same on Linux/Win ? Is it the same with SFML 1 ? I don't thing so but I can't try.)


I dont have any noticeable lag, but if I move my mouse outside of the window really fast, then yeah, the rectangle isnt on the very edge. I have not tried it on other platforms.
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 21, 2010, 03:59:44 pm
Quote
if I move my mouse outside of the window really fast, then yeah, the rectangle isnt on the very edge.

This is ok, when moving too fast you can "skip" pixels.
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 21, 2010, 05:20:34 pm
yes, but how many ? up to 40px is ok for you ? It seems huge to me but it is also quite easy to "patch" this.
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 21, 2010, 05:52:48 pm
But there's nothing wrong here, what would you patch?? We skip pixels because the OS can't generate MouseMove events for every single pixel that the mouse crosses.
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 21, 2010, 06:04:12 pm
I REALLY need to take more time to put my idea out of my head....

By «it is also quite easy to "patch" this.» I meant «we can take the two last mouse position and find approximatively where the mouse went out of the window»... I promise, I'll make some effort! :roll:
Title: SFML 2 for OS X comes true!
Post by: Laurent on December 21, 2010, 06:05:36 pm
:mrgreen:
Title: SFML 2 for OS X comes true!
Post by: automata on December 25, 2010, 07:09:43 am
Merry Christmas, Hiura; you've been making some great progress with the port! Keep up the good work.

My 32-bit OSX system choked on the current SVN commit; it looks like the precompiled sndfile library got built for 64-bits only. I was able to build from the SVN about a month ago on this system, so it's probably just a minor regression.

Code: [Select]
[ 84%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundStream.cpp.o
Linking CXX shared library ../../../lib/libsfml-audio.dylib
ld: warning: in /Users/Laptop/Documents/sfml2/extlibs/libs-osx/Frameworks/sndfile.framework/sndfile, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
  "_sf_open", referenced from:
      sf::priv::SoundFile::OpenRead(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in SoundFile.cpp.o
      sf::priv::SoundFile::OpenWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)in SoundFile.cpp.o
  "_sf_open_virtual", referenced from:
      sf::priv::SoundFile::OpenRead(void const*, unsigned long)in SoundFile.cpp.o
  "_sf_seek", referenced from:
      sf::priv::SoundFile::Seek(float)in SoundFile.cpp.o
  "_sf_write_short", referenced from:
      sf::priv::SoundFile::Write(short const*, unsigned long)in SoundFile.cpp.o
  "_sf_strerror", referenced from:
      sf::priv::SoundFile::OpenRead(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in SoundFile.cpp.o
      sf::priv::SoundFile::OpenWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)in SoundFile.cpp.o
      sf::priv::SoundFile::OpenRead(void const*, unsigned long)in SoundFile.cpp.o
  "_sf_read_short", referenced from:
      sf::priv::SoundFile::Read(short*, unsigned long)in SoundFile.cpp.o
  "_sf_close", referenced from:
      sf::priv::SoundFile::~SoundFile()in SoundFile.cpp.o
      sf::priv::SoundFile::~SoundFile()in SoundFile.cpp.o
      sf::priv::SoundFile::OpenRead(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in SoundFile.cpp.o
      sf::priv::SoundFile::OpenWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)in SoundFile.cpp.o
      sf::priv::SoundFile::OpenRead(void const*, unsigned long)in SoundFile.cpp.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [lib/libsfml-audio.2.0.0.dylib] Error 1
make[1]: *** [src/SFML/Audio/CMakeFiles/sfml-audio.dir/all] Error 2
make: *** [all] Error 2
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 25, 2010, 07:13:00 pm
Merry Christmas to you too!

Looks weird. This framework was build month ago by Ceylo and worked fine until now. Does the following command
Code: [Select]
file /Users/Laptop/Documents/sfml2/extlibs/libs-osx/Frameworks/sndfile.framework/sndfile give you something like
Quote
sndfile: Mach-O universal binary with 3 architectures
sndfile (for architecture ppc):   Mach-O dynamically linked shared library ppc
sndfile (for architecture i386):   Mach-O dynamically linked shared library i386
sndfile (for architecture x86_64):   Mach-O 64-bit dynamically linked shared library x86_64
? If you try to delete it and get it back, does it change anything ?
Title: SFML 2 for OS X comes true!
Post by: Mon ouïe on December 25, 2010, 10:38:28 pm
I had a similar issue. Files which were supposed to be symlinks had been replaced by normal files containing the path to the actual file. Making the symlinks myself worked until the installation, at which point I... simply removed my symlinks and copied the files :p

Code: [Select]
ld: warning: in /Users/Laptop/Documents/sfml2/extlibs/libs-osx/Frameworks/sndfile.framework/sndfile, file was built for unsupported file format which is not the architecture being linked (x86_64)
That doesn't mean it was only built for x86_64. That means the architecture being linked is x86_64. ;)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 20, 2011, 01:54:00 pm
A little bug to submit about the mouse position with the different event types.

Mouse move event is ok.
Mouse wheel event contains a wrong position.
Mouse button pressed event contains a wrong position.
Mouse button release event contains a wrong position.

The code I used :
Code: [Select]
#include <SFML/Graphics.hpp>
#include <cstdio>

using namespace sf;

int main()
{
    RenderWindow win(sf::VideoMode(640, 480), "huhu");
    Event ev;
   
    while (win.IsOpened())
    {
        while (win.GetEvent(ev))
        {
            if (ev.Type == Event::KeyPressed)
            {
                if (ev.Key.Code == Key::Escape)
                    win.Close();
            }
            else if (ev.Type == Event::MouseMoved)
                printf("moved : %d %d\n", ev.MouseMove.X, ev.MouseMove.Y);
            else if (ev.Type == Event::MouseWheelMoved)
                printf("wheel : %d %d\n", ev.MouseWheel.X, ev.MouseWheel.Y);
            else if (ev.Type == Event::MouseButtonPressed)
                printf("pressed : %d %d\n", ev.MouseButton.X, ev.MouseButton.Y);
            else if (ev.Type == Event::MouseButtonReleased)
                printf("released : %d %d\n", ev.MouseButton.X, ev.MouseButton.Y);
        }
       
        win.Clear();
        win.Display();
    }
    return 0;
}
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 20, 2011, 02:04:51 pm
Thanks, now it's fixed! =)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 20, 2011, 02:24:35 pm
Great :D

Do you have some news about the other bugs ?
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 20, 2011, 02:29:01 pm
I'm currently installing a bug tracker because I forget everything. So I think tomorrow I'll be able to work on the others bugs. at last!
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 21, 2011, 08:55:05 pm
About
Quote from: "A long time ago Ceylo"
sf::Window::SetPosition(0, 0) does not put the window at the right place as far as the Y axis is concerned.

I cannot reproduce the bug with the following code.
Code: [Select]

#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>

#include <iostream>

int main(int, char**) {
    sf::Window window(sf::VideoMode(800, 600, 32), "SFML");
   
    window.SetPosition(0, 0);
   
    while (window.IsOpened()) {
        sf::Event event;
        while (window.GetEvent(event)) {
            if (event.Type == sf::Event::Closed ||
                (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Key::Escape)) {
                window.Close();
            }
        }
       
        glClear(GL_COLOR_BUFFER_BIT);
       
        window.Display();
    }
   
    return 0;
}

Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 21, 2011, 10:02:27 pm
With your code and the latest sources, I still get the same bug :? . The window is put on the left of the screen but not in the top left corner (rather in the middle of the height).
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 21, 2011, 10:04:58 pm
Which version of OSX do you use ?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 21, 2011, 10:06:53 pm
Mac OS X 10.6.6
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 21, 2011, 10:16:09 pm
Ok, That's strange... I'm using the same version...

What is your screen resolution and what do you get with
Code: [Select]
NSLog(@"Screen Height : %f", NSHeight([[myWindow screen] visibleFrame])); (inserted on line 265 of SFWindowController.mm) ?

Have you any plugins to manage window size or anything like that ?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 21, 2011, 10:23:59 pm
Your line says :
Quote
2011-01-21 22:22:52.038 sf[10700:903] Screen Height : 717.000000


My screen size is 1280x800. I have no plugin to manage the window size or whatever :P .
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 21, 2011, 10:29:28 pm
You have a dock on the bottom of your screen set not to hide. (That's not a question.  :P ) That's why it doesn't work for you.

Now I have to find something else to workaround that stuff. Shouldn't take too long.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 21, 2011, 11:43:35 pm
should be ok now.  :wink:
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 22, 2011, 12:59:25 am
Indeed it is :) .
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 22, 2011, 10:25:50 am
Now about
Quote
Creating a window and then calling sf::Window::Create() on the same window object makes the app crash randomly.

Does the following code crash ?
Code: [Select]
#include <SFML/Window.hpp>

int main(int, char**) {
   
    sf::Window window(sf::VideoMode(800, 600), "SFML");
   
    sf::Clock clock;
    while (clock.GetElapsedTime() < 100.f) {
        window.Create(sf::VideoMode(800, 600), "SFML");
        sf::Sleep(0.1); // not required.
    }
   
    return 0;
}
I can't reproduce the bug here.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 22, 2011, 10:43:04 am
Your code doesn't crash, but the following one does:
Code: [Select]
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>

int main(int, char**) {
   
    sf::Window window(sf::VideoMode(800, 600), "SFML");
   
    sf::Clock clock;
    while (clock.GetElapsedTime() < 100.f) {
        window.Create(sf::VideoMode(800, 600), "SFML");

sf::Event ev;
while (window.GetEvent(ev)) {

}

glClear(GL_COLOR_BUFFER_BIT);
window.Display();
        sf::Sleep(0.1); // not required.
    }
   
    return 0;
}


P.S.: it seems to crash as soon as you add the event handling code.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 24, 2011, 12:51:42 am
WHaou! That was some serious bug! (5 different backtraces for the same bug (love memory guard) plus one other bug which gave me some weird «-[NSConcreteValue windowDidResignKey:] unrecognized selector sent to instance» comming from nowhere..) :shock:

Can you confirm it's working properly now ?
Title: SFML 2 for OS X comes true!
Post by: Kolja on January 24, 2011, 01:13:38 pm
Hey there!

Another Mac user here, I'll try to help with some testing when I find the time (currently it's exam time here though, so not now). But I'm really glad you are helping the OS X port along!

During my initial compile of the current SVN tarball I noticed (apart from the broken sndfile symlink) that all graphical examples only display something after the window has been obscured or moved - known bug or weird behavior on my system?

I'm on a MBP running 10.6.6 by the way, using the GeForce 9400M for now.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 24, 2011, 01:56:59 pm
Hi! Happy to see a new face. :)

I tried to reproduce the problem you described but I couldn't reproduce it (even with the tar.gz) and I have the same hardware/OS version.

Have you any other app non related to SFML that have the same behaviour ?
Maybe you haven't updated your driver ?
Any plugins ?

It's very weird..
Title: SFML 2 for OS X comes true!
Post by: Kolja on January 24, 2011, 02:09:04 pm
D'oh, sorry to have taken away your time. A reboot fixed it, now it works with both graphics cards. I'm not totally sure how such a bug "works" though, other hardware accelerated games worked fine.
Title: SFML 2 for OS X comes true!
Post by: Kolja on January 24, 2011, 02:15:54 pm
On an unrelated note, shaders in the examples directory are something SFML-specific, right? Because the example only tells me that shaders are unsupported on my system, but GLSL definitely works here ;-)
I only use SFML for audio, input and a cross-platform OpenGL context I do my own drawing in, so all the graphics and sprite features of SFML don't concern me too much.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 24, 2011, 02:28:33 pm
Same here -> added to my task list. I'll have a look soon.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 24, 2011, 04:13:24 pm
Quote from: "Hiura"
WHaou! That was some serious bug! (5 different backtraces for the same bug (love memory guard) plus one other bug which gave me some weird «-[NSConcreteValue windowDidResignKey:] unrecognized selector sent to instance» comming from nowhere..) :shock:

Can you confirm it's working properly now ?

It's working fine now, or at least... the given code does no more crash.
Title: SFML 2 for OS X comes true!
Post by: ideal phi on January 28, 2011, 07:02:38 pm
If you guys haven't got the joystick working for Mac OS X, there is a sample here:
http://homepage3.nifty.com/ysflight/macdev/joystick/e.html
Title: SFML 2 for OS X comes true!
Post by: Trunks7j on January 28, 2011, 08:40:02 pm
Hiura, thanks for your work on SFML2.

For reference, I am running OSX 10.6.4, gcc 4.2.1.  I was able to build the static libraries successfully using cmake -> unix makefiles.  However when trying to compile any of the graphical examples provided with SFML2, I get lots of undefined symbols.  I can paste the first third or so here:

Code: [Select]
Undefined symbols:
  "_jpeg_write_scanlines", referenced from:
      sf::priv::ImageLoader::WriteJpg(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int, unsigned int)in libsfml-graphics-s-d.a(ImageLoader.cpp.o)
  "_FT_Get_Char_Index", referenced from:
      sf::Font::GetKerning(unsigned int, unsigned int, unsigned int) constin libsfml-graphics-s-d.a(Font.cpp.o)
      sf::Font::GetKerning(unsigned int, unsigned int, unsigned int) constin libsfml-graphics-s-d.a(Font.cpp.o)
  "_objc_msgSend_fpret", referenced from:
      -[SFWindowController resizeTo:by:] in libsfml-window-s-d.a(SFWindowController.mm.o)
      -[SFWindowController setWindowPositionToX:Y:] in libsfml-window-s-d.a(SFWindowController.mm.o)
      -[SFWindowController screenHeight] in libsfml-window-s-d.a(SFWindowController.mm.o)
      -[SFOpenGLView scrollWheel:] in libsfml-window-s-d.a(SFOpenGLView.mm.o)
  ".objc_class_name_NSOpenGLPixelFormat", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSOpenGLPixelFormat in libsfml-window-s-d.a(SFContext.mm.o)
  "___glewUniform2fARB", referenced from:
      ___glewUniform2fARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewUniform2fARB$non_lazy_ptr)
  "___glewCreateProgramObjectARB", referenced from:
      ___glewCreateProgramObjectARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewCreateProgramObjectARB$non_lazy_ptr)
  "_FT_New_Face", referenced from:
      sf::Font::LoadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libsfml-graphics-s-d.a(Font.cpp.o)
  "_CGDisplayPixelsWide", referenced from:
      sf::priv::VideoModeImpl::GetDesktopMode()     in libsfml-window-s-d.a(VideoModeImpl.cpp.o)
      sf::priv::VideoModeImpl::GetFullscreenModes()     in libsfml-window-s-d.a(VideoModeImpl.cpp.o)
  "___GLEW_ARB_vertex_shader", referenced from:
      ___GLEW_ARB_vertex_shader$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___GLEW_ARB_vertex_shader$non_lazy_ptr)
  ".objc_class_name_NSObject", referenced from:
      .objc_class_name_SFApplication in libsfml-window-s-d.a(SFApplication.m.o)
  "___glewCompileShaderARB", referenced from:
      ___glewCompileShaderARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewCompileShaderARB$non_lazy_ptr)
  "_FT_Get_Glyph", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin libsfml-graphics-s-d.a(Font.cpp.o)
  "_NSCalibratedRGBColorSpace", referenced from:
      _NSCalibratedRGBColorSpace$non_lazy_ptr in libsfml-window-s-d.a(SFWindowController.mm.o)
     (maybe you meant: _NSCalibratedRGBColorSpace$non_lazy_ptr)
  ".objc_class_name_NSString", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSString in libsfml-window-s-d.a(cpp_objc_conversion.mm.o)
  "___glewDeleteObjectARB", referenced from:
      ___glewDeleteObjectARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewDeleteObjectARB$non_lazy_ptr)
  "___glewGetObjectParameterivARB", referenced from:
      ___glewGetObjectParameterivARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewGetObjectParameterivARB$non_lazy_ptr)
  "___CFConstantStringClassReference", referenced from:
      cfstring=--------RRRRRRRRGGGGGGGGBBBBBBBB in libsfml-window-s-d.a(VideoModeImpl.cpp.o)
      cfstring=-RRRRRGGGGGBBBBB in libsfml-window-s-d.a(VideoModeImpl.cpp.o)
      cfstring=PPPPPPPP in libsfml-window-s-d.a(VideoModeImpl.cpp.o)
      cfstring=NSScreenNumber in libsfml-window-s-d.a(SFWindowController.mm.o)
  ".objc_class_name_NSCursor", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSCursor in libsfml-window-s-d.a(SFWindowController.mm.o)
  "___glewGetInfoLogARB", referenced from:
      ___glewGetInfoLogARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewGetInfoLogARB$non_lazy_ptr)
  ".objc_class_name_NSNotificationCenter", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSNotificationCenter in libsfml-window-s-d.a(SFOpenGLView.mm.o)
  "___glewUniform3fARB", referenced from:
      ___glewUniform3fARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewUniform3fARB$non_lazy_ptr)
  "_FT_Done_Glyph", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin libsfml-graphics-s-d.a(Font.cpp.o)
  "_GetCurrentProcess", referenced from:
      sf::priv::WindowImplCocoa::SetUpProcessAsApplication()     in libsfml-window-s-d.a(WindowImplCocoa.mm.o)
  "___glewUseProgramObjectARB", referenced from:
      ___glewUseProgramObjectARB$non_lazy_ptr in libsfml-graphics-s-d.a(Renderer.cpp.o)
      ___glewUseProgramObjectARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewUseProgramObjectARB$non_lazy_ptr)
  "___GLEW_ARB_fragment_shader", referenced from:
      ___GLEW_ARB_fragment_shader$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___GLEW_ARB_fragment_shader$non_lazy_ptr)
  "_FT_Select_Charmap", referenced from:
      sf::Font::LoadFromMemory(void const*, unsigned long)in libsfml-graphics-s-d.a(Font.cpp.o)
      sf::Font::LoadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libsfml-graphics-s-d.a(Font.cpp.o)
  "___glewCreateShaderObjectARB", referenced from:
      ___glewCreateShaderObjectARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewCreateShaderObjectARB$non_lazy_ptr)
  "___glewActiveTextureARB", referenced from:
      ___glewActiveTextureARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewActiveTextureARB$non_lazy_ptr)
  "_NSDefaultRunLoopMode", referenced from:
      _NSDefaultRunLoopMode$non_lazy_ptr in libsfml-window-s-d.a(SFApplication.m.o)
     (maybe you meant: _NSDefaultRunLoopMode$non_lazy_ptr)
  "_jpeg_finish_compress", referenced from:
      sf::priv::ImageLoader::WriteJpg(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int, unsigned int)in libsfml-graphics-s-d.a(ImageLoader.cpp.o)
  ".objc_class_name_NSResponder", referenced from:
      .objc_class_name_SFWindowController in libsfml-window-s-d.a(SFWindowController.mm.o)
  "_FT_Bitmap_Embolden", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin libsfml-graphics-s-d.a(Font.cpp.o)
  "___GLEW_ARB_shader_objects", referenced from:
      ___GLEW_ARB_shader_objects$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___GLEW_ARB_shader_objects$non_lazy_ptr)
  "_CGDisplayMoveCursorToPoint", referenced from:
      -[SFWindowController setCursorPositionToX:Y:] in libsfml-window-s-d.a(SFWindowController.mm.o)
  ".objc_class_name_NSOpenGLView", referenced from:
      .objc_class_name_SFOpenGLView in libsfml-window-s-d.a(SFOpenGLView.mm.o)
  "_jpeg_stdio_dest", referenced from:
      sf::priv::ImageLoader::WriteJpg(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int, unsigned int)in libsfml-graphics-s-d.a(ImageLoader.cpp.o)
  "_FT_Glyph_To_Bitmap", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin libsfml-graphics-s-d.a(Font.cpp.o)
  "_TransformProcessType", referenced from:
      sf::priv::WindowImplCocoa::SetUpProcessAsApplication()     in libsfml-window-s-d.a(WindowImplCocoa.mm.o)
  "_NSApp", referenced from:
      _NSApp$non_lazy_ptr in libsfml-window-s-d.a(SFWindowController.mm.o)
      _NSApp$non_lazy_ptr in libsfml-window-s-d.a(SFApplication.m.o)
     (maybe you meant: _NSApp$non_lazy_ptr)
  "_FT_Outline_Embolden", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin libsfml-graphics-s-d.a(Font.cpp.o)
  "___glewAttachObjectARB", referenced from:
      ___glewAttachObjectARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewAttachObjectARB$non_lazy_ptr)
  "_CGWindowLevelForKey", referenced from:
      -[SFWindowController initWithMode:andStyle:] in libsfml-window-s-d.a(SFWindowController.mm.o)
  "___glewUniform4fARB", referenced from:
      ___glewUniform4fARB$non_lazy_ptr in libsfml-graphics-s-d.a(Shader.cpp.o)
     (maybe you meant: ___glewUniform4fARB$non_lazy_ptr)
  ".objc_class_name_NSBitmapImageRep", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSBitmapImageRep in libsfml-window-s-d.a(SFWindowController.mm.o)
  "_objc_msgSend", referenced from:


I have not tried with the dynamic libraries yet, will do that asap.

Edit: There appears to be no problem linking against the dynamic libs, only when I uncheck "BUILD_SHARED_LIBS" in cmake and then compile the examples to I get these errors.[/b]
Title: SFML 2 for OS X comes true!
Post by: Laurent on January 28, 2011, 10:11:33 pm
There's no link step when creating static libraries, they are just archives of compiled files. Therefore, none of the external dependencies of SFML is "pre-linked", you need to link them to your final application.

Dyanmic libraries should be preferred, if you can use them. Static libraries are just a way to workaround the lack of shared library management on Windows and the mess it creates.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 29, 2011, 01:02:51 am
Quote from: "ideal phi"
If you guys haven't got the joystick working for Mac OS X, there is a sample here:
http://homepage3.nifty.com/ysflight/macdev/joystick/e.html


Thank you, I'll have a look but I think I won't use it – I prefer do it myself even I it takes time because I don't want external dependences, but this may be to be discussed if it is very adapted to SFML joystick backend, of course.

PS: Laurent, I see you're always the fastest, great job  :D
I'd like to emphasize this a lot :
Quote
Dyanmic libraries should be preferred, if you can use them.


(On Mac, you can put your app dependencies into your app bundle (the .app folder thus installing your app won't be difficult at all) so use shared/dynamic lib as often as possible. It might even have better overall performances.)
Title: SFML 2 for OS X comes true!
Post by: ideal phi on January 29, 2011, 01:16:40 am
Quote from: "Hiura"

Thank you, I'll have a look but I think I won't use it – I prefer do it myself even I it takes time because I don't want external dependences, but this may be to be discussed if it is very adapted to SFML joystick backend, of course.


It should be a native example. There aren't any external dependencies outside the norm.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 05, 2011, 03:34:46 pm
Quote
4. The arrow keys produce a text entered event but I suppose they should not.
This one should be OK now. Thanks to your workaround in SFML 1.x  :wink:

Quote from: "Ceylo"
1. When using fullscreen mode, you can only use the desktop video mode. Any other video mode will fail, saying it's invalid.
You should use sf::VideoMode::GetFullscreenModes() modes for fullscreen app – but there is something wrong with my implementation of this function : sf::VideoMode::GetFullscreenModes().size() is 1. I'm working on it.  :wink:
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 05, 2011, 08:38:37 pm
I have this idea but I don't know if it is consistent with SFML's behaviour on other OSes. I was thinking about multiscreen and I came with a (plausible) method to give the user a way to take advantage of a secondary screen (or more).

The idea is that GetFullscreenModes contains all available modes for all screens.

For example a user has a main screen of resolution 1440x900 and a (better) secondary screen of resolution 1920x1080, the app could choose to create a fullscreen window of 1920x1080 and display it on the best screen.

For each mode in GetFullscreenModes that is available for the main screen the window would be displayed here otherwise it would be displayed on the first secondary screen where the mode is available. In fact, a SFML user wouldn't be able to choose programmatically a specific screen unless we change the public API.

But I don't really know : is it «overkill» or out of scoop ? I don't want to be too different from Linux or Windows about user experience.
Title: SFML 2 for OS X comes true!
Post by: Laurent on February 06, 2011, 01:31:06 am
This is clearly out of scope at the moment. Until SFML officially handles multiple monitors, you shouldn't try to do anything else than using the primary display and assuming it is the only one that exists, in your implementation.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 06, 2011, 01:33:17 am
ouki doki  :)
Title: SFML 2 for OS X comes true!
Post by: SkyJedi on February 06, 2011, 11:37:44 am
Hey :)

I built the lib on OS X 10.6; I did exactly what you said on your post (first page); but there are errors :
http://img695.imageshack.us/img695/1862/capturedcran20110206113.png


And here's my code :
Code: [Select]
#include <stdio.h>
#include <SFML/Window.hpp>

int main (int argc, const char * argv[]) {
    // insert code here...
    printf("Hello, World!\n");
    return 0;
}

(just added the include)

Can you help me please ? =/

EDIT :
Code: [Select]
mac-pro-de-nico:~ nico$ find /usr/ -name climits && find /Developer/ -name climits
/usr//include/c++/4.0.0/climits
/usr//include/c++/4.2.1/climits
/usr//include/c++/4.2.1/tr1/climits
/Developer//SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/climits
/Developer//SDKs/MacOSX10.6.sdk/usr/include/c++/4.0.0/climits
/Developer//SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/climits
/Developer//SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/tr1/climits


And there are 102 errors in Release; 34 in debug.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 06, 2011, 12:09:42 pm
does this help you ? http://www.sfml-dev.org/forum/viewtopic.php?p=11580#11580
Title: SFML 2 for OS X comes true!
Post by: SkyJedi on February 06, 2011, 12:45:54 pm
Nope, already tried it :/

EDIT:
weird cause this http://www.mediafire.com/?3dxc2vs0wbd3c3n works fine.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 06, 2011, 02:59:17 pm
Can you upload your project ?
Title: SFML 2 for OS X comes true!
Post by: SkyJedi on February 06, 2011, 03:32:10 pm
Sure : http://www.mediafire.com/?jzxp0zeeeswmj94
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 06, 2011, 04:25:52 pm
Well, it was tricky – I've updated my post on first page, thanks for your messages. :)

First, rename your main.c to main.cpp – this way Xcode will search also C++ headers.

Then, open your target info panel and go to the build tab. Here you've add /usr/local/insclude/ to search path only for release configuration. So select All Configuration and add /usr/local/insclude/ to header search path.

Enjoy  :wink:
Title: SFML 2 for OS X comes true!
Post by: SkyJedi on February 06, 2011, 04:59:51 pm
Thank you very much, works fine now =D
Title: fullscreen mode
Post by: Hiura on February 07, 2011, 06:42:50 pm
I've got a dilemma so I need your help to choose between the two solutions I've found so far about how implement fullscreen for non-desktop video mode. (A 'desktop-mode' window in fullscreen produces no issue.)

The first solution is to «capture» the screen (which allow only one app to use it, the user cannot switch to another app). The only way to use another app is to close the window which will «release» the screen.

To use this technique and have the window displayed I must set its level to CGShieldingWindowLevel, which is not recommended. [2]

I didn't see any issue with this and I think it's because I don't use fullscreen context strictly speaking (I use one big window that has the size of the screen [1] ). So this should work.

But as said before, it doesn't allow the user to switch to another application – which is very bad, I think.

The second solution doesn't use display capture thus the user can use cmd+tab to switch to his mail app for example. But it has also a bad behaviour : when an app change the screen size without capturing the display some other app's windows may be resized (Finder, Mail, iTunes, .... almost every app in fact). Which is very bad for user experience (who wants to use an app that resize every window or rearrange your desktop files ? ).

Until now I haven't found a way to prevent windows to resize when changing screen size. (Maybe someone else knows ?)

So I ask you, which one should I use ?
A) no window resized but cannot switch from app.
B) can switch to another app but the windows might be resized.


–––––––––––––––––––

Further reading – not required to follow the discussion :


[1] the doc says here (http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/QuartzDisplayServicesConceptual/Articles/DisplayCapture.html%23//apple_ref/doc/uid/TP40004228-SW1) (at the bottom) the following about fullscreen window vs fullscreen context :

Quote from: "The doc"
Note: It’s not necessary to capture a display to do full-screen drawing. Another approach is to create and draw into a borderless window the size of the display. This approach allows you to use all the features of the windowing system. It also plays well with the rest of the operating system, and it reduces the complexity of display handling (for example, you don’t have to worry about mirrored displays). With this approach, you can receive error alerts that might be missed with a captured display. You can also use Command-Tab to change applications with this approach. On systems with modern graphics hardware, drawing performance in a full-screen window is almost as fast as a full-screen drawing context


[2] here (http://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html#//apple_ref/c/func/CGShieldingWindowLevel)

Quote from: "The doc"
This function returns a value that is sometimes used to position a window over the shield window for a captured display. Attempting to position a window over a captured display may be unsuccessful—or it may present undesirable results such as illegible or invisible content—because of interactions between full-screen graphics (such as OpenGL full-screen drawing contexts) and the graphics hardware. Because of these limitations, this technique is not recommended.


PS : two days on it – I'm getting crazy ...

EDIT : typo
Title: SFML 2 for OS X comes true!
Post by: Kolja on February 07, 2011, 07:21:15 pm
Having played a bit of StarCraft 2 over the last days, I would suggest option A, the one used by SC2.
It's a bit weird when Cmd+Tab doesn't work, but we're mostly making games or game-like applications so most people are used to such behavior.
Switching to a windowed mode can be implemented via a shortcut, so that can be used if you want to access your IM while playing. And AFAIK (please correct me if I'm wrong), such a switch can be done without having to reload all resources (e.g. textures), so it's still relatively fast.

On a slightly unrelated note: OS X still does not offer exclusive access to the video hardware, right? Because the window manager never shuts off hardware acceleration, like Win7 does for example.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 07, 2011, 07:48:34 pm
I don't really understand why you don't use this way:

1.
- capture the screen
- save the desktop video mode
- switch to the wished video mode

2. when the user uses Cmd+Tab or wants to exit the app:
- switch back to the desktop mode
- release the screen

when the user comes back again to your app, do again the first step.
Isn't it possible? And doesn't it fix both issues?
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 08, 2011, 10:10:35 am
Quote from: "Kolja"
Switching to a windowed mode can be implemented via a shortcut, so that can be used if you want to access your IM while playing.
Yes, but not all applications want to do that (it might be a very bad user experience in some cases). So

Quote from: "Kolja"
And AFAIK (please correct me if I'm wrong), such a switch can be done without having to reload all resources (e.g. textures), so it's still relatively fast.
Not always : sometime, depending on the screen size, you might want to load different image files (higher/lower resolution).

Quote from: "Kolja"
On a slightly unrelated note: OS X still does not offer exclusive access to the video hardware, right?
I think it do offer such access but I don't know how (with Quartz framework maybe).

@Ceylo,

The problem is that when you capture the screen cmd+tab won't work at all.

Currently I implement the option B) kind of like you do in 1.6 except I use NSWindow's delegate methods (windowDidBecomeKey/ResignKey) instead of NSApplication notifications.
Title: SFML 2 for OS X comes true!
Post by: Kolja on February 08, 2011, 10:57:24 am
Quote from: "Hiura"
Quote from: "Kolja"
Switching to a windowed mode can be implemented via a shortcut, so that can be used if you want to access your IM while playing.
Yes, but not all applications want to do that (it might be a very bad user experience in some cases). So

Yeah, OK, but I doubt you will find a solution that pleases everyone. I presented my point of view and, as I said, it's a solution that is used by commercial applications as well. Maybe I'll take a look at Source engine games today, see what they do.

Quote from: "Hiura"
Quote from: "Kolja"
And AFAIK (please correct me if I'm wrong), such a switch can be done without having to reload all resources (e.g. textures), so it's still relatively fast.
Not always : sometime, depending on the screen size, you might want to load different image files (higher/lower resolution).

Of course, but you don't have to reload anything. So it can be done in a fast way, but there might be situations where it could take more time, depending on ones application.

Quote from: "Hiura"
Quote from: "Kolja"
On a slightly unrelated note: OS X still does not offer exclusive access to the video hardware, right?
I think it do offer such access but I don't know how (with Quartz framework maybe).

Huh, okay. I always blamed OS X's poor gaming performance on the non-exclusivity, guess I'll have to shift my blame to the drivers then ;-)

Quote from: "Hiura"
@Ceylo,

The problem is that when you capture the screen cmd+tab won't work at all.

Currently I implement the option B) kind of like you do in 1.6 except I use NSWindow's delegate methods (windowDidBecomeKey/ResignKey) instead of NSApplication notifications.

I guess Ceylo means capturing Cmd+Tab yourself, switching to desktop mode, release the screen, and resend a Cmd+Tab-Event to the system.


And to clarify my rooting for solution A, I always have something open while playing a game. Under normal circumstances I never have to resize a window, because the window manager remembers all my preferences, but when a fullscreen application screws it up it's really a hassle to get all windows back to their optimum sizes.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 08, 2011, 12:26:04 pm
Quote from: "Kolja"

I guess Ceylo means capturing Cmd+Tab yourself, switching to desktop mode, release the screen, and resend a Cmd+Tab-Event to the system.
Could be a solution, I'll try that.  (But it won't enable trackpad gesture to switch app. So I'm still looking for something better if it exists)

Quote from: "Kolja"

And to clarify my rooting for solution A, I always have something open while playing a game. Under normal circumstances I never have to resize a window, because the window manager remembers all my preferences, but when a fullscreen application screws it up it's really a hassle to get all windows back to their optimum sizes.
Yes, that's my main concern too.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 08, 2011, 12:58:40 pm
Quote from: "Hiura"
@Ceylo,

The problem is that when you capture the screen cmd+tab won't work at all.

Oh... ok. It doesn't want to switch to another app or is it only the display that's locked for the current app? You get no "deactivated" notification?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 08, 2011, 01:03:57 pm
Quote from: "Kolja"
I guess Ceylo means capturing Cmd+Tab yourself, switching to desktop mode, release the screen, and resend a Cmd+Tab-Event to the system.

Uh... well, no. I wasn't thinking of such a thing. It becomes too heavy to handle and you may forget some ways of switching between apps. The best way is still catching the notification telling that the app lost focus, if possible.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 08, 2011, 01:18:53 pm
Quote from: "Ceylo"
Oh... ok. It doesn't want to switch to another app or is it only the display that's locked for the current app? You get no "deactivated" notification?
Well, I don't know exactly but it seems like application switch is completely deactivated from the OS. And the documentation doesn't specify any notification. So I guess it really authorizes only one app on the screen.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 08, 2011, 01:54:03 pm
Hum ok. I've looked at the GLFullscreen sample provided by Apple and there is the same issue.

So... from what I understand, the issue is that icons and windows will be resized if you change the screen resolution while not capturing the screen.

As CGDisplaySiwtchToMode() is deprecated since Mac OS X 10.6, I had been looking for another way of setting a different screen resolution. And I had found one (I've just been noticing there's CGDisplaySetDisplayMode() now, but that's another point...). This solution is to keep the native screen resolution, but change the OpenGL buffer size.

Here is it (http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_contexts/opengl_contexts.html), section "Controlling the Back Buffer Size".

This lets you choose ANY resolution (even non common ones) but as a drawback, I think you also have to properly handle how the rendering is supposed to fit your screen (keep unused areas or not). I haven't done any deep researches toward this solution, but it could fit your needs.

It allows any "screen" resolution and you don't need to capture the screen.
Title: SFML 2 for OS X comes true!
Post by: Kolja on February 08, 2011, 03:09:23 pm
Wouldn't such a solution imply that every frame would have to be scaled accordingly? Are the performance impacts of that small enough?

Otherwise, nice find!
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 08, 2011, 03:50:29 pm
Good news first :
That's work pretty well! I can switch app without any window resized!

I didn't have any performance issue with an heavy benchmark (posted here (http://www.sfml-dev.org/forum/viewtopic.php?p=25912&highlight=java#25912) with little modifications)

Bad news :
The mouse position given by sf::Event are not good – I have to modify this part to recompute the mouse coordinate.

So be patient a little bit more.  :)
Title: SFML 2 for OS X comes true!
Post by: zenkimoto on February 09, 2011, 07:25:57 am
Hi All!  I downloaded the latest copy of SFML 2.0 from the SVN repository and loaded it up with CMake.  Then I opened it up with XCode just fine.  However, when I try to compile I get the following errors:

Code: [Select]

ignoring file /Users/username/Desktop/sfml2/extlibs/libs-osx/Frameworks/sndfile.framework/sndfile, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
  "_sf_seek", referenced from:
      sf::priv::SoundFile::Seek(float)in SoundFile.o
  "_sf_write_short", referenced from:
      sf::priv::SoundFile::Write(short const*, unsigned long)in SoundFile.o
  "_sf_read_short", referenced from:
      sf::priv::SoundFile::Read(short*, unsigned long)in SoundFile.o
  "_sf_close", referenced from:
      sf::priv::SoundFile::~SoundFile()in SoundFile.o
      sf::priv::SoundFile::~SoundFile()in SoundFile.o
      sf::priv::SoundFile::OpenWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)in SoundFile.o
      sf::priv::SoundFile::OpenRead(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in SoundFile.o
      sf::priv::SoundFile::OpenRead(void const*, unsigned long)in SoundFile.o
  "_sf_open", referenced from:
      sf::priv::SoundFile::OpenWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)in SoundFile.o
      sf::priv::SoundFile::OpenRead(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in SoundFile.o
  "_sf_strerror", referenced from:
      sf::priv::SoundFile::OpenWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)in SoundFile.o
      sf::priv::SoundFile::OpenRead(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in SoundFile.o
      sf::priv::SoundFile::OpenRead(void const*, unsigned long)in SoundFile.o
  "_sf_open_virtual", referenced from:
      sf::priv::SoundFile::OpenRead(void const*, unsigned long)in SoundFile.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status


Nothing seemed to work and then I found out that the main culprit was sndfile.framework.  From reading from earlier posts, I decided to try this command:

Code: [Select]

file /Users/username/Desktop/sfml2/extlibs/libs-osx/Frameworks/sndfile.framework/sndfile


And this is what I get: ASCII text, with no line terminators

I decided to open up the sndfile.framework and noticed that links/aliases didn't show up.  They were just plain text files.  So I recreated them to no avail.  Atleast the "file" command recognizes it as data now, but it does not see a framework.  Anyone fix this problem or have any ideas?  I'm at a loss....

Thanks!
Title: SFML 2 for OS X comes true!
Post by: Kolja on February 09, 2011, 10:17:34 am
Hi!

Yeah, the symlinks are broken and not yet fixed for some reason. You need to link sndfile.framework/sndfile to, or replace it with, sndfile.framework/Versions/A/sndfile (paths from my memory, but you should be able to correct them if I'm wrong).

sndfile.framework should point to sndfile.framework/Versions/Current, which in turn should point to sndfile.framework/Versions/A/sndfile, but replacing directly works just as well. Doing this by hand should only be a temporarily necessary solution anyhow.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 09, 2011, 12:52:00 pm
I just committed a bunch of modifications, fullscreen should work now.

You might need to delete the cache of CMake and rebuild the Makefile.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 09, 2011, 01:31:42 pm
Fullscreen mode is working fine.. except that it fills the whole screen even when it should not.

When I set 1024x768 I expect to have black unused areas on the left and right of my screen because of the different ratio, but the screen is completely used. Thus the rendered image is stretched.





PS: if you want a piece of code giving the right position and size for the rendering area according to another area it's supposed to fit in, you can (if you wish) have a look at Movie::ResizeToFrame() in Movie.cpp of the sfeMovie project.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 09, 2011, 01:55:03 pm
Quote from: "Ceylo"
When I set 1024x768 I expect to have black unused areas on the left and right of my screen because of the different ratio
I don't know. I had such behaviour since ever (with Windows and Linux).

For example, most games will stretch the image to fit the screen if the aspect ratio of the video mode is not screen ration.

If SFML on Windows and Linux preserve the ratio then I'll do that for OSX too. Otherwise I won't – I rather prefer let the user choose a correct video mode or do something about the stretching in his own code than have a different behaviour from SFML on other OSes.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 09, 2011, 08:17:31 pm
Uh.. ok. I thought Windows and Linux were not filling the whole screen too (if the ratio was different). Sooo... ok, it's up to you.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 09, 2011, 08:55:53 pm
I tested this afternoon how a SFML window in fullscreen is rendered on Linux. Currently, it fill the whole screen too.

If Laurent want to change this behaviour I'll do the same. So you can make Laurent change his mind. ;-)

On another topic, I realise two things while testing event (again).

> I cannot make keys combination (like ^ and a produce â) work. Ceylo, Did you succeed in 1.6 ?

> I used sf::Text to display some stuff and I encounter the same problem I had some times ago : http://www.sfml-dev.org/forum-fr/viewtopic.php?p=30752#30752

The solution is still the same, if I had '-D_GLIBCXX_FULLY_DYNAMIC_STRING=1' to CMAKE_CXX_FLAGS it works fine.

So my question is : Laurent, can I add this to the CMake conf or is it not a good idea ? (I don't know what's good/bad/not recommended about this kind of stuff.)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 09, 2011, 10:30:13 pm
Quote from: "Hiura"
If Laurent want to change this behaviour I'll do the same. So you can make Laurent change his mind. ;-)

Well.. I don't really care until the behavior is the same as with Windows and Linux. I thought it was different :P .

Quote from: "Hiura"
> I cannot make keys combination (like ^ and a produce â) work. Ceylo, Did you succeed in 1.6 ?

Yup. I let NSText interpret these. See GLKit.mm line ~356.
Title: SFML 2 for OS X comes true!
Post by: Laurent on February 10, 2011, 07:44:46 am
Quote
When I set 1024x768 I expect to have black unused areas on the left and right of my screen because of the different ratio

???
I've never heard of that before, when you open a fullscreen window it covers the full screen. The OS won't handle the aspect ratio for you (unless there's something very specific built in OS X).

Quote
So my question is : Laurent, can I add this to the CMake conf or is it not a good idea ? (I don't know what's good/bad/not recommended about this kind of stuff.)

Add whatever is necessary. I don't know much about this flag and why it makes things work, but if it's a bug on your side you should rather fix it, and if it's a bug in OS X gcc then there's nothing you can do except adding the flag. But if you do so, make sure that you restrict it as much as possible (if the bug happens only on OS X and with a certain version of gcc, you should write this condition in the CMake makefile).
Title: SFML 2 for OS X comes true!
Post by: Groogy on February 10, 2011, 08:36:30 am
Quote from: "Laurent"
Quote
When I set 1024x768 I expect to have black unused areas on the left and right of my screen because of the different ratio

???
I've never heard of that before, when you open a fullscreen window it covers the full screen. The OS won't handle the aspect ratio for you (unless there's something very specific built in OS X).


I think it's the screen that does it. It is done on any 16:9 screens when changing to a low res 4:3.
Title: SFML 2 for OS X comes true!
Post by: devlin on February 10, 2011, 08:55:19 am
Quote from: "Ceylo"
Fullscreen mode is working fine.. except that it fills the whole screen even when it should not.

When I set 1024x768 I expect to have black unused areas on the left and right of my screen because of the different ratio, but the screen is completely used. Thus the rendered image is stretched.

This kind of functionality is not very common apart from some TV settings  where the TV is running at its native resolution and you feed it a lower resolution image.

You can mimic this behaviour by setting the fullscreen window to run at the screens native resolution and then setting up a glPerspective with 1:1 ratio and a centered viewport and/or scissor rectangle with the "desired" resolution. (i.e. a 1024x768 view on a 1920x1200 resolution fullscreen window).
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 10, 2011, 11:18:39 am
Quote from: "Laurent"
Add whatever is necessary. I don't know much about this flag and why it makes things work, but if it's a bug on your side you should rather fix it, and if it's a bug in OS X gcc then there's nothing you can do except adding the flag.

I'll try to do some more research on it, but as I'm not writing any code about sf::String nor using special stuff from the STL we can assume this bug has nothing to do with me in particular, right ? I'd like to be sure on that kind of things. =)
Title: SFML 2 for OS X comes true!
Post by: Laurent on February 10, 2011, 11:55:02 am
Quote
I'll try to do some more research on it, but as I'm not writing any code about sf::String nor using special stuff from the STL we can assume this bug has nothing to do with me in particular, right ? I'd like to be sure on that kind of things. =)

Yep, but this means that there's a bug in gcc on OS X, which is also very unlikely. So you have to check and make sure in any case ;)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 10, 2011, 01:38:58 pm
Quote from: "Laurent"
Quote
When I set 1024x768 I expect to have black unused areas on the left and right of my screen because of the different ratio

???
I've never heard of that before, when you open a fullscreen window it covers the full screen. The OS won't handle the aspect ratio for you (unless there's something very specific built in OS X).

If you open a fullscreen window on Mac OS X, it will indeed fill the whole screen. But the screen frame does not always fills the "real screen" frame, especially when the ratio of the wished resolution is different from the native one. Thus your "fullscreen" window will not fill the real screen. This is handled natively as far as I know (note that when choosing the screen resolution, Mac OS X lets you choose between "normal" and "wide" mode).

Now, with Hiura's solution, the screen resolution does not change, thus the OS doesn't make any change on the "virtual screen" frame. That's why I said it was different from what I had expected.

However, as Hiura said, on Windows and Linux there's no such behavior, and in order for SFML to be the most cross-platform as possible, I agree with keeping this "odd" (to me) behavior. It'll make cross development much easier.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 10, 2011, 02:51:45 pm
Quote from: "Laurent"
Yep, but this means that there's a bug in gcc on OS X, which is also very unlikely. So you have to check and make sure in any case ;)
Well, from what I've read it is a bug in gcc. =/ I've sent a bug report to Apple so we'll see what they'll tell me. In the meanwhile I won't change the cmake conf but put an note on the "tutorial" post (first page).
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 11, 2011, 01:52:00 am
Quote from: "Ceylo"
Yup. I let NSText interpret these. See GLKit.mm line ~356.
I did found NSText yesterday but I was trying to call keyDown on it – silly me. Anyway, thanks for your help. Now it should work properly.

I've also updated the KeyPressed/Released event so that the Z key is really the Z key on the user keyboard. I'm no more relying only on the physical code of the key.

And I added support for 'modifier' keys (System, Alt, Control, Shift). Could anyone confirm that works fine or not. I don't know if it works only for my keyboard. (I know only that key repeat won't work on these keys. Is it the same on Win/Unix ?)

You can use this code (http://pastebin.com/pMZQJXig) to test everything.

Now I still have an unbind key on my keyboard (' on ch-fr layout, ) on fr layout I think). That recalls me a discussion (http://www.sfml-dev.org/forum-fr/viewtopic.php?p=28269#28269) (and the related task (http://www.sfml-dev.org/todo/index.php?do=details&task_id=17&project=1)). Laurent, still no decision on it ? (Just to know ;-) )

Maybe we have already discussed the following but I've got the memory of a goldfish so I apology if we did.  :P

What about adding a System field to sf::Event::KeyEvent ? On OS X it would be very logical to have this. And why not on Unix/Win ?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 11, 2011, 04:14:28 pm
As for me with the latest sources from the SVN repository and your sample code :

If I use the resize button and don't go outside and inside of the OpenGL area, mouse moved event do no more work. Note that I first thought that you had forgotten something as for resizing the OpenGL view but it was just because you hadn't handled the Resized event.

As for the keyboard, every text event works fine, but not the key pressed events. Here is what I get in the console:
@ key gives me ~
&é"'(§è!çà gives 1234567890 (for the keys you handle)
) gives nothing
- gives =
^ gives [
$ gives ]
ù gives '
`gives \
= gives /
: gives .
; gives ,
, gives nothing
< gives -
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 11, 2011, 05:00:03 pm
Quote from: "Ceylo"
If I use the resize button and don't go outside and inside of the OpenGL area, mouse moved event do no more work.
I hate that kind of bug! Anyway, thank you for the bug report. It should be ok now. ;-)

Quote from: "Ceylo"
As for the keyboard, every text event works fine, but not the key pressed events. Here is what I get in the console:
Ok, that the behaviour I expected. I know that it's not the best key binding ever but at least there is only one unbind key. With the current sf::Key::Code enum I cannot do more because I cannot rely on the printable character given by the key down/up event because if shift is down then I cannot get the native key character (on some keyboard ; is the shifted character of , for example). (Cocoa doesn't allow me to retrieve the 'unshifted' character of the pressed/released key.)

Now about &é"'(§è!çà giving 1234567890 : it's because on the US keyboard layout these keys are 1234567890. In fact I've only found 3-4 layouts that don't have numerical keys there.

Do the ctrl, cmd, alt and shift keys work (KeyPressed/KeyReleased events)?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 11, 2011, 07:44:06 pm
Quote from: "Hiura"
Quote from: "Ceylo"
If I use the resize button and don't go outside and inside of the OpenGL area, mouse moved event do no more work.
I hate that kind of bug! Anyway, thank you for the bug report. It should be ok now. ;-)

Yup it's ok now ^^.

Quote from: "Hiura"
(Cocoa doesn't allow me to retrieve the 'unshifted' character of the pressed/released key.)

Actually.. there is both -[NSEvent characters] and -[NSEvent charactersIgnoringModifiers]. So I don't really understand what you mean.

Quote from: "Hiura"
Now about &é"'(§è!çà giving 1234567890 : it's because on the US keyboard layout these keys are 1234567890. In fact I've only found 3-4 layouts that don't have numerical keys there.

That's why your keys should be deduced from the characters rather than the key code whenever you can. It's the only way to get the translated character and not care about each layout.

Quote from: "Hiura"
Do the ctrl, cmd, alt and shift keys work (KeyPressed/KeyReleased events)?

They do :) .
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 11, 2011, 08:35:54 pm
Quote from: "Ceylo"
Actually.. there is both -[NSEvent characters] and -[NSEvent charactersIgnoringModifiers]. So I don't really understand what you mean.
Unfortunally, as the doc says, shift are not ignored.
Quote from: "Apple Doc"
charactersIgnoringModifiers
Returns the characters generated by the receiving key event as if no modifier key (except for Shift) applies.

I know : it's stupid!

Quote from: "Ceylo"
Quote from: "Hiura"
Do the ctrl, cmd, alt and shift keys work (KeyPressed/KeyReleased events)?

They do :) .
Great =D
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 11, 2011, 08:47:43 pm
Quote from: "Hiura"
Quote from: "Ceylo"
Actually.. there is both -[NSEvent characters] and -[NSEvent charactersIgnoringModifiers]. So I don't really understand what you mean.
Unfortunally, as the doc says, shift are not ignored.
Quote from: "Apple Doc"
charactersIgnoringModifiers
Returns the characters generated by the receiving key event as if no modifier key (except for Shift) applies.

I know : it's stupid!

Aaaah.. I had never noticed this ><. Indeed that's annoying. But even with this issue, don't you think it's still better to rely on the information provided by -characters or -charactersIgnoringModifiers ? Because right now there are a lot of wrong keys... :/
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 11, 2011, 09:12:28 pm
Quote from: "Ceylo"
Aaaah.. I had never noticed this ><. Indeed that's annoying. But even with this issue, don't you think it's still better to rely on the information provided by -characters or -charactersIgnoringModifiers ? Because right now there are a lot of wrong keys... :/

Well, on my kb if I use only -charactersIgnoringModifiers to determine the 'sf::key' I would have about 8-9 unbound keys or key in conflict with some others.

I choose this way to handle keys because it has only one unbound key on most keyboards. It's the best solution I've found so far but if you have some idea I'm very interested, of course.

Maybe we can found another way to give key event to the SFML user... I don't know.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 11, 2011, 09:27:31 pm
And do key events work fine with SFML 1.6 ? Compared to what's being done for SFML 2 ?
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 14, 2011, 12:47:55 am
Quote from: "Ceylo"
And do key events work fine with SFML 1.6 ?
Nope, sorry. At least not with my swiss keyboard. I just reinstall 1.6 (not trunk) and can confirm the following :

> keys pressed with shift and without shift don't produce the same event.

> I've 2 unbound keys ¨ and ^ .

> the 'fn' key produce an event but shouldn't.

> Without using shift I've got 7 keys sending event with keycode = 0, and 10 when shift is down.

> Thus I haven't access to all keys of the enum (http://sfml-dev.org/documentation/1.6/Event_8hpp-source.htm#l00041).
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 14, 2011, 11:37:35 am
Quote from: "Hiura"
> keys pressed with shift and without shift don't produce the same event.

Is this really an issue? I mean... for example, I've no Tilde key on the french PC keyboard I'm using right now. To get a tilde I would need to use Alt+é. Thus, is the 'é' key supposed to produce a tilde key event? Or nothing? Is Alt+é supposed to produce a tilde key event? Or nothing?

Quote from: "Hiura"
> the 'fn' key produce an event but shouldn't.

I suppose this could be fixed quite easily.

Quote from: "Hiura"
> Without using shift I've got 7 keys sending event with keycode = 0, and 10 when shift is down.

To me, what's most annoying is getting different results between the key pressed and text entered events. If you were just using -characters and some tricks to get the numpad keys, you could possibly get all of the keys described in the enum. But it would not always match the first character of the concerned key. Would this be acceptable?

Quote from: "Hiura"
> Thus I haven't access to all keys of the enum (http://sfml-dev.org/documentation/1.6/Event_8hpp-source.htm#l00041).

I don't think you could ever have access to all of these, because it really depends on the keyboard layout. This is an issue beyond the scope of the Mac port. I had no answer to this but it should be discussed more deeply with Laurent.
Title: SFML 2 for OS X comes true!
Post by: Laurent on February 14, 2011, 11:47:43 am
Quote
Is this really an issue? I mean... for example, I've no Tilde key on the french PC keyboard I'm using right now. To get a tilde I would need to use Alt+é. Thus, is the 'é' key supposed to produce a tilde key event? Or nothing? Is Alt+é supposed to produce a tilde key event? Or nothing?

It is an issue. A key is a key, no matter which modifiers are pressed or not.
If you have no key showing a tilde directly, you should (in a perfect world) never have a KeyPressed event with Code == Tilde. You can only get it with the TextEntered event.
So both 'é' and Alt + 'é' should produce a 'é' KeyPressed event (or '2', like it is currently).

Quote
I don't think you could ever have access to all of these, because it really depends on the keyboard layout. This is an issue beyond the scope of the Mac port. I had no answer to this but it should be discussed more deeply with Laurent.

It is indeed a huge problem, I have to find something to properly handle the differences in keyboard layouts.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 14, 2011, 12:55:01 pm
The link in the task (http://www.sfml-dev.org/todo/index.php?do=details&task_id=17&project=1) describes layout form windows mostly. On Mac they are a little bit different. I've uploaded here (http://www.mediafire.com/?shjic7ri4orcamh) the french, us and swiss layouts. (It's only the small keyboard version because I haven't a keyboard with numeric keypad.)

The current implementation I use is based on the current layout for abc characters and for the other keys on the US layout except '-' (US layout) that is unbound because it might be twice on the keyboard.

I just quickly test SFML2 on my brother computer (also swiss layout but not a Mac keyboard so it's not exactly the same layout as mine – see the task link for visual description) on Ubuntu and encounter the same problem : lot of keys produce event with key code = 0 and shift change the '3' (for example) key into something else.



On a side note, what about adding a System field to sf::Event::KeyEvent ? On OS X it would be very logical to have this. And why not on Unix/Win ?
Title: SFML 2 for OS X comes true!
Post by: Laurent on February 14, 2011, 01:14:49 pm
Quote
On a side note, what about adding a System field to sf::Event::KeyEvent ?

And what does it mean?
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 14, 2011, 01:20:33 pm
On OS X, instead of using ctrl for shortcut we use cmd so this new field would have the same purpose as Alt, Control and Shift.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on February 14, 2011, 01:24:20 pm
Quote from: "Laurent"
It is indeed a huge problem, I have to find something to properly handle the differences in keyboard layouts.

Thus.. is it worth trying to find a solution before getting the right design? To me, efforts should be focused on this issue rather than trying to implement "wonky" solutions.
Title: SFML 2 for OS X comes true!
Post by: Laurent on February 14, 2011, 01:45:32 pm
Quote
On OS X, instead of using ctrl for shortcut we use cmd so this new field would have the same purpose as Alt, Control and Shift.

You're right, the System key is a modifier as well.
(sorry it took me a while to figure out what the "System" key was :D)

Quote
Thus.. is it worth trying to find a solution before getting the right design? To me, efforts should be focused on this issue rather than trying to implement "wonky" solutions.

You should definitely not spend months on this issue. Don't try to make it better than the Windows and Linux implementations, which use a straight-forward code (they don't try to do anything fancy). But at least, make sure that the behaviour more or less matches these implemetantions.
Title: SFML 2 for OS X comes true!
Post by: Hiura on February 14, 2011, 02:52:23 pm
Ok, so everything is fine for me.  :)
Title: SFML 2 for OS X comes true!
Post by: Vit on February 17, 2011, 06:59:20 pm
I haven't checked back here for a while (been busy with other things), but SFML 2 on Mac is amazing news :D

I'll be trying it out in the next few weeks; I hope the problems I had with 1.6 are fixed!
Title: SFML 2 for OS X comes true!
Post by: James on March 05, 2011, 04:28:37 pm
G'day, I hope this is the right place to talk about the 2.0 port for mac.

So, the OpenGL tute mentions this: "To use OpenGL, you only have to include Window.hpp : the OpenGL and GLU headers will be automatically included by it."

This isn't the case for mac, since it's not included in the mac specific headers.

(Just wondering why/letting you know. Not a big deal :P)
Title: SFML 2 for OS X comes true!
Post by: Laurent on March 05, 2011, 04:30:34 pm
This is the tutorial for SFML 1.6, things have changed a lot in version 2.0 ;)
Title: SFML 2 for OS X comes true!
Post by: James on March 06, 2011, 06:57:19 am
Aha, I see. I guess I just assumed something like that would stay the same.

Any reason for the change? I'm curious now
Title: SFML 2 for OS X comes true!
Post by: Laurent on March 06, 2011, 10:04:18 am
Now OpenGL headers are included in SFML/OpenGL.hpp. This way we still provide a portable way of including GL headers, but the user is no longer forced to have them included by default.
Title: SFML 2 for OS X comes true!
Post by: James on March 06, 2011, 10:41:19 am
Nice, I completely missed that.

Cheers
Title: SFML 2 for OS X comes true!
Post by: Kolja on March 06, 2011, 02:57:44 pm
Good to know, I had included SFML/Graphics.hpp for that.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on March 09, 2011, 12:36:28 am
Looks like something is wrong with the current sources if you want to compile SFML for Mac OS X 10.5 or earlier.

I've been adding this in one of the CMake files for my own purpose:
Code: [Select]
if(MACOSX)
add_definitions("-arch ppc -arch i386 -arch x86_64 --sysroot=/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5")
endif()


But it gives these errors:
Code: [Select]
[ 20%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/cg_sf_conversion.cpp.o
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp: In function ‘sf::VideoMode sf::priv::ConvertCGModeToSFMode(const __CFDictionary*)’:
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:99: error: ‘CurrentMode’ was not declared in this scope
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:100: error: ‘mode’ was not declared in this scope
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp: In function ‘const __CFDictionary* sf::priv::ConvertSFModeToCGMode(sf::VideoMode)’:
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:133: error: expected `)' before ‘__null’
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:197: error: too few arguments to function ‘const __CFDictionary* CGDisplayBestModeForParameters(CGDirectDisplayID, size_t, size_t, size_t, boolean_t*)’
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:133: error: at this point in file
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp: In function ‘sf::VideoMode sf::priv::ConvertCGModeToSFMode(const __CFDictionary*)’:
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:99: error: ‘CurrentMode’ was not declared in this scope
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:100: error: ‘mode’ was not declared in this scope
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp: In function ‘const __CFDictionary* sf::priv::ConvertSFModeToCGMode(sf::VideoMode)’:
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:133: error: expected `)' before ‘__null’
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:197: error: too few arguments to function ‘const __CFDictionary* CGDisplayBestModeForParameters(CGDirectDisplayID, size_t, size_t, size_t, boolean_t*)’
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:133: error: at this point in file
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp: In function ‘sf::VideoMode sf::priv::ConvertCGModeToSFMode(const __CFDictionary*)’:
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:99: error: ‘CurrentMode’ was not declared in this scope
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:100: error: ‘mode’ was not declared in this scope
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp: In function ‘const __CFDictionary* sf::priv::ConvertSFModeToCGMode(sf::VideoMode)’:
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:133: error: expected `)' before ‘__null’
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:197: error: too few arguments to function ‘const __CFDictionary* CGDisplayBestModeForParameters(CGDirectDisplayID, size_t, size_t, size_t, boolean_t*)’
.../sfml2/src/SFML/Window/OSX/cg_sf_conversion.cpp:133: error: at this point in file


Switching back to the 10.6 SDK fixes this issue.
Title: SFML 2 for OS X comes true!
Post by: Hiura on March 09, 2011, 12:48:48 am
At the time I coded this I didn't have any prior 10.6 OS so I couldn't check (for some reason I wasn't able to get 10.4/5 SDK). And as you know coding without being able to compile is hard. ^^'

Unfortunately, I won't have the time to work on SFML before one month or so, sorry.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on March 09, 2011, 12:55:25 am
Ok, too bad :( .

One more thing I noticed is that the libraries you provide include the i386 and x86_64 architectures but not the ppc one. Is this on purpose?
Title: SFML 2 for OS X comes true!
Post by: Hiura on March 09, 2011, 01:01:03 am
No.

But I've to think again and chose which OS version I'll support. For example joysticks won't work in 10.4 and too much stuff are deprecated making it hard to maintain.. Also I won't ever be able to test on a 10.4 (maybe compile for 10.4 but not run on 10.4) so...

I'll keep you updated.  :wink:
Title: SFML 2 for OS X comes true!
Post by: Ceylo on March 09, 2011, 01:08:52 am
I agree with you but... ppc doesn't mean 10.4 :o . You still have people using Mac OS X 10.5 on a PowerPC Mac :? .

But.. well.. it's more or less the same kind of decision. I suppose I'll just have to release my project for Intel Macs only for now :P (going to look when you changed cg_sf_conversion.cpp though, Mac OS X 10.6 only is a bit restrictive...).

Anyway.. thanks for your efforts on the mac port ! :)
Title: SFML 2 for OS X comes true!
Post by: Hiura on March 09, 2011, 08:17:03 am
Quote from: "Ceylo"
I agree with you but... ppc doesn't mean 10.4 :o . You still have people using Mac OS X 10.5 on a PowerPC Mac :? .
ppc will definitely be supported on 10.5.  :wink:
Title: Can't seems to compile and make sfml2
Post by: mercurio7891 on March 21, 2011, 04:47:37 pm
Hi, today I wanted to try sfml2 mac port, and seems stuck in the installation of it.

When trying to do a "make all" I get error while building sfml-graphics.

Code: [Select]

[ 58%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Color.cpp.o
[ 60%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Drawable.cpp.o
[ 61%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Font.cpp.o
In file included from /sfml2/include/SFML/System/Resource.hpp:236:0,
                 from /sfml2/include/SFML/Graphics/Font.hpp:31,
                 from /sfml2/src/SFML/Graphics/Font.cpp:28:
/sfml2/include/SFML/System/ResourcePtr.inl: In constructor 'sf::ResourcePtr< <template-parameter-1-1> >::ResourcePtr()':
/sfml2/include/SFML/System/ResourcePtr.inl:29:12: error: 'NULL' was not declared in this scope
/sfml2/include/SFML/System/ResourcePtr.inl: In member function 'void sf::ResourcePtr< <template-parameter-1-1> >::OnResourceDestroyed()':
/sfml2/include/SFML/System/ResourcePtr.inl:124:18: error: 'NULL' was not declared in this scope
make[2]: *** [src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Font.cpp.o] Error 1
make[1]: *** [src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/all] Error 2


I have xcode4 installed, and using gcc4.6 as a compiler instead of the xcode ones.
Just in case I tested the gcc4.6 compiler it compiles alright and pass all boost regression test.

regards
Title: SFML 2 for OS X comes true!
Post by: Laurent on March 21, 2011, 04:55:25 pm
It was already fixed before you posted ;)
Title: SFML 2 for OS X comes true!
Post by: mercurio7891 on March 21, 2011, 05:29:15 pm
thats nice :D. How do I get the updated code with the fix? The code that I am using was downloaded from the snapshot link found on the download page. I got it a few hours ago.

regards
Dontino
Title: SFML 2 for OS X comes true!
Post by: Laurent on March 21, 2011, 05:48:32 pm
I don't know how often the snapshot is updated, but at worst tomorrow should be ok.
Title: SFML 2 for OS X comes true!
Post by: Silvah on March 21, 2011, 06:00:40 pm
If you don't want to wait for snapshot update, then just add
Code: [Select]
#include <cstddef> at the top of SFML/System/Resource.hpp ;)
Title: SFML 2 for OS X comes true!
Post by: mercurio7891 on March 22, 2011, 03:31:39 pm
The program is now compiling fine, however after running it, when I quit, it always produces the error:

*** attempt to pop an unknown autorelease pool

how should I go about fixing this?? Is there some libraries I am missing??

regards
Title: SFML 2 for OS X comes true!
Post by: Hiura on March 22, 2011, 07:31:58 pm
Quote from: "mercurio7891"
The program is now compiling fine, however after running it, when I quit, it always produces the error:

*** attempt to pop an unknown autorelease pool

how should I go about fixing this?? Is there some libraries I am missing??

regards
That's a known "bug" (in fact it does nothing really bad) that cannot be fixed.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on April 03, 2011, 01:52:59 pm
From what I read, the dynamic libraries on Mac OS X are now correctly built and linked against the 10.5 SDK if one chooses to do so. But it's being built for Intel 64 bits only (though you were doing good while you were planning to support PPC). I suppose the libraries should be built for Intel 32 bits too.
Title: SFML 2 for OS X comes true!
Post by: Hiura on April 03, 2011, 05:51:32 pm
Yes, I'm aware of this and, in fact, it's already fixed on my local git repo. I didn't release it yet because I'm working on the frameworks now.  :wink:
Title: SFML 2 for OS X comes true!
Post by: Ceylo on April 03, 2011, 05:56:09 pm
Great :D
I don't know how you'll handle the install name thing but I'd love to see that, because I tried to set it with CMake but I couldn't get it working.
Title: SFML 2 for OS X comes true!
Post by: Hiura on April 03, 2011, 06:07:49 pm
Well, I'll have to use the cmake mailing list to figure it out. So you might not see the update tomorrow.
Title: SFML 2 for OS X comes true!
Post by: Hiura on April 10, 2011, 12:38:19 pm
According to the cmake mailing list (that is, 0 answer is two weeks) this is kind of tricky.  :?

Would anyone be offended if both release and debug Frameworks have exactly the same name (without -d for debug) ?
Title: SFML 2 for OS X comes true!
Post by: mercurio7891 on April 13, 2011, 04:44:01 pm
if the frame work has the same name, does it mean we have to use hard path in the command line??

e.g

g++ -framework Cocoa -framework /sfml/release/sfml test.c
g++ -framework Cocoa -framework /sfml/debug/sfml test.c

regards
Title: SFML 2 for OS X comes true!
Post by: Ceylo on April 13, 2011, 08:14:04 pm
What do you want to do? (the lines you wrote don't mean anything)
Title: SFML 2 for OS X comes true!
Post by: Hiura on April 13, 2011, 08:14:42 pm
Unfortunately yes.

(I think he want to say something like
Code: [Select]
g++ -framework Cocoa -framework /somePath/sfml-system.framwork test.c
where somePath depends on the configuration debug vs release.
Maybe one can play with -F option but this would have other issue at runtime I think.
Am I right ? )

There is another way to handle debug/release frameworks with the same name but I have no clue how to do it with cmake (I've found nothing in the mailing list archives to help me). Moreover, I don't know how to use it with gcc (well, Google should know...).

It consists in adding a second binary to the framework (let's say sfml-system) by appending _debug to the release binary name. So the framework should looks like :

Code: [Select]

sfml-system.framework/
                      sfml-system            (release binary)
                      sfml-system_debug
                      Versions/
:
:


So if any of you guys know how to do it please step forward. =)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on April 13, 2011, 08:35:18 pm
Found this right now : http://stackoverflow.com/questions/2127433/including-a-debug-build-in-a-librarys-mac-os-x-sdk

and this discussion about CMake:
http://www.cmake.org/pipermail/cmake/2008-August/023320.html
Title: SFML 2 for OS X comes true!
Post by: Hiura on April 13, 2011, 09:14:46 pm
Yes, I've already read this one and the answer is not so conclusive. http://www.cmake.org/pipermail/cmake/2008-August/023326.html

Anyway, thanks for the input.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on April 13, 2011, 09:33:42 pm
What about this? http://developer.apple.com/library/mac/#technotes/tn2004/tn2124.html%23SECDEBUGLIB

Edit: and when looking at the dyld man page you can have some more information about the DYLD_IMAGE_SUFFIX env var.
Title: SFML 2 for OS X comes true!
Post by: Hiura on April 24, 2011, 07:18:45 pm
I haven't the time to try it more deeply, however I've sent a second email to cmake mailing list during last week and still haven't got any answer... I'm kind of disappointed by this.
Title: SFML 2 for OS X comes true!
Post by: vidjogamer on May 01, 2011, 05:11:32 am
Whats the status on SFML 2.0 development for Mac?

Do we have any projected dates for completion?
What are the current issues?

Keep up the good work guys! =)
Title: SFML 2 for OS X comes true!
Post by: Hiura on May 01, 2011, 11:46:44 am
It's almost done : the main features are available and working.

You can find the remaining tasks and issues here : https://github.com/SFML/SFML/issues/assigned/mantognini

But I can't give you any date for complete completion.
Title: SFML 2 for OS X comes true!
Post by: Hiura on May 01, 2011, 12:09:58 pm
I don't remember if we already discussed this... anyway :

Currently, that is with OS X 10.5 and 10.6, OpenGL 2.1 is the highest version supported (by software rendering at least). Moreover, there is no way to create a context against any specific version of OpenGL on Mac.

(For the curious among you : http://developer.apple.com/graphicsimaging/opengl/capabilities/ )

Maybe something should be written in the doc/tutorial/whatever to make sure the SFML-users are aware of that.

I hope this will change with 10.7 coming out...
Title: SFML 2 for OS X comes true!
Post by: Ceylo on May 15, 2011, 02:42:25 pm
I don't really know if you got the install_name thing working, I didn't see anything on the Git repo. If that can be of any help, here's what I added in the sfeMovie CMake file to get it done:
Code: [Select]

set_target_properties(${LIB_NAME} PROPERTIES
  BUILD_WITH_INSTALL_RPATH 1
  INSTALL_NAME_DIR "@executable_path/../Frameworks")


You can replace the path with anything you want but that's the idea.
Title: SFML 2 for OS X comes true!
Post by: Hiura on May 15, 2011, 03:09:44 pm
Well! A big thanks! No one could answer my question on the cmake mailing list so I had to go through all the sources to realize that you absolutely cannot use suffix nor postfix. So that's a very good hint you gave me here!

I'll check that out.  :wink:
Title: SFML 2 for OS X comes true!
Post by: Vit on May 25, 2011, 05:40:30 pm
This probably isn't the right place to post this, but I've found that closing the SFML window sometimes makes my computer emit a brief loud 'static' sound through the speakers (even if the volume is completely down). I'm using a 2005 Macbook running Mac OS X 10.6. I've experienced this problem in two different projects which don't share any code, so I don't think it's a problem with my code (unless there's something funny going on with my OpenGL calls; I'm using straight OpenGL for map rendering in both, though again, the code is completely different).
I'm not sure what's going on here, and it's starting to worry me...
Title: SFML 2 for OS X comes true!
Post by: Hiura on May 25, 2011, 09:04:22 pm
I've some issues with my mac (sometimes, at completely random interval, it produce a very very acute noise that tears my ears apart then the speaker don't produce any sound for about 2 minutes) but I've also experienced, not always though, something like you said : closing the window make a strange unknown noise. I've never considered this as relevant because of the issues I've got with my speakers. And frankly I've no clue at all why on earth any sound should be produced! I don't use anything (even indirectly) related to the sound in the window management code.

Does this "thing" occur on anyone else computer ?
Title: SFML 2 for OS X comes true!
Post by: SkyJedi on August 04, 2011, 07:13:08 pm
Hey,

I'm on Mac OS X 10.7, I just installed the developer tools, grabbed the SFML files on git, compiled it with cake, installed it, installed the templates...
But yeah, when I try to compile a template, I've got this (http://black-heaven.fr/cpt.png)

What can I do? :/
Thanks in advance
Title: SFML 2 for OS X comes true!
Post by: Hiura on August 04, 2011, 07:35:39 pm
you probably compiled sfml in release mode. you can either change your project settings to release (edit scheme) or recompile sfml in debug (recommended as you'll probably need both release and debug).
Title: SFML 2 for OS X comes true!
Post by: SkyJedi on August 04, 2011, 07:57:29 pm
I compiled the library in debug mode, and it works, thanks!
Title: SFML 2 for OS X comes true!
Post by: Hachaso on August 04, 2011, 08:33:21 pm
How can I build SFML 2.0 using XCode 4 ?

I get these errors:

Code: [Select]



ld: warning: ignoring file /opt/local/lib/libfreetype.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
  "_FT_Set_Pixel_Sizes", referenced from:
      sf::Font::SetCurrentSize(unsigned int) constin Font.o
  "_FT_Load_Char", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o
  "_FT_Get_Glyph", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o
  "_FT_Outline_Embolden", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o
  "_FT_Glyph_To_Bitmap", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o
  "_FT_Bitmap_Embolden", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o
  "_FT_Done_Glyph", referenced from:
      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o
  "_FT_Done_Face", referenced from:
      sf::Font::Cleanup()    in Font.o
  "_FT_Done_FreeType", referenced from:
      sf::Font::Cleanup()    in Font.o
  "_FT_Get_Char_Index", referenced from:
      sf::Font::GetKerning(unsigned int, unsigned int, unsigned int) constin Font.o
  "_FT_Get_Kerning", referenced from:
      sf::Font::GetKerning(unsigned int, unsigned int, unsigned int) constin Font.o
  "_FT_Init_FreeType", referenced from:
      sf::Font::LoadFromStream(sf::InputStream&)      in Font.o
      sf::Font::LoadFromMemory(void const*, unsigned long)in Font.o
      sf::Font::LoadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Font.o
  "_FT_Open_Face", referenced from:
      sf::Font::LoadFromStream(sf::InputStream&)      in Font.o
  "_FT_Select_Charmap", referenced from:
      sf::Font::LoadFromStream(sf::InputStream&)      in Font.o
      sf::Font::LoadFromMemory(void const*, unsigned long)in Font.o
      sf::Font::LoadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Font.o
  "_FT_New_Memory_Face", referenced from:
      sf::Font::LoadFromMemory(void const*, unsigned long)in Font.o
  "_FT_New_Face", referenced from:
      sf::Font::LoadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Font.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status




Code: [Select]

ld: warning: ignoring file /opt/local/lib/libfreetype.dylib, file was built for unsupported file format which is not the architecture being linked (i386)


  "_FT_Set_Pixel_Sizes", referenced from:


      sf::Font::SetCurrentSize(unsigned int) constin Font.o


  "_FT_Load_Char", referenced from:


      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o


  "_FT_Get_Glyph", referenced from:


      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o


  "_FT_Outline_Embolden", referenced from:


      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o


  "_FT_Glyph_To_Bitmap", referenced from:


      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o


  "_FT_Bitmap_Embolden", referenced from:


      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o


  "_FT_Done_Glyph", referenced from:


      sf::Font::LoadGlyph(unsigned int, unsigned int, bool) constin Font.o


  "_FT_Done_Face", referenced from:


      sf::Font::Cleanup()    in Font.o


  "_FT_Done_FreeType", referenced from:


      sf::Font::Cleanup()    in Font.o


  "_FT_Get_Char_Index", referenced from:


      sf::Font::GetKerning(unsigned int, unsigned int, unsigned int) constin Font.o


  "_FT_Get_Kerning", referenced from:


      sf::Font::GetKerning(unsigned int, unsigned int, unsigned int) constin Font.o


  "_FT_Init_FreeType", referenced from:


      sf::Font::LoadFromStream(sf::InputStream&)      in Font.o


      sf::Font::LoadFromMemory(void const*, unsigned long)in Font.o


      sf::Font::LoadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Font.o


  "_FT_Open_Face", referenced from:


      sf::Font::LoadFromStream(sf::InputStream&)      in Font.o


  "_FT_Select_Charmap", referenced from:


      sf::Font::LoadFromStream(sf::InputStream&)      in Font.o


      sf::Font::LoadFromMemory(void const*, unsigned long)in Font.o


      sf::Font::LoadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Font.o


  "_FT_New_Memory_Face", referenced from:


      sf::Font::LoadFromMemory(void const*, unsigned long)in Font.o


  "_FT_New_Face", referenced from:


      sf::Font::LoadFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Font.o


ld: symbol(s) not found for architecture i386


collect2: ld returned 1 exit status

Title: SFML 2 for OS X comes true!
Post by: Ceylo on August 04, 2011, 08:42:53 pm
Rename /opt/local/lib/libfreetype.dylib to some other name so that the linker does no more find it. Mac OS X already includes a freetype library including the correct architectures.
Title: SFML 2 for OS X comes true!
Post by: Hachaso on August 04, 2011, 08:50:09 pm
Thanks

Worked a little better know I get these errors when I Select OpenGL and Build

Code: [Select]


Ld BUILD/src/SFML/Graphics/SFML.build/Debug/sfml-graphics.build/Objects-normal/i386/libsfml-graphics-d.dylib normal i386
    cd /Users/brcal/programming/MacOSX/SFML-2.0
    setenv MACOSX_DEPLOYMENT_TARGET 10.7
    /Developer/usr/bin/llvm-g++-4.2 -arch i386 -dynamiclib -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/brcal/programming/MacOSX/SFML-2.0/BUILD/lib/Debug -F/Users/brcal/programming/MacOSX/SFML-2.0/BUILD/lib/Debug -filelist /Users/brcal/programming/MacOSX/SFML-2.0/BUILD/src/SFML/Graphics/SFML.build/Debug/sfml-graphics.build/Objects-normal/i386/sfml-graphics-d.LinkFileList -install_name /libsfml-graphics-d.dylib -mmacosx-version-min=10.7 -dynamiclib -Wl,-headerpad_max_install_names -install_name libsfml-graphics-d.dylib /Users/brcal/programming/MacOSX/SFML-2.0/BUILD/lib/Debug/libsfml-window-d.dylib /Users/brcal/programming/MacOSX/SFML-2.0/BUILD/lib/Debug/libsfml-system-d.dylib /opt/local/lib/libfreetype.dylib /Users/brcal/programming/MacOSX/SFML-2.0/extlibs/libs-osx/lib/libGLEW.a /Users/brcal/programming/MacOSX/SFML-2.0/extlibs/libs-osx/lib/libjpeg.a -framework OpenGL /usr/lib/libz.dylib -framework AGL -lpthread -framework Foundation -framework AppKit -framework IOKit -framework Carbon -single_module -compatibility_version 2.0.0 -current_version 2.0.0 -o /Users/brcal/programming/MacOSX/SFML-2.0/BUILD/src/SFML/Graphics/SFML.build/Debug/sfml-graphics.build/Objects-normal/i386/libsfml-graphics-d.dylib

Command /Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
Title: SFML 2 for OS X comes true!
Post by: Hachaso on August 04, 2011, 08:54:35 pm
I can't seem to find any other libfreetype.dylib installed on my Mac OS X Lion.
Do I need to download it from somewhere ?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on August 04, 2011, 09:08:04 pm
There is no relevant information in your last error log. I dunno if it changed for OS X Lion, but freetype is supposed to be located at /usr/X11/lib/libfreetype.dylib.
Title: SFML 2 for OS X comes true!
Post by: Hachaso on August 04, 2011, 09:15:19 pm
That is correct:

I found the file now but it's a Alias file pointing at libfreetype.6.dylib at the same location you posted before.

Do you have any idea what my last error means ??
Title: SFML 2 for OS X comes true!
Post by: Ceylo on August 04, 2011, 09:25:40 pm
As I previously said, there is no relevant information in your last error log, so nothing can be deduced. There's most probably relevant information before this error.

And the alias pointing to lifreetype.6.dylib is fine.
Title: SFML 2 for OS X comes true!
Post by: Hiura on August 20, 2011, 12:51:18 pm
Frameworks are now available. BUILD_FRAMEWORKS can be set to TRUE to build SFML as frameworks. NB : frameworks are only available in release. There is no sfml-*-d.framework.

Cmake automatically installs the xcode 4 templates for you if INSTALL_XCODE4_TEMPLATES is set to TRUE.

The templates were updated to let you choose between frameworks and dylibs.

If you choose to create a application bundle (.app) SFML dylibs or SFML frameworks, and sndfile framework, are copied to your bundle so you can send it as-is to people when you build it for "archive".

Please refer to xcode/templates/readme.txt for more details.

Have fun!  :wink:

(I've updated the first post of this topic. It should contain everything you need to use SFML on Mac.)
Title: SFML 2 for OS X comes true!
Post by: Leugim on September 25, 2011, 01:55:46 pm
Why does SFML 2.0 cause a noise whenever I press a key? S:. It's the same noise as if you are not allowed to type somewhere or something.
Title: SFML 2 for OS X comes true!
Post by: Hiura on September 25, 2011, 07:15:51 pm
This was fixed yesterday. Is it not working  :?:
Title: SFML 2 for OS X comes true!
Post by: Leugim on September 26, 2011, 12:37:30 pm
no SFML 2.0 works perfect for my Mac, except one thing. Whenever I press any key on the keyboard while inside my Application/Game it will make a noise. Sounds like I shouldnt be pressing the keys in the applications if you get what I mean.

Just found out:
If you open up Xcode and go to any project and then press CMD+D, without anything highlighted in the text-editor region, it will make the same sound as if I press a key on the keyboard inside my game.
Title: SFML 2 for OS X comes true!
Post by: Hiura on September 26, 2011, 07:17:14 pm
Quote from: "Leugim"
no SFML 2.0 works perfect for my Mac, except one thing.
I'm confused here... Does it work or not ?
Title: SFML 2 for OS X comes true!
Post by: sbroadfoot90 on September 27, 2011, 12:46:33 am
Quote
Whenever I press any key on the keyboard while inside my Application/Game it will make a noise. Sounds like I shouldnt be pressing the keys in the applications if you get what I mean.


has been fixed

https://github.com/SFML/SFML/issues/98

your solution?

download SFML2 source again (the latest commit), and recompile.
Title: SFML 2 for OS X comes true!
Post by: Leugim on October 02, 2011, 04:24:22 am
Seems to crash randomly, whenever I try to close the window or sometimes when I press a button. It will say:

Code: [Select]

Thread 1: Program Received Signal: EXC_BAD_ACCESS


It will say that at either window->PollEvent(event), where I getting the events or whenever I try to close the window... It's really annoying, is there any solution?
Title: SFML 2 for OS X comes true!
Post by: Hiura on October 02, 2011, 01:37:51 pm
Are you mixing headers and binaries versions ? Make sure both are up-to-date. (make clean + make install might be the solution)

If the issue persists, please give a minimal and complete code that reproduce the error and the backtrace when it crashes.
Title: SFML 2 for OS X comes true!
Post by: Leugim on October 03, 2011, 08:39:12 am
I did it and it still does the same things, I don't know if it's me or just SFML.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on October 03, 2011, 08:54:50 am
That's why you're asked to provide a minimal sample code that reproduces the error you got. It'll help at knowing where the problem is.
Title: SFML 2 for OS X comes true!
Post by: coral on October 17, 2011, 03:04:40 pm
I get

Code: [Select]
Command /Developer/usr/bin/clang++ failed with exit code 1

ld: library not found for -lsfml-system-d



I have built SFML2 with the makefile, done sudo make and sudo make install and there are files in /usr/local/lib and include.

I am using the Xcode 4 templates.

Lion 10.7.2 / Xcode 4.2

(http://jonasbengtson.se/files/images/sfmlproblem.jpg)
Title: SFML 2 for OS X comes true!
Post by: coral on October 17, 2011, 03:25:42 pm
OK LOL WUT i renamed them from libsfml-audio.2.0.dylib to libsfml-audio-d.dylib and it worked.

Is this a bug?
Title: SFML 2 for OS X comes true!
Post by: coral on October 17, 2011, 03:30:46 pm
It seems like Cmake ignores when i tick Build Frameworks. No frameworks :(
Title: SFML 2 for OS X comes true!
Post by: Hiura on October 17, 2011, 07:35:19 pm
Quote
I am using the Xcode 4 templates.
Which one ? Not the SFML-ones I assume. At least your project doesn't look like you use them.

Quote
Is this a bug?
Maybe something is buggy in Xcode. I don't know.

Quote
It seems like Cmake ignores when i tick Build Frameworks.
Works fine for me and other people. Did you run cmake before make ?
Title: SFML 2 for OS X comes true!
Post by: sbroadfoot90 on October 18, 2011, 01:50:34 am
Quote from: "Hiura"
Quote
I am using the Xcode 4 templates.
Which one ? Not the SFML-ones I assume. At least your project doesn't look like you use them.


Yeah, does not look like he's using the ones you made. Looks like he forgot to install the debug libraries as he has the static ones there alright.
Title: SFML 2 for OS X comes true!
Post by: coral on October 18, 2011, 01:38:39 pm
http://www.youtube.com/watch?v=u9JoM-1XYDY

Made a video to show my problem. Any thoughts?
Title: SFML 2 for OS X comes true!
Post by: Hiura on October 18, 2011, 10:00:55 pm
It's something very stupid with this GUI... You have to click twice on configure (the first time to generate the cache and the second time to update it with your custom variable value, ie at that time (http://www.youtube.com/watch?v=u9JoM-1XYDY&feature=player_detailpage#t=49s)). Yeah....

BTW, love firefly too  :D
Title: SFML 2 for OS X comes true!
Post by: sbroadfoot90 on October 18, 2011, 11:10:07 pm
I think if the option has a red background, it means you should press configure again.
Title: SFML 2 for OS X comes true!
Post by: coral on October 18, 2011, 11:14:27 pm
That seemed to work better! Stupid GUI indeed.

Thanks for the help!
Title: SFML 2 for OS X comes true!
Post by: Ceylo on November 01, 2011, 05:52:42 pm
Hello,

I've just been noticing one thing after having done a fresh update and install from the Git repository: even if the sndfile binary (in the framework) has execution rights, when install via make install, the installed sndfile binary does no more have execution rights.

I was wondering whether this was normal. I'm not saying it's an issue because I didn't do any testing for now, but usually all libraries and executables have execution rights so...


Ceylo
Title: SFML 2 for OS X comes true!
Post by: Hiura on November 01, 2011, 06:26:21 pm
This is indeed strange...

Does the copied framework still have the standard subfolder with symlinks ? Do applications still run fine or does this rights issue have an impact on them ?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on November 01, 2011, 06:32:35 pm
Yup the standard subfolders and symlinks are still there, the only missing thing is the execution right.

And testing the Sound sample works fine, and it indeed dynamically loaded the sndfile even without that right (I checked in the Activity Monitor app).

But if this right isn't needed, why all of the libraries are created with it?
Title: SFML 2 for OS X comes true!
Post by: Hiura on November 01, 2011, 11:17:42 pm
I have no idea. Maybe a Unix expert can highlight us here ?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 26, 2011, 11:04:42 am
Is there a way to pass parameters to CMake subprojects ?

For example if I want to build frameworks by default instead of dylib? And keep the same architecture as the one I'm building for my own main project (and which isn't the default compiler architecture).




PS: Merry Christmas :)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 31, 2011, 12:27:34 pm
No way? :(

I've added SFML as a submodule of one of my projects but I want to use frameworks only, and a default cmake call will build dynamic libraries..
Title: SFML 2 for OS X comes true!
Post by: Hiura on December 31, 2011, 12:52:54 pm
I'm not sure at all. here is my ideas :

- you may be able to use "cmake -D <var>:<type>=<value>" accordingly to cmake help manual. However I never used it so I don't know if it will work or not.

- you can run cmake to generate the default makefile. then you can use sed like this :
Code: [Select]
sed -i 's/BUILD_DOC:BOOL=FALSE/BUILD_DOC:BOOL=TRUE/g' CMakeCache.txt followed by make.

- If you're writing a cmake script you should be able to have the same behavior than with cmake -D with ExternalProject_Add (http://www.cmake.org/cmake/help/cmake-2-8-docs.html#module:ExternalProject) and its CMAKE_CACHE_ARGS argument. (I never wrote cmake script that use external project so I may be completely wrong.)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on December 31, 2011, 02:22:35 pm
Quote from: "Hiura"
I'm not sure at all. here is my ideas :

- you may be able to use "cmake -D <var>:<type>=<value>" accordingly to cmake help manual. However I never used it so I don't know if it will work or not.

Doing this means I would also need to manually do the build step (calling make or any other command according to any OS and IDE..) as this won't include the SFML build in the project file generated for my library. And I would like everything to be included in this project.

Quote from: "Hiura"
- you can run cmake to generate the default makefile. then you can use sed like this :
Code: [Select]
sed -i 's/BUILD_DOC:BOOL=FALSE/BUILD_DOC:BOOL=TRUE/g' CMakeCache.txt followed by make.

Here the issue is sed is for Unix only. What about people running CMake-gui on Windows?

Quote from: "Hiura"

- If you're writing a cmake script you should be able to have the same behavior than with cmake -D with ExternalProject_Add (http://www.cmake.org/cmake/help/cmake-2-8-docs.html#module:ExternalProject) and its CMAKE_CACHE_ARGS argument. (I never wrote cmake script that use external project so I may be completely wrong.)

Looks like the most promising solution but.. it'll unfortunately result in the following error:
Code: [Select]
loading initial cache file /Users/ceylo/Development/sfeMovie/deps/SFML/tmp/SFML-cache.cmake
CMake Error at CMakeLists.txt:3 (include):
  include could not find load file:

    /Users/ceylo/Development/sfeMovie/deps/SFML/src/SFML/cmake/Macros.cmake


CMake Error at System/CMakeLists.txt:76 (sfml_add_library):
  Unknown CMake command "sfml_add_library".

For some reason ${PROJECT_SOURCE_DIR} is incorrectly set to
/Users/ceylo/Development/sfeMovie/deps/SFML/src/SFML
instead of
/Users/ceylo/Development/sfeMovie/deps/SFML

For now I don't know why.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 01, 2012, 06:46:26 pm
Sorry but I don't know the answer; I don't have enough experience with CMake. Maybe Laurent or someone else might be able to help you though.
Title: SFML 2 for OS X comes true!
Post by: Laurent on January 01, 2012, 07:21:08 pm
Quote
Maybe Laurent or someone else might be able to help you though

Yes... what's the problem? :lol:

Ok I've found it above, but I don't really understand what the problem is.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 01, 2012, 07:31:15 pm
Quote from: "Hiura"
Sorry but I don't know the answer; I don't have enough experience with CMake. Maybe Laurent or someone else might be able to help you though.

I understand, and I actually wrote the post so that someone that would know more about CMake could answer.

Quote from: "Laurent"
Ok I've found it above, but I don't really understand what the problem is.

Well.. why is ${PROJECT_SOURCE_DIR} incorrectly set ? When running cmake independently to build SFML it's ok, but not when using the external project feature.

I've written the following to get SFML built with my library:
Code: [Select]
include(ExternalProject)
ExternalProject_Add(SFML
    PREFIX "deps/SFML"
    CMAKE_CACHE_ARGS -DBUILD_FRAMEWORKS:BOOL=TRUE)
Title: SFML 2 for OS X comes true!
Post by: Laurent on January 01, 2012, 08:16:54 pm
I don't know anything about the "external project" feature of CMake. But you should be able to include SFML in your source tree as a simple sub-directory, you don't need fancy CMake stuff.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 01, 2012, 08:20:02 pm
Including SFML as a subdirectory works but I also want to give some parameters to the SFML's CMake file. Here I want to build frameworks instead of dynamic libraries for example, without modifying the CMake file.
Title: SFML 2 for OS X comes true!
Post by: Laurent on January 01, 2012, 08:24:14 pm
Have you tried a simple variable assignment?
Code: [Select]
set(BUILD_FRAMEWORKS 1)
include(deps/SFML)

:?:
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 01, 2012, 08:32:56 pm
I suppose you meant add_subdirectory() instead of include().

Yes I had tried that (and tried again right now) and it doesn't work. It's still building SFML dynamic libraries instead of frameworks.
Title: SFML 2 for OS X comes true!
Post by: Laurent on January 01, 2012, 10:51:31 pm
Quote
I suppose you meant add_subdirectory() instead of include().

Oops, yes.

Quote
Yes I had tried that (and tried again right now) and it doesn't work. It's still building SFML dynamic libraries instead of frameworks.

I pushed an improved CMakeLists.txt, can you test again?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 02, 2012, 01:28:04 am
Now it does work when setting BUILD_FRAMEWORKS before add_subdirectory() :D . Thanks you very very much :D .

Just a little note: I got the following message when running CMake:
Code: [Select]
CMake Error at deps/SFML/CMakeLists.txt:9 (set):
  set given invalid arguments for CACHE mode.
Call Stack (most recent call first):
  deps/SFML/CMakeLists.txt:91 (sfml_set_option)
Title: SFML 2 for OS X comes true!
Post by: Laurent on January 02, 2012, 08:01:21 am
Quote
I got the following message when running CMake

Hmm, is it because of the line break in the middle of the function call?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 02, 2012, 02:37:29 pm
Nop.
Title: SFML 2 for OS X comes true!
Post by: Laurent on January 03, 2012, 12:37:52 pm
Warning fixed.
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 07, 2012, 03:40:16 pm
Why does the SFML's CMake script copies SFML.framework directly into the SFML directory rather than in SFML/lib like for the other frameworks ?
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 07, 2012, 03:41:24 pm
I've got no idea. I was wondering the same thing the other day but couldn't find any explanation. =/
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 07, 2012, 04:02:22 pm
We'd need to find out why the other frameworks are being copied into lib, and thus what's missing for the SFML framework. I can't find where this is set for now.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 07, 2012, 04:04:48 pm
Is that really important ? I mean.. it's installed correctly, so it doesn't matter where it is build, right ?
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 07, 2012, 04:08:53 pm
If you do the install step yes. But beyond the install step, I'm trying to gather every frameworks my library depends on in a single directory. It'd be better if I hadn't to look for the SFML frameworks in different places.


Edit: and yeah I could just copy SFML.framework from the main directory but I don't know whether this behavior'll be fixed. I'd be pleased if I hadn't to fix my automated scripts.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 07, 2012, 04:12:37 pm
You don't need to link against SFML.framework. (You can but you're not forced to.) So you could remove this dependency.

However, finding out why this appends would be cool.  :)
Title: SFML 2 for OS X comes true!
Post by: Ceylo on January 07, 2012, 04:27:19 pm
Well it isn't really a matter of linking, but rather about a clean and convenient structure. I gather all of the SFML frameworks in one single place so that the user knows where to find my framework and all of its dependencies (including headers). Then he does whatever he wants with these. He's not forced to do the cmake install step.
Title: SFML 2 for OS X comes true!
Post by: Hiura on January 07, 2012, 04:35:54 pm
OK. I understand your needs now.

The only difference I spot is in the installation rule : COMPONENT is "devel" for SFML.framework and "bin" for the other. I changed it to "bin" but it didn't change a thing...

If someone finds the trick I'll be happy to commit a patch.