I'm using FreeType on Windows, Linux and OSX without a single problem, and now I was to port my tech to IOS... And I can't find a way to have FreeType compiled for it.
At first I tried to drop every FT file into my project, but that clearly didn't work.
Then I tried to make a static library following this tutorial here. While I can't test if it worked for the arm target, it doesn't work for the simulator target.
When trying to link the built library into XCode it says "libfreetype-simulator.a, file was built for archive which is not the architecture being linked (i386)" and that's ok because the command "lipo -info libfreetype-simulator.a" tells me that the file was built for x86_64. I tried configuring it with "./configure --i386-apple-darwin", here's the log. But still, the resulting arch was x86_64.
How in the world can I build freetype for i386, iphone simulator? I really have no clues.
I came across this project today while trying to compile FreeType for iOS: https://github.com/cdave1/freetype2-ios
Just download, open in xcode, and compile. :)
Hope this is helpful for anyone else trying to compile for iOS.
For Xcode 5, gcc has moved location so the configuration should be:
The location of CC can be found by running:
This shell script works for me, x86_64. You maybe need to have a look.
I used it to compile freetype2.5.5, and got armv7, arm64, i386, x86_64.Of course it lipo to a single fat static library.
For freetype to compile smoothly it's important to pass the variables 'CC', 'CFLAGS', 'LDFLAGS' and 'AR' as arguments to
configure
and not as environment variables.at some point
configure
runs the native gcc of the machine and if you have 'LDFLAGS' that point to the iphone SDK it will cause it to fail. passing the variables toconfigure
seems to solve this issue.I used the link in cxa's answer. However it is very out of date, and my configure line did not fit in a comment. For armv7, compiling with the 6.1 SDK, with a minimum version of 5.1, without bzip2, you want something like:
Note the lack of
-mdynamic-no-pic
which would otherwise produce a linker warning, and a warning email from Apple, if left in. Also note that various pathnames have changed.Maybe someone will find it usefull.
SDK 8.1, XCode 6.1
i386,x86_64,arm64 (for profiling) ,armv7,armv7s