21
2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 1 How to Build FreeType2 by Xcode Hiroshima University suzuki toshiya

How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 1

How to Build FreeType2 by Xcode

Hiroshima Universitysuzuki toshiya

Page 2: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 2

Why No Project File?• Xcode project file writes FSRefhexadecimal 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.

Page 3: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 3

Start XcodeUsually located at /Developer/Applications/Xcode

Some versions show “welcome window”, or “wizard window”, or nothing, please don’t care and close it.

Page 4: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 4

Start New project“File” → “New Project”

Page 5: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 5

Select Project TemplateThe 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.

Page 6: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 6

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.

Page 7: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 7

Skelton is Prepared

From the name of project, the default library name is set automatically. You can change it.

Page 8: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 8

Add 2 Groups of SourcesRight-Click “Source” Folder,then add 2 new groups “base” and “module”

Page 9: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 9

Register “base” Sources

Select the “base”sources from

“Finder”. The list of the “base”

sources is shown in next slide.

Drug’n’Drop the selected source codes to “base”

group in “Xcode” window

You will get a dialog! See

the slide after next.

Page 10: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 10

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

• 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

Page 11: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 11

Dialog for Drag’n’Drop

You MUST NOT copy the items!

Don’t Check

Page 12: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 12

Registered “base” Sources

Page 13: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 13

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.

Finished

Page 14: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 14

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

Page 15: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 15

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)

Page 16: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 16

Edit Compiler FlagsInput “cflags” to the seach form

Select “Build” tab

You will get “Other C Flags”

Add C Flags like this (for detail, see next slide)

Page 17: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 17

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

Page 18: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 18

Build!“Build” → “Build”

Compiling N of M source files....

Page 19: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 19

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)/

Page 20: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 20

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.

Page 21: How to Build FreeType2 by Xcodegyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/howtobuild-ft2-xcode31_20110617a.pdf• Xcode project file writes FSRef hexadecimal values in project file. –

2011/6/17 (C) Copyright, Hiroshima University, suzuki toshiya 21

Any Questions?