cinder/Cinder — pull request #195 by reakinator (2012-07-22 06:29:10+00:00)
Title: Make libc++ possible if enabled.

These are the minimal changes needed to source code in order to compile with libc++ enabled.

Most of these changes will need to be done at some time or another, such as the bug fix in AudioImplAudioUnit or making sure that we only use the std namespace for thread and functional related stuff. There is also a change from thread::yield() to this_thread::yield(), as this is compatible with C++11 and also defined in boost/thread.hpp.

In order to detect libc++, I include boost/config.hpp, a sure fire way to verify that the _LIBCPP_VERSION symbol will be there if libc++ is enabled. It was actually already included by boost/cstdint.hpp, but this is clearer. There are a few different options to this approach, which were [recently discussed][5] on the clang forum and I'm open to modifying this pull request if you think a different option is superior.

Note that the project file and boost binaries are unmodified, so a little more work needs to be done to test this, as discussed on the forum. To make it a bit easier, I have placed the boost binaries for macosx [here][1].

Also note, there is a bug in the current version of libc++ ([reported][2] and [fixed][3]) that effects svg::Node - it falsely complains that the std::function typedef's arguments are not complete, since Node is a forward declaration. The fix is very simple however, so I just applied [this patch][4] to my local copy in order to keep testing. Hopefully this fix will make it into the next version of Xcode / clang...

[1]: https://dl.dropbox.com/u/3905723/cinder/boost-binaries-1_48-clang-libc%2B%2B.zip
[2]: http://comments.gmane.org/gmane.comp.compilers.clang.devel/22745
[3]: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?revision=160285&view=markup
[4]: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?view=patch&r1=160285&r2=160284&pathrev=160285
[5]: http://clang-developers.42468.n3.nabble.com/Best-way-to-detect-libc-at-compile-time-td4025578.html