为IOS编译Freetype 2.6.5 Xcode

Mig*_*uel 6 freetype2

好吧,伙计们,我发布了一个类似的问题并将其删除,因为它不够具体,所以我去了.从Freetype 2.6.5的zip文件中,我无法创建一个Xcode项目,该项目将编译用于iOS的库,仅用于i386_64.

我在这里尝试了这些命令,但是我没有通过第一个命令而且我得到了这个

FreeType构建系统 - 自动系统检测

使用以下设置:

platform unix compiler cc
配置目录./builds/unix配置规则
./builds/unix/unix.mk

如果这与您的系统或设置不符,请从该目录中删除文件`config.mk',然后阅读INSTALL文件以获取帮助.

否则,只需键入 /Applications/Xcode.app/Contents/Developer/usr/bin/make' again to build the library, or /Applications/Xcode.app/Contents/Developer/usr/bin/make refdoc'来构建API引用(这需要python> = 2.6).

cd builds/unix;\./configure'CFLAGS = -arch i386'/ bin/sh:./ configure:没有这样的文件或目录make:***[setup]错误127

我也按照cmakelists.txt里面的说明进入项目内部,但仍然没有,我仍然得到一个osx的xcode项目而不是IOS,这给了我很多的链接错误.以下是供您参考的说明.

对于iOS静态库,请使用#

cmake -D IOS_PLATFORM = OS -G Xcode

#

要么

#

cmake -D IOS_PLATFORM = SIMULATOR -G Xcode

我不知道还能做什么.有帮助吗?

l'L*_*L'l 7

以下是为iOS编译FreeType库的基本构建过程概述:

  1. 下载最新的FreeType源代码
  2. 解压缩归档并cd到unarchived目录中
  3. 为所需的体系结构设置工具链和导出变量(arm64,arm7,i386,x86_64)
  4. 编译源代码并构建库

例如,构建命令arm64可能看起来像这样:

$ export CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
$ iphoneos="7.0" # target version of iOS 
$ ARCH="arm64" # architecture (arm64, arm7, i386, x86_64)
$ export CFLAGS="-arch ${ARCH} -pipe -mdynamic-no-pic -Wno-trigraphs -fpascal-strings \
-O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden \
-miphoneos-version-min=$iphoneos -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" 
$ export AR="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar"
$ export LDFLAGS="-arch ${ARCH} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
-miphoneos-version-min=7.0"
$ ./configure --host="aarch64-apple-darwin" --enable-static=yes --enable-shared=no           
$ make     
$ clean
Run Code Online (Sandbox Code Playgroud)

为每个arch构建命令需要做一些工作,但幸运的是有一个构建脚本 - 它可以自动下载,提取和构建最新的FreeType(当前为2.6.5).

要运行脚本,只需在终端中使用以下命令:

./build_freetype.sh
Run Code Online (Sandbox Code Playgroud)

生成的iOS库可在~/Desktop/FreeType_iOS_Release完成时找到.

  • 对于当前版本的iOS,答案中提到的构建脚本有点过时了.分解要点并进行相应修改,以便与iOS 8.2+向前兼容,并且可以在[此处](https://gist.github.com/ayansg/066f3ad7c84f9fd5f61651fc0d099bc3)找到.希望有人可能会发现它有用. (5认同)