-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
oF 64 bit, c++11 support (only merge once os x apothecary build binaries are in master) #3627
Conversation
+ allows core to be compiled as c++11 and linked against libc++
+ puts compilation flags into xcconfig instead of project files. + compilation flags are laid out so that core can be compiled 32 bit or 64 bit, and will take the current user selected arch as a hint which architecture should be compiled. Also, the correct c++ settings and stdlinb settings are used, based on user selected arch. This works through architecture specific build flags.
includes Project.xcconfig at target level, thus making sure proper 64/32 bit settings are set up, unless someone wants to set their own target settings in their project files.
CLANG_CXX_LIBRARY[arch=x86_64] = libc++ | ||
CLANG_CXX_LANGUAGE_STANDARD[arch=x86_64] = c++11 | ||
|
||
MACOSX_DEPLOYMENT_TARGET = 10.7 // libstdc++ is only available in 10.7+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, cpp11 apparently requires 10.7+
thanks! looking forward to merging this once the apothecary libs are built :) |
Thx so much for making this happen guys! |
I think its okay if we want to merge this now as long as it works fine and defaults to i386. |
I'd wait just for a little bit more if possible- the PR is quite slim and since it only touches the project files shouldn't code rot that fast, but if merged, you might end up with a not-yet-functional 64 bit target (the i386 target should be fine) which might confuse folks using master as their development branch... That said, if there's consensus to merge earlier, I can try to figure out to make sure it defaults to i386 =) |
Amazing, thanks for the great writeup as well @tgfrerer :) |
I'll just ping @openframeworks/documentation so that they're aware of this write-up which could probably be easily cannibalized for a guide on this. |
Awesome! seems we are |
@tgfrerer now that the required apothecary changes have been merged into HEAD, can this be merged as well? |
@pizthewiz it will only work (for 64bit) once the apothecary compiled binaries (and the corresponding headers) are in master. In the meantime, if run apothecary on your machine and recompile all core libraries using it, you should already be able to apply this PR and run 64bit/c++11 on OS X. I believe a recent #define change for RPI has broken the auto-merge for this PR. It's probably just manually merging that line in |
Howya! Great work with this and kudos on the clear instructions. I had some issues loading fonts with missing symbols for freetype like this:- Undefined symbols for architecture x86_64: However it works fine linking to my universal homebrew version of freetype. I then managed to get it working with openFrameworks' version by adding "--without-harfbuzz" to freetype.sh. Not sure if this affects others, hope it might be of some use... |
hey @carthach, that's great to know! As far as i could find out, the harfbuzz dependency has been added to Freetype 2.5.3 and is used to scan advanced OpenType layout features (see: freetype.org). It seems sensible to exclude it for now, as FreeType seems to work fine in most cases and provides the switch you found. Also, Freetype are apparently exploring the possibility of merging some of harfbuzz's features into their codebase. I guess if someone absolutely needs these advanced layout features, linking to a homebrew version of freetype like you did would make a lot of sense. I wonder, did you see any differences in text rendering between the homebrew and the apothecary version of freetype once you got the latter working? Ping @openframeworks/typography Do you mind sending a PR to the apothecary recipe for freetype adding the switch you found? |
Sorry maybe I wasn't clear, the homebrew script has the no harfbuzz tag as well, that's where I got the idea for the fix. I'll do a PR no problem. |
This reverts commit fa15656.
…ks into of_64_bit_c++11
* fixes merge conflict after android #defines added * adds platform tests onto individual lines, to make this easier to read, and to enable more reliable version control.
Fix multiline #if
Fix multiline #if. For real this time.
is it possible for you to add commits for the precompiled binaries as well? then we should be able to merge and work with it immediately, correct? it would be good to merge this while we're filling all out apothecary / c++11 / 64-bit. the repo will get bigger again, but it's temporary :) |
+ include <memory> for emscripten, osx, ios, linux if cpp11 is available, otherwise include <tr1/memory> i'm making this a multiline #ifdef so that future additions should be easier to add / merge.
@tgfrerer the OS X 64bit libs are now in master and 10.8 is set as the default target. Do you want to update your PR so we can merge it in? |
+ allows core to be compiled as c++11 and linked against libc++
+ puts compilation flags into xcconfig instead of project files. + compilation flags are laid out so that core can be compiled 32 bit or 64 bit, and will take the current user selected arch as a hint which architecture should be compiled. Also, the correct c++ settings and stdlinb settings are used, based on user selected arch. This works through architecture specific build flags.
includes Project.xcconfig at target level, thus making sure proper 64/32 bit settings are set up, unless someone wants to set their own target settings in their project files.
This reverts commit fa15656.
* fixes merge conflict after android #defines added * adds platform tests onto individual lines, to make this easier to read, and to enable more reliable version control.
+ include <memory> for emscripten, osx, ios, linux if cpp11 is available, otherwise include <tr1/memory> i'm making this a multiline #ifdef so that future additions should be easier to add / merge.
…into of_64_bit_c++11 # Conflicts: # libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig
@ofTheo i've just merged it manually on my mac, and tested OSX cpp11, and cpp98, which works =) |
oF 64 bit, c++11 support (only merge once os x apothecary build binaries are in master)
whohoo! |
woah is this what I think it is? |
@armadillu yes. you might need to use the apps/devApps/projectGenerator to regenerate the Xcode files - but then you can build both 64bit or 32bit apps. |
I guess an image says it better than 1.000 words =):
This sets up the OS X openFrameworksLib project files and the openFrameworks project template so that you can select via drop-down whether you want to compile your openFrameworks app as 64 bit c++11, or, legacy 32 bit cpp98. Addresses #2016, #1864
Use
emptyExample Debug
) to either compile theDebug
or theRelease
configuration.You can click the architecture dropdown to switch between architectures. Don't worry about selecting the target architecture for openFrameworks itself, that one is automatically detected from your current build target.
Also, the correct stdlib is automatically used to link everything together. In 32 bit mode, you can use cpp98 like you always did. =)
But, once you switch over to 64 bit mode, you get full c++11 support:
How this works
In XCode, you can set per architecture build flags. These build flags make sure that the 64 bit and the 32 bit version are compiled with the correct toolchains. The Project is set to
Universal
(which gives you the architecture selection dropdown), but the projects themselves are set up to only build the active architecture. This gives you either a 32 bit binary or a 64 bit binary.I put the necessary project build settings into the CoreOF.xcconfig file. This file is included in both the App project compile settings and the openFrameworksLib project compile settings.
For the app settings, it is included at
Target
level, meaning the settings in CoreOF.xcconfig it will take precedent over the settings selected in theproject build settings
panel. (If you need to, you can still override the settings using thetarget build settings
panel).To update "old" project files to 64 bit, using the projectGenerator with "update project" in devApps should do.
Pre-Requisites
This works once apothecary has been used to compile out all necessary fat libs:
Preview
If you don't want to compile everything, i have a branch in my repo currently that has all that applied, and the libraries compiled, so if you pull from this, you should be able to test 64 bit / 32 bit openFrameworks quickly: https://github.com/tgfrerer/openFrameworks/tree/of_64_bit_c%2B%2B11-precompiled