How to Build FreeType2 by Xcode Hiroshima University suzuki toshiya 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 1 Why No Project File? • Xcode project file writes FSRef hexadecimal values in project file. – maybe to prevent “missing a source file because it is moved to somewhere”. – the portability is slightly questionable. • It is hard to guarantee that it works with various versions of Xcode. • Feedback is welcomed: – [email protected] – public comment can be posted to freetype mailing list. 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 2 Start Xcode Usually located at /Developer/Applications/Xcode Some versions show “welcome window”, or “wizard window”, or nothing, please don’t care and close it. 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 3 Start New project “File” → “New Project” 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 4 Select Project Template The might be some default, but... Even if you’re going to build iOS library, selecting “Mac OS X” → “Static Library” → “BSD Static Library” is recommended. 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 5 Name and Locate the Project “Save As”: If you want to build libXXX.a, naming “XXX” is recommended. “Where”: You must select the folder of freetype2 source code, including “builds”, “devel”, “include”, “src”, etc. 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 6 Skelton is Prepared From the name of project, the default library name is set automatically. You can change it. 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 7 Add 2 Groups of Sources Right-Click “Source” Folder, then add 2 new groups “base” and “module” 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 8 Register “base” Sources Select the “base” sources from “Finder”. The list of the “base” sources is shown in next slide. 2011/6/17 Drug’n’Drop the selected source codes to “base” group in “Xcode” window You will get a dialog! See the slide after next. (C) Copyright, Hiroshima University, suzuki toshiya 9 List of “base” Sources • • • • • • • • • • • • • src/base/ftbase.c src/base/ftbbox.c src/base/ftbdf.c src/base/ftbitmap.c src/base/ftdebug.c src/base/ftgasp.c src/base/ftglyph.c src/base/ftgxval.c src/base/ftinit.c src/base/ftlcdfil.c src/base/ftmm.c src/base/ftotval.c src/base/ftpfr.c 2011/6/17 • • • • • • • src/base/ftstroke.c src/base/ftsynth.c src/base/ftsystem.c src/base/fttype1.c src/base/ftwinfnt.c src/base/ftxf86.c src/base/ftpatent.c (C) Copyright, Hiroshima University, suzuki toshiya 10 Dialog for Drag’n’Drop You MUST NOT copy the items! Don’t Check 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 11 Registered “base” Sources 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 12 Register “module” Source Register the “module” sources from “Finder”, as you did for “base”. You must gather them from multiple folders, so you cannot finish it by single Drag’n’Drop. You must do many times. The list of the “base” sources is shown in next slide. 2011/6/17 Finished (C) Copyright, Hiroshima University, suzuki toshiya 13 List of “module” Sources • • • • • • • • • • • src/autofit/autofit.c src/bdf/bdf.c src/cache/ftcache.c src/cff/cff.c src/cid/type1cid.c src/gxvalid/gxvalid.c src/gzip/ftgzip.c src/lzw/ftlzw.c src/otvalid/otvalid.c src/pcf/pcf.c src/pfr/pfr.c • • • • • • • • • • src/psaux/psaux.c src/pshinter/pshinter.c src/psnames/psnames.c src/raster/raster.c src/sfnt/sfnt.c src/smooth/smooth.c src/truetype/truetype.c src/type1/type1.c src/type42/type42.c src/winfonts/winfnt.c After freetype-2.4.5 • src/bzip2/ftbzip2.c 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 14 Edit Project Setting “Project” → “Edit Project Settings”, project setting window is opened. Change the “Configuration” radio button to “All Configuration”, to reflect the following modification to all targets (both of Debug & Production code) 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 15 Edit Compiler Flags Select “Build” tab Input “cflags” to the seach form You will get “Other C Flags” Add C Flags like this (for detail, see next slide) 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 16 C Flags to Build FreeType2 -DFT2_BUILD_LIBRARY -DFT_CONFIG_CONFIG_H=“<ftconfig.h>” -DFT_CONFIG_MODULES_H=“<ftmodule.h>” -I$(SOURCE_ROOT)/../include -I$(SOURCE_ROOT)/../devel -I$(SOURCE_ROOT)/../include/freetype/config 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 17 Build! “Build” → “Build” Compiling N of M source files.... 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 18 Result may be found in project directory Xcode creates the folder with project name, objects and libraries are stored in the folder named $(project_name)/build/$(target)/ 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 19 Limitation in Xcode Development • You cannot build universal binary at once. – Unix style building can do that. – You have to build binaries for each architectures and combine them. • You cannot build shared library for iOS. – Unix style building can do that. – Even if SDKs supports it, (some versions of) iOS addon for Xcode does not provide project template. • You cannot build archive and shared library by same project. – Unix style building can do that. – As you were forced to select shared or static library from the template, you cannot build both library at once. • You cannot hide private symbols. – Unix style building can do that, and it prevents your applications from referring private symbols of FreeType2 and guarantee the binary compatibility. 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 20 Any Questions? 2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 21
© Copyright 2024