freetype2 – 为IOS编译Freetype 2.6.5 Xcode

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

我尝试了命令here,但我没有通过第一个命令,我得到了这个

FreeType build system — automatic system detection

The following settings are used:

platform unix compiler cc
configuration directory ./builds/unix configuration rules
./builds/unix/unix.mk

If this does not correspond to your system or settings please remove
the file `config.mk’ from this directory then read the INSTALL file
for help.

Otherwise,simply type
/Applications/Xcode.app/Contents/Developer/usr/bin/make' again to
build the library,or
/Applications/Xcode.app/Contents/Developer/usr/bin/make refdoc’ to
build the API reference (this needs python >= 2.6).

cd builds/unix; \
./configure ‘CFLAGS=-arch i386’ /bin/sh: ./configure: No such file or directory make: *** [setup] Error 127

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

For an iOS static library,use
#

cmake -D IOS_PLATFORM=OS -G Xcode

#

or

#

cmake -D IOS_PLATFORM=SIMULATOR -G Xcode

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

解决方法

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

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

例如,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,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

It’s a bit of work to construct the commands for each arch,but
fortunately 07001
— which automatically downloads,extracts,and builds the latest FreeType (2.6.5 currently).

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

./build_freetype.sh

生成的iOS库在完成后可以在〜/ Desktop / FreeType_iOS_Release中找到.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...