diff options
author | borenet@google.com <borenet@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-01 17:43:44 +0000 |
---|---|---|
committer | borenet@google.com <borenet@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-01 17:43:44 +0000 |
commit | 7158e6acca1b1ecc321d4d514a31cba11b5ead60 (patch) | |
tree | a7a1a00365caf900fa940e586fc41e10261c23ff /gyp | |
parent | 671eac67ef5f44b80f882e06cf17f1b8f6802980 (diff) |
Improve NaCl support
- Add nacl_make script to build Skia targets for NaCl using gyp
- Add nacl_interface for command-line apps
- Add nacl_sample as front-end for SampleApp
- Add freetype to DEPS
- Various gyp tweaks for NaCl
TODO:
- Implement GL interface
- Implement font host
- Fix plumbing so that SampleApp works properly
Review URL: https://codereview.appspot.com/6671044
git-svn-id: http://skia.googlecode.com/svn/trunk@6245 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gyp')
-rw-r--r-- | gyp/SampleApp.gyp | 5 | ||||
-rw-r--r-- | gyp/apptype_console.gypi | 5 | ||||
-rw-r--r-- | gyp/common.gypi | 22 | ||||
-rw-r--r-- | gyp/common_conditions.gypi | 24 | ||||
-rw-r--r-- | gyp/common_variables.gypi | 2 | ||||
-rw-r--r-- | gyp/core.gyp | 2 | ||||
-rw-r--r-- | gyp/everything.gyp | 2 | ||||
-rw-r--r-- | gyp/freetype.gyp | 104 | ||||
-rw-r--r-- | gyp/gpu.gyp | 12 | ||||
-rw-r--r-- | gyp/gpu.gypi | 1 | ||||
-rw-r--r-- | gyp/images.gyp | 2 | ||||
-rw-r--r-- | gyp/nacl.gyp | 19 | ||||
-rw-r--r-- | gyp/opts.gyp | 4 | ||||
-rw-r--r-- | gyp/ports.gyp | 70 | ||||
-rw-r--r-- | gyp/utils.gyp | 8 | ||||
-rw-r--r-- | gyp/views.gyp | 12 | ||||
-rw-r--r-- | gyp/xml.gyp | 2 | ||||
-rw-r--r-- | gyp/zlib.gyp | 2 |
18 files changed, 201 insertions, 97 deletions
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp index 3b0be1b177..5668428784 100644 --- a/gyp/SampleApp.gyp +++ b/gyp/SampleApp.gyp @@ -290,6 +290,11 @@ '../src/gpu', # To pull gl/GrGLUtil.h ], }], + [ 'skia_os == "nacl"', { + 'sources': [ + '../../nacl/src/nacl_sample.cpp', + ], + }], ], 'msvs_settings': { 'VCLinkerTool': { diff --git a/gyp/apptype_console.gypi b/gyp/apptype_console.gypi index 80e925d9de..a30619373b 100644 --- a/gyp/apptype_console.gypi +++ b/gyp/apptype_console.gypi @@ -17,6 +17,11 @@ 'android_deps.gyp:Android_EntryPoint', ], }], + [ 'skia_os == "nacl"', { + 'dependencies': [ + 'nacl.gyp:nacl_interface', + ], + }], ['skia_os == "ios"', { 'target_conditions': [ ['_type == "executable"', { diff --git a/gyp/common.gypi b/gyp/common.gypi index b6202262d0..7dc27da143 100644 --- a/gyp/common.gypi +++ b/gyp/common.gypi @@ -21,15 +21,21 @@ # situations, like building for iOS on a Mac. 'variables': { 'conditions': [ - ['skia_os != OS and not (skia_os == "ios" and OS == "mac")', - {'error': '<!(Cannot build with skia_os=<(skia_os) on OS=<(OS))'}], - ['skia_mesa and skia_os not in ["mac", "linux"]', - {'error': '<!(skia_mesa=1 only supported with skia_os="mac" or "linux".)'}], - ['skia_angle and not skia_os == "win"', - {'error': '<!(skia_angle=1 only supported with skia_os="win".)' + [ 'skia_os != OS and not ((skia_os == "ios" and OS == "mac") or \ + (skia_os == "nacl" and OS == "linux"))', { + 'error': '<!(Cannot build with skia_os=<(skia_os) on OS=<(OS))', }], - ['skia_arch_width != 32 and skia_arch_width != 64', - {'error': '<!(skia_arch_width can only be 32 or 64 bits not <(skia_arch_width) bits)' + [ 'skia_mesa and skia_os not in ["mac", "linux"]', { + 'error': '<!(skia_mesa=1 only supported with skia_os="mac" or "linux".)', + }], + [ 'skia_angle and not skia_os == "win"', { + 'error': '<!(skia_angle=1 only supported with skia_os="win".)', + }], + [ 'skia_arch_width != 32 and skia_arch_width != 64', { + 'error': '<!(skia_arch_width can only be 32 or 64 bits not <(skia_arch_width) bits)', + }], + [ 'skia_os == "nacl" and OS != "linux"', { + 'error': '<!(Skia NaCl build only currently supported on Linux.)', }], ], }, diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi index ac2defb979..0bbd660e11 100644 --- a/gyp/common_conditions.gypi +++ b/gyp/common_conditions.gypi @@ -98,7 +98,7 @@ }, ], - ['skia_os in ["linux", "freebsd", "openbsd", "solaris"]', + ['skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', { 'defines': [ 'SK_SAMPLES_FOR_X', @@ -141,9 +141,23 @@ '-m32', ], }], - ], - 'include_dirs' : [ - '/usr/include/freetype2', + [ 'skia_os == "nacl"', { + 'defines': [ + 'SK_BUILD_FOR_NACL', + ], + 'link_settings': { + 'libraries': [ + '-lppapi', + '-lppapi_cpp', + '-lnosys', + '-pthread', + ], + }, + }, { # skia_os != "nacl" + 'include_dirs' : [ + '/usr/include/freetype2', + ], + }], ], }, ], @@ -321,7 +335,7 @@ # static initializers if we're using a pthread-compatible thread interface. [ 'skia_os != "win"', { 'defines': [ - 'SK_USE_POSIX_THREADS' + 'SK_USE_POSIX_THREADS', ], }], ], # end 'conditions' diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi index 6acf5bcd5e..974e93bdd2 100644 --- a/gyp/common_variables.gypi +++ b/gyp/common_variables.gypi @@ -84,7 +84,6 @@ 'skia_texture_cache_mb_limit%': 0, 'skia_angle%': 0, 'skia_directwrite%': 0, - 'skia_nacl%': 0, 'skia_gpu%': 1, 'skia_osx_sdkroot%': 'macosx', }, @@ -103,7 +102,6 @@ 'skia_arch_width%': '<(skia_arch_width)', 'skia_arch_type%': '<(skia_arch_type)', 'skia_directwrite%': '<(skia_directwrite)', - 'skia_nacl%': '<(skia_nacl)', 'skia_gpu%': '<(skia_gpu)', 'skia_osx_sdkroot%': '<(skia_osx_sdkroot)', 'skia_static_initializers%': '<(skia_static_initializers)', diff --git a/gyp/core.gyp b/gyp/core.gyp index 228fd06e56..14b14b04fb 100644 --- a/gyp/core.gyp +++ b/gyp/core.gyp @@ -83,7 +83,7 @@ }], [ 'skia_os == "android"', { 'dependencies': [ - 'android_deps.gyp:ft2', + 'freetype.gyp:freetype', ], }], [ 'skia_os == "android" and skia_arch_type == "arm" and armv7 == 1', { diff --git a/gyp/everything.gyp b/gyp/everything.gyp index 2cecd92aaa..e1d516dda6 100644 --- a/gyp/everything.gyp +++ b/gyp/everything.gyp @@ -14,7 +14,7 @@ 'type': 'none', 'dependencies': ['most.gyp:most'], 'conditions': [ - ['skia_os == "ios" or skia_os == "android" or (skia_os == "mac" and skia_arch_width == 32)', { + ['skia_os in ("ios", "android", "nacl") or (skia_os == "mac" and skia_arch_width == 32)', { # debugger is not supported on this platform }, { 'dependencies': [ 'debugger.gyp:debugger' ], diff --git a/gyp/freetype.gyp b/gyp/freetype.gyp index 4a885a1ccf..db617425a5 100644 --- a/gyp/freetype.gyp +++ b/gyp/freetype.gyp @@ -1,60 +1,82 @@ { 'targets': [ { - 'target_name': 'skfreetype', + 'target_name': 'freetype', 'type': 'static_library', 'sources': [ - '../third_party/freetype/src/base/ftbbox.c', - '../third_party/freetype/src/base/ftbitmap.c', - '../third_party/freetype/src/base/ftglyph.c', - '../third_party/freetype/src/base/ftlcdfil.c', - '../third_party/freetype/src/base/ftstroke.c', - '../third_party/freetype/src/base/ftxf86.c', - '../third_party/freetype/src/base/ftbase.c', - '../third_party/freetype/src/base/ftsystem.c', - '../third_party/freetype/src/base/ftinit.c', - '../third_party/freetype/src/base/ftgasp.c', - '../third_party/freetype/src/base/ftfstype.c', - '../third_party/freetype/src/raster/raster.c', - '../third_party/freetype/src/sfnt/sfnt.c', - '../third_party/freetype/src/smooth/smooth.c', - '../third_party/freetype/src/autofit/autofit.c', - '../third_party/freetype/src/truetype/truetype.c', - '../third_party/freetype/src/cff/cff.c', - '../third_party/freetype/src/psnames/psnames.c', - '../third_party/freetype/src/pshinter/pshinter.c', + # base components (required) + '../third_party/externals/freetype/src/base/ftsystem.c', + '../third_party/externals/freetype/src/base/ftinit.c', + '../third_party/externals/freetype/src/base/ftdebug.c', + '../third_party/externals/freetype/src/base/ftbase.c', -# added for linker - '../third_party/freetype/src/lzw/ftlzw.c', - '../third_party/freetype/src/gzip/ftgzip.c', - '../third_party/freetype/src/cid/type1cid.c', - '../third_party/freetype/src/bdf/bdf.c', - '../third_party/freetype/src/psaux/psaux.c', - '../third_party/freetype/src/pcf/pcf.c', - '../third_party/freetype/src/pfr/pfr.c', - '../third_party/freetype/src/type1/type1.c', - '../third_party/freetype/src/type42/type42.c', - '../third_party/freetype/src/winfonts/winfnt.c', + '../third_party/externals/freetype/src/base/ftbbox.c', # recommended, see <freetype/ftbbox.h> + '../third_party/externals/freetype/src/base/ftglyph.c', # recommended, see <freetype/ftglyph.h> + + '../third_party/externals/freetype/src/base/ftbitmap.c', # optional, see <freetype/ftbitmap.h> + '../third_party/externals/freetype/src/base/ftfstype.c', # optional + '../third_party/externals/freetype/src/base/ftgasp.c', # optional, see <freetype/ftgasp.h> + '../third_party/externals/freetype/src/base/ftlcdfil.c', # optional, see <freetype/ftlcdfil.h> + '../third_party/externals/freetype/src/base/ftmm.c', # optional, see <freetype/ftmm.h> + '../third_party/externals/freetype/src/base/ftpatent.c', # optional + '../third_party/externals/freetype/src/base/ftstroke.c', # optional, see <freetype/ftstroke.h> + '../third_party/externals/freetype/src/base/ftsynth.c', # optional, see <freetype/ftsynth.h> + '../third_party/externals/freetype/src/base/fttype1.c', # optional, see <freetype/t1tables.h> + '../third_party/externals/freetype/src/base/ftwinfnt.c', # optional, see <freetype/ftwinfnt.h> + '../third_party/externals/freetype/src/base/ftxf86.c', # optional, see <freetype/ftxf86.h> + + # font drivers (optional; at least one is needed) + '../third_party/externals/freetype/src/cff/cff.c', # CFF/OpenType font driver + '../third_party/externals/freetype/src/sfnt/sfnt.c', # SFNT files support (TrueType & OpenType) + '../third_party/externals/freetype/src/truetype/truetype.c', # TrueType font driver + + # rasterizers (optional; at least one is needed for vector formats) + '../third_party/externals/freetype/src/raster/raster.c', # monochrome rasterizer + '../third_party/externals/freetype/src/smooth/smooth.c', # anti-aliasing rasterizer + + # auxiliary modules (optional) + '../third_party/externals/freetype/src/autofit/autofit.c', # auto hinting module + '../third_party/externals/freetype/src/psaux/psaux.c', # PostScript Type 1 parsing + '../third_party/externals/freetype/src/pshinter/pshinter.c', # PS hinting module + '../third_party/externals/freetype/src/psnames/psnames.c', # PostScript glyph names support ], 'include_dirs': [ - '../third_party/freetype/internal', - '../third_party/freetype/builds', - '../third_party/freetype/include', - '../third_party/freetype', + '../third_party/externals/freetype/internal', + '../third_party/externals/freetype/builds', + '../third_party/externals/freetype/include', + '../third_party/externals/freetype', ], 'cflags': [ - '-W', - '-Wall', - '-fPIC', - '-DPIC', - '-DDARWIN_NO_CARBON', '-DFT2_BUILD_LIBRARY', ], 'direct_dependent_settings': { 'include_dirs': [ - '../third_party/freetype/include', # For ft2build.h + '../third_party/externals/freetype/include', ], }, + 'conditions': [ + [ 'skia_os == "mac"', { + 'sources': [ + '../third_party/externals/freetype/src/base/ftmac.c', # only on the Macintosh + ], + }], + [ 'skia_os == "android"', { + # These flags are used by the Android OS. They are probably overkill + # for Skia, but we add them for consistency. + 'cflags': [ + '-W', + '-Wall', + '-fPIC', + '-DPIC', + '-DDARWIN_NO_CARBON', + '-DFT2_BUILD_LIBRARY', + '-O2', + ], + 'cflags!': [ + '-fno-rtti', # supress warnings about invalid option of non-C++ code + ], + }], + ], }, ], } diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp index 9cb06980d3..d5223e40ef 100644 --- a/gyp/gpu.gyp +++ b/gyp/gpu.gyp @@ -21,6 +21,10 @@ 'sources/': [ ['exclude', '_android.(h|cpp)$'], ], }], + ['skia_os != "nacl"', { + 'sources/': [ ['exclude', '_nacl.(h|cpp)$'], + ], + }], [ 'skia_os == "android"', { 'defines': [ 'GR_ANDROID_BUILD=1', @@ -209,10 +213,18 @@ 'link_settings': { 'libraries': [ '-lGL', + '-lGLU', '-lX11', ], }, }], + [ 'skia_os == "nacl"', { + 'link_settings': { + 'libraries': [ + '-lppapi_gles2', + ], + }, + }], [ 'skia_mesa and skia_os == "linux"', { 'link_settings': { 'libraries': [ diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index 0c45aa5908..67cf6034f2 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -238,6 +238,7 @@ 'skgr_native_gl_sources': [ '<(skia_include_path)/gpu/gl/SkNativeGLContext.h', '<(skia_src_path)/gpu/gl/mac/SkNativeGLContext_mac.cpp', + '<(skia_src_path)/gpu/gl/nacl/SkNativeGLContext_nacl.cpp', '<(skia_src_path)/gpu/gl/win/SkNativeGLContext_win.cpp', '<(skia_src_path)/gpu/gl/unix/SkNativeGLContext_unix.cpp', '<(skia_src_path)/gpu/gl/android/SkNativeGLContext_android.cpp', diff --git a/gyp/images.gyp b/gyp/images.gyp index 2989afeb11..daf4c5f6c8 100644 --- a/gyp/images.gyp +++ b/gyp/images.gyp @@ -89,7 +89,7 @@ '../src/ports/SkImageDecoder_CG.cpp', ], }], - [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { + [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', { 'sources!': [ '../src/images/SkImageDecoder_libgif.cpp', '../src/images/SkMovie_gif.cpp', diff --git a/gyp/nacl.gyp b/gyp/nacl.gyp new file mode 100644 index 0000000000..95b2a8226e --- /dev/null +++ b/gyp/nacl.gyp @@ -0,0 +1,19 @@ +# Common entry point for all Skia executables running in NaCl +{ + 'targets': [ + { + 'target_name': 'nacl_interface', + 'type': 'static_library', + 'dependencies': [ + 'skia_base_libs.gyp:skia_base_libs', + ], + 'include_dirs': [ + # For SkThreadUtils.h + '../src/utils', + ], + 'sources': [ + '../../nacl/src/nacl_interface.cpp', + ], + }, + ], +}
\ No newline at end of file diff --git a/gyp/opts.gyp b/gyp/opts.gyp index b8d7e22960..cd892e8f59 100644 --- a/gyp/opts.gyp +++ b/gyp/opts.gyp @@ -32,7 +32,7 @@ 'conditions': [ [ 'skia_arch_type == "x86" and skia_os != "ios"', { 'conditions': [ - [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { + [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', { 'cflags': [ '-msse2', ], @@ -108,7 +108,7 @@ '../src/core', ], 'conditions': [ - [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { + [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', { 'cflags': [ '-mssse3', ], diff --git a/gyp/ports.gyp b/gyp/ports.gyp index f743ad4f7f..6403693f98 100644 --- a/gyp/ports.gyp +++ b/gyp/ports.gyp @@ -20,6 +20,7 @@ '../src/utils', ], 'sources': [ + '../src/ports/SkDebug_nacl.cpp', '../src/ports/SkDebug_stdio.cpp', '../src/ports/SkDebug_win.cpp', '../src/ports/SkFontDescriptor.h', @@ -39,36 +40,51 @@ ], 'conditions': [ [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { - 'conditions': [ - [ 'skia_nacl', { - 'defines': [ - 'SK_CAN_USE_DLOPEN=0', - ], - 'sources': [ - '../src/ports/SkFontHost_none.cpp', - ], - }, { - 'defines': [ - #The font host requires at least FreeType 2.3.0 at runtime. - 'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020300', - 'SK_CAN_USE_DLOPEN=1', - ], - 'sources': [ - '../src/ports/SkFontHost_FreeType.cpp', - '../src/ports/SkFontHost_FreeType_common.cpp', - '../src/ports/SkFontHost_linux.cpp', - ], - 'link_settings': { - 'libraries': [ - '-lfreetype', - '-ldl', - ], - }, - }], + 'defines': [ + #The font host requires at least FreeType 2.3.0 at runtime. + 'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020300',\ + 'SK_CAN_USE_DLOPEN=1', + ], + 'link_settings': { + 'libraries': [ + '-lfreetype', + '-ldl', + ], + }, + 'sources': [ + '../src/ports/SkFontHost_FreeType.cpp', + '../src/ports/SkFontHost_FreeType_common.cpp', + '../src/ports/SkFontHost_linux.cpp', + '../src/ports/SkThread_pthread.cpp', + ], + }], + [ 'skia_os == "nacl"', { + 'dependencies': [ + # On other OS, we can dynamically link against freetype. For nacl, + # we have to include our own version since the naclports version is + # too old (<0x020300) to provide the functionality we need. + 'freetype.gyp:freetype', + ], + 'export_dependent_settings': [ + 'freetype.gyp:freetype', + ], + 'defines': [ + # We use Android's repo, which provides at least FreeType 2.4.0 + 'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020400',\ ], 'sources': [ + '../src/ports/SkFontHost_FreeType.cpp', + '../src/ports/SkFontHost_FreeType_common.cpp', + '../src/ports/SkFontHost_linux.cpp', '../src/ports/SkThread_pthread.cpp', ], + 'sources!': [ + '../src/ports/SkDebug_stdio.cpp', + ], + }, { + 'sources!': [ + '../src/ports/SkDebug_nacl.cpp', + ], }], [ 'skia_os == "mac"', { 'include_dirs': [ @@ -150,7 +166,7 @@ #TODO: include the ports/SkImageRef_ashmem.cpp for non-NDK builds ], 'dependencies': [ - 'android_deps.gyp:ft2', + 'freetype.gyp:freetype', 'android_deps.gyp:expat', ], }], diff --git a/gyp/utils.gyp b/gyp/utils.gyp index 97f25b158d..aa3f4a3c74 100644 --- a/gyp/utils.gyp +++ b/gyp/utils.gyp @@ -129,12 +129,6 @@ ], }], [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { - 'link_settings': { - 'libraries': [ - '-lGL', - '-lGLU', - ], - }, 'sources!': [ '../src/utils/SkThreadUtils_pthread_other.cpp', ], @@ -176,7 +170,7 @@ '../src/utils/win/SkIStream.cpp', ], }], - [ 'skia_nacl == 1', { + [ 'skia_os == "nacl"', { 'sources': [ '../src/utils/SkThreadUtils_pthread_other.cpp', ], diff --git a/gyp/views.gyp b/gyp/views.gyp index 80be87e0d6..5f58a87f49 100644 --- a/gyp/views.gyp +++ b/gyp/views.gyp @@ -32,6 +32,7 @@ '../include/views/SkKey.h', '../include/views/SkOSMenu.h', '../include/views/SkOSWindow_Mac.h', + '../include/views/SkOSWindow_NaCl.h', '../include/views/SkOSWindow_SDL.h', '../include/views/SkOSWindow_Unix.h', '../include/views/SkOSWindow_Win.h', @@ -111,6 +112,17 @@ '../src/views/win/skia_win.cpp', ], }], + [ 'skia_os == "nacl"', { + 'sources!': [ + '../src/views/unix/SkOSWindow_Unix.cpp', + '../src/views/unix/keysym2ucs.c', + '../src/views/unix/skia_unix.cpp', + ], + }, { + 'sources!': [ + '../src/views/nacl/SkOSWindow_NaCl.cpp', + ], + }], [ 'skia_gpu == 1', { 'include_dirs': [ '../include/gpu', diff --git a/gyp/xml.gyp b/gyp/xml.gyp index b7fdb8397a..5cf06594b1 100644 --- a/gyp/xml.gyp +++ b/gyp/xml.gyp @@ -32,7 +32,7 @@ '../src/xml/SkXMLPullParser.cpp', #if 0 around class decl in header ], 'conditions': [ - [ 'skia_os in ["win", "mac", "linux", "freebsd", "openbsd", "solaris", "android", "ios"]', { + [ 'skia_os in ["win", "mac", "linux", "freebsd", "openbsd", "solaris", "android", "ios", "nacl"]', { 'sources!': [ # no jsapi.h by default on system '../include/xml/SkJS.h', diff --git a/gyp/zlib.gyp b/gyp/zlib.gyp index 864a059bf3..fcd0ac3b40 100644 --- a/gyp/zlib.gyp +++ b/gyp/zlib.gyp @@ -29,7 +29,7 @@ }, 'defines': [ 'SK_ZLIB_INCLUDE=<zlib.h>', ], }], - [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android", "nacl"]', { 'link_settings': { 'libraries': [ '-lz', ], }, 'defines': [ 'SK_ZLIB_INCLUDE=<zlib.h>', ], }], |