为iPhone编译FreeType?

Tom*_*m89 9 iphone config freetype ios

我在Windows,Linux和OSX上使用FreeType没有一个问题,现在我将我的技术移植到IOS ......而且我找不到为它编译FreeType的方法.

起初我试图将每个FT文件放入我的项目中,但这显然不起作用.

然后我尝试按照本教程制作一个静态库.虽然我无法测试它是否适用于手臂目标,但它不适用于模拟器目标.

当试图将构建的库链接到XCode时,它说"libfreetype-simulator.a,文件是为存档而构建的,而不是被链接的架构(i386)",这很好,因为命令"lipo -info libfreetype-simulator.a"告诉我该文件是为x86_64构建的.我尝试用"./configure --i386-apple-darwin"配置它,这是日志.但是,最终的拱形是x86_64.

我怎样才能为i386,iphone模拟器构建freetype?我真的没有线索.

rob*_*e_c 13

在cxa的答案中使用了链接.但是它已经过时了,我的配置行不适合评论.对于armv7,使用6.1 SDK进行编译,最低版本为5.1,不使用bzip2,您需要以下内容:

./configure '--without-bzip2' '--prefix=/usr/local/iphone' '--host=arm-apple-darwin' '--enable-static=yes' '--enable-shared=no' 'CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' 'CFLAGS=-arch armv7 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=5.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/libxml2/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/' 'AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar' 'LDFLAGS=-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/ -miphoneos-version-min=5.1'
Run Code Online (Sandbox Code Playgroud)

请注意,-mdynamic-no-pic否则会产生链接器警告,以及来自Apple的警告电子邮件(如果留下).另请注意,各种路径名已更改.

  • 多年后我登录了SO,我已经更新了正确答案,谢谢! (2认同)

小智 11

我在尝试为iOS编译FreeType时遇到了这个项目:https://github.com/cdave1/freetype2-ios

只需下载,在xcode中打开,然后编译.:)

希望这对其他试图为iOS编译的人都有帮助.


cxa*_*cxa 6

我已经使用以下链接成功编译了FreeType for iOS:http://librocket.com/wiki/documentation/BuildingFreeTypeForiOS


Vin*_*emp 5

对于Xcode 5,gcc已移动位置,因此配置应为:

./configure --without-zlib --without-png --without-bzip2 '--prefix=/usr/local/iPhone' '--host=arm-apple-darwin' '--enable-static=yes' '--enable-shared=no' 'CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' 'CFLAGS=-arch armv7 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=6.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/libxml2/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/' 'AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar' 'LDFLAGS=-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/ -miphoneos-version-min=6.1'
Run Code Online (Sandbox Code Playgroud)

可以通过运行以下命令找到CC的位置:

$ xcrun -find -sdk iphoneos clang
Run Code Online (Sandbox Code Playgroud)