我在 Windows、Linux 和 OSX 上使用 FreeType 没有任何问题,现在我要把我的技术移植到 IOS 上...... 而且我找不到为它编译 FreeType 的方法。
起初我尝试将每个 FT 文件放入我的项目中,但这显然行不通。
然后我尝试在this tutorial here之后制作一个静态库. 虽然我无法测试它是否适用于 arm 目标,但它不适用于模拟器目标。
当尝试将构建的库链接到 XCode 时,它说“libfreetype-simulator.a,文件是为存档构建的,不是被链接的体系结构 (i386)” 这没关系,因为命令“lipo -info libfreetype-simulator.a”告诉我该文件是为 x86_64 构建的。 我尝试使用“./configure --i386-apple-darwin”对其进行配置,here's the log . 但是,生成的架构仍然是 x86_64。
我究竟该如何为 i386 和 iphone 模拟器构建 freetype? 我真的没有线索。
最佳答案
我使用了 link in cxa's answer .但是它已经过时了,我的配置行不适合评论。对于 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'
请注意缺少 -mdynamic-no-pic
,否则会产生链接器警告,如果留在其中,还会收到来自 Apple 的警告电子邮件。另请注意,各种路径名已更改。
关于iphone - 为 iPhone 编译 FreeType?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6425643/