ios編譯freetype2備忘

來源:互聯網
上載者:User
文章目錄
  • Download the Source
  • Compiling the library
  • Bringing it all together as a universal library
要下載tar格式的,zip的斷行符號不對,confg會有問題下面是轉載別人的 The library has build configurations for most platforms, but unfortunately not iOS. This document describes how to build libfreetype.a as a universal binary for iOS and the Mac (i386, x86_64, arm7).Download the SourceDownload the latest freetype sourcecode from
sourceforge.Open a terminal and extract the archive.Compiling the libraryWe have to compile the library four times, once for each architecture.i386
$ ./configure CFLAGS="-arch i386"$ make
This forces configure to use the i386 architecture and build the library. The built library is located at objs/.libs/libfreetype.a. We copy this to our top level folder and build the next architecture.
$ cp objs/.libs/libfreetype.a libfreetype-i386.a
x86_64Similar build setup for x86_64, notice the addition of make clean, we want to completely remove the i386 code.
$ ./configure CFLAGS="-arch x86_64";make clean;make$ cp objs/.libs/libfreetype.a libfreetype-x86_64.a
arm7Arm7 is used on iPhone 3GS and newer. There are quite a few arguments that need to be passed to configure to make it build for arm7. I'm going under the assumption that you're targeting iOS 5.1 using gcc-4.2 as your compiler. If this is not what you want,
please update the arguments below accordingly.
$ ./configure --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 -mdynamic-no-pic -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/iPhoneOS5.1.sdk/usr/include/libxml2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk" CPP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-cpp-4.2 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/iPhoneOS5.1.sdk -miphoneos-version-min=5.1"$ make clean;make$ cp objs/.libs/libfreetype.a libfreetype-arm7.a
Bringing it all together as a universal libraryWe now have 4 individual libraries. To combine them into a single universal library use the lipo tool.
$ lipo -create -output libfreetype.a libfreetype-i386.a libfreetype-x86_64.a libfreetype-arm7.a
And thats it.You can check which architectures are in a library with the -info argument.
$ lipo -info libfreetype.a
Architectures in the fat file: libfreetype.a are: armv7 i386 x86_64Refer to the
original text.
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.