2013-12-10 22:57:22 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
import locale
|
2015-02-26 08:14:02 +03:00
|
|
|
from collections import defaultdict
|
2013-12-10 22:57:22 +04:00
|
|
|
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
|
|
|
|
|
2014-02-20 02:10:33 +04:00
|
|
|
header = """
|
2014-03-12 09:06:29 +04:00
|
|
|
#
|
|
|
|
# ##### ####### # # # # # #
|
|
|
|
# ## # # # # # # # # # # # #
|
|
|
|
# ## # # # # # # # # # # #
|
|
|
|
# ## #### # # # # # # # # # #
|
|
|
|
# ## # # # ####### # # # ####### # ###
|
|
|
|
# ## # # # # # # # # # # # ###
|
|
|
|
# # ##### ####### # # ## ## # # # ###
|
|
|
|
#
|
|
|
|
# Seriously. You shouldn't even be looking at this file unless you're
|
|
|
|
# debugging generate_mozbuild.py.
|
|
|
|
#
|
|
|
|
# DO NOT MODIFY THIS FILE IT IS AUTOGENERATED.
|
|
|
|
#
|
2016-10-25 05:40:40 +03:00
|
|
|
|
|
|
|
skia_opt_flags = []
|
|
|
|
|
|
|
|
if CONFIG['MOZ_OPTIMIZE']:
|
|
|
|
if CONFIG['_MSC_VER']:
|
|
|
|
skia_opt_flags += ['-O2']
|
|
|
|
elif CONFIG['GNU_CC']:
|
|
|
|
skia_opt_flags += ['-O3']
|
|
|
|
|
2014-02-20 02:10:33 +04:00
|
|
|
"""
|
|
|
|
|
2013-12-10 22:57:22 +04:00
|
|
|
footer = """
|
|
|
|
|
2015-12-18 21:53:25 +03:00
|
|
|
# We allow warnings for third-party code that can be updated from upstream.
|
2015-08-28 06:44:53 +03:00
|
|
|
ALLOW_COMPILER_WARNINGS = True
|
|
|
|
|
2014-03-06 00:18:09 +04:00
|
|
|
FINAL_LIBRARY = 'gkmedias'
|
2013-12-10 22:57:22 +04:00
|
|
|
LOCAL_INCLUDES += [
|
2015-12-18 21:53:25 +03:00
|
|
|
'skia/include/c',
|
2015-07-30 18:51:29 +03:00
|
|
|
'skia/include/config',
|
|
|
|
'skia/include/core',
|
|
|
|
'skia/include/effects',
|
|
|
|
'skia/include/gpu',
|
|
|
|
'skia/include/images',
|
|
|
|
'skia/include/pathops',
|
|
|
|
'skia/include/ports',
|
2015-12-18 21:53:25 +03:00
|
|
|
'skia/include/private',
|
2015-07-30 18:51:29 +03:00
|
|
|
'skia/include/utils',
|
|
|
|
'skia/include/utils/mac',
|
|
|
|
'skia/include/views',
|
|
|
|
'skia/src/core',
|
|
|
|
'skia/src/gpu',
|
|
|
|
'skia/src/gpu/effects',
|
|
|
|
'skia/src/gpu/gl',
|
|
|
|
'skia/src/image',
|
|
|
|
'skia/src/lazy',
|
|
|
|
'skia/src/opts',
|
|
|
|
'skia/src/sfnt',
|
|
|
|
'skia/src/utils',
|
|
|
|
'skia/src/utils/mac',
|
|
|
|
'skia/src/utils/win',
|
2013-12-10 22:57:22 +04:00
|
|
|
]
|
|
|
|
|
2016-10-25 15:59:42 +03:00
|
|
|
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'):
|
2014-03-08 02:11:57 +04:00
|
|
|
DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0
|
|
|
|
|
2015-02-05 23:10:28 +03:00
|
|
|
if CONFIG['MOZ_WIDGET_TOOLKIT'] in {
|
|
|
|
'android',
|
|
|
|
'cocoa',
|
2016-03-16 08:06:26 +03:00
|
|
|
'gtk2',
|
|
|
|
'gtk3',
|
2015-02-05 23:10:28 +03:00
|
|
|
'uikit',
|
2016-03-16 08:06:26 +03:00
|
|
|
}:
|
2013-12-10 22:57:22 +04:00
|
|
|
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
|
2014-03-06 00:18:09 +04:00
|
|
|
|
2016-01-05 13:08:56 +03:00
|
|
|
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
|
|
|
DEFINES['UNICODE'] = True
|
|
|
|
DEFINES['_UNICODE'] = True
|
2016-05-10 03:40:57 +03:00
|
|
|
UNIFIED_SOURCES += [
|
|
|
|
'skia/src/fonts/SkFontMgr_indirect.cpp',
|
|
|
|
'skia/src/fonts/SkRemotableFontMgr.cpp',
|
|
|
|
]
|
2016-01-05 13:08:56 +03:00
|
|
|
|
2014-11-13 15:09:48 +03:00
|
|
|
# We should autogenerate these SSE related flags.
|
|
|
|
|
|
|
|
if CONFIG['_MSC_VER']:
|
2014-07-28 04:56:09 +04:00
|
|
|
# MSVC doesn't need special compiler flags, but Skia needs to be told that these files should
|
|
|
|
# be built with the required SSE level or it will simply compile in stubs and cause runtime crashes
|
2016-10-25 05:40:40 +03:00
|
|
|
SOURCES['skia/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
|
|
|
|
SOURCES['skia/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
|
|
|
|
SOURCES['skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=31']
|
|
|
|
SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
|
|
|
|
SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=31']
|
|
|
|
SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=41']
|
|
|
|
SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=42']
|
|
|
|
SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=51']
|
|
|
|
if CONFIG['INTEL_ARCHITECTURE'] and (CONFIG['GNU_CC'] or CONFIG['CLANG_CL']):
|
2015-07-30 18:51:29 +03:00
|
|
|
SOURCES['skia/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
|
|
|
SOURCES['skia/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
|
|
|
SOURCES['skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
|
|
|
|
SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
2015-12-18 21:53:25 +03:00
|
|
|
SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-mssse3']
|
|
|
|
SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-msse4.1']
|
2016-10-25 05:40:40 +03:00
|
|
|
SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-msse4.2']
|
|
|
|
SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-mavx']
|
2014-03-08 02:27:10 +04:00
|
|
|
elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC'] and CONFIG['BUILD_ARM_NEON']:
|
2015-12-18 21:53:25 +03:00
|
|
|
DEFINES['SK_ARM_HAS_OPTIONAL_NEON'] = 1
|
2015-11-06 00:05:26 +03:00
|
|
|
|
2014-03-06 00:18:09 +04:00
|
|
|
DEFINES['SKIA_IMPLEMENTATION'] = 1
|
2014-04-01 10:27:31 +04:00
|
|
|
|
2017-01-08 01:20:25 +03:00
|
|
|
if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY'] and CONFIG['ENABLE_INTL_API']:
|
|
|
|
DEFINES['SK_PDF_USE_SFNTLY'] = 1
|
|
|
|
|
2015-12-30 20:17:32 +03:00
|
|
|
if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
|
|
|
|
DEFINES['SK_SUPPORT_GPU'] = 0
|
|
|
|
|
2016-07-20 22:06:29 +03:00
|
|
|
if CONFIG['MOZ_TREE_FREETYPE']:
|
|
|
|
DEFINES['SK_CAN_USE_DLOPEN'] = 0
|
|
|
|
|
2015-11-06 00:05:26 +03:00
|
|
|
# Suppress warnings in third-party code.
|
|
|
|
if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
|
2014-04-01 10:27:31 +04:00
|
|
|
CXXFLAGS += [
|
2015-10-17 08:24:19 +03:00
|
|
|
'-Wno-deprecated-declarations',
|
2014-04-01 10:27:31 +04:00
|
|
|
'-Wno-overloaded-virtual',
|
2016-05-11 10:00:01 +03:00
|
|
|
'-Wno-shadow',
|
2015-10-17 08:24:19 +03:00
|
|
|
'-Wno-sign-compare',
|
2016-10-06 19:40:54 +03:00
|
|
|
'-Wno-unreachable-code',
|
2014-04-01 10:27:31 +04:00
|
|
|
'-Wno-unused-function',
|
|
|
|
]
|
2015-11-06 00:05:26 +03:00
|
|
|
if CONFIG['GNU_CXX'] and not CONFIG['CLANG_CXX'] and not CONFIG['CLANG_CL']:
|
|
|
|
CXXFLAGS += [
|
|
|
|
'-Wno-logical-op',
|
|
|
|
'-Wno-maybe-uninitialized',
|
|
|
|
]
|
|
|
|
if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
|
|
|
|
CXXFLAGS += [
|
|
|
|
'-Wno-implicit-fallthrough',
|
|
|
|
'-Wno-inconsistent-missing-override',
|
|
|
|
'-Wno-macro-redefined',
|
|
|
|
'-Wno-unused-private-field',
|
|
|
|
]
|
2014-07-24 19:55:33 +04:00
|
|
|
|
2016-10-25 15:59:42 +03:00
|
|
|
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
|
2014-07-24 19:55:33 +04:00
|
|
|
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
|
|
|
|
CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
|
|
|
|
|
2016-07-13 03:27:57 +03:00
|
|
|
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
|
2014-07-24 19:55:33 +04:00
|
|
|
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
|
2017-01-08 01:20:25 +03:00
|
|
|
|
|
|
|
if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY']:
|
|
|
|
LOCAL_INCLUDES += CONFIG['SFNTLY_INCLUDES']
|
2013-12-10 22:57:22 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
platforms = ['linux', 'mac', 'android', 'win']
|
|
|
|
|
|
|
|
def generate_opt_sources():
|
|
|
|
opt_sources = {'opts': {''}}
|
2015-07-30 18:51:29 +03:00
|
|
|
for root, dirs, files in os.walk('skia/src/opts'):
|
2013-12-10 22:57:22 +04:00
|
|
|
for name in files:
|
|
|
|
if name.endswith('.cpp'):
|
|
|
|
opt_sources['opts'].add(os.path.join(root, name))
|
|
|
|
|
|
|
|
return opt_sources
|
|
|
|
|
|
|
|
def generate_platform_sources():
|
|
|
|
sources = {}
|
|
|
|
|
|
|
|
for plat in platforms:
|
2015-12-18 21:53:25 +03:00
|
|
|
if os.system("cd skia && GYP_GENERATORS=dump_mozbuild ./gyp_skia -D OS=%s -D host_os=linux gyp/skia_lib.gyp" % plat) != 0:
|
2013-12-10 22:57:22 +04:00
|
|
|
print 'Failed to generate sources for ' + plat
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
2015-07-30 18:51:29 +03:00
|
|
|
f = open('skia/sources.json');
|
|
|
|
sources[plat] = set(v.replace('../', 'skia/') for v in json.load(f));
|
2013-12-10 22:57:22 +04:00
|
|
|
f.close()
|
|
|
|
|
|
|
|
return dict(sources.items() + generate_opt_sources().items())
|
|
|
|
|
|
|
|
|
|
|
|
def generate_separated_sources(platform_sources):
|
|
|
|
blacklist = [
|
2016-04-29 05:55:26 +03:00
|
|
|
'experimental',
|
2013-12-10 22:57:22 +04:00
|
|
|
'SkXML',
|
|
|
|
'GrGLCreateNativeInterface',
|
2016-05-10 03:40:57 +03:00
|
|
|
'GrGLCreateNullInterface',
|
|
|
|
'GrGLAssembleInterface',
|
|
|
|
'GrGLTestInterface',
|
2013-12-10 22:57:22 +04:00
|
|
|
'fontconfig',
|
2016-10-25 05:40:40 +03:00
|
|
|
'FontConfig',
|
2014-02-20 18:35:58 +04:00
|
|
|
'SkThreadUtils_pthread_',
|
2014-07-28 04:56:09 +04:00
|
|
|
'SkFontMgr_android',
|
2015-12-18 21:53:25 +03:00
|
|
|
'SkFontMgr_custom',
|
|
|
|
'SkFontHost_FreeType.cpp',
|
2016-04-29 05:55:26 +03:00
|
|
|
'Movie',
|
|
|
|
'ImageEncoder',
|
2016-05-10 03:40:57 +03:00
|
|
|
'skia/src/c/',
|
|
|
|
'skia/src/effects/Gr',
|
|
|
|
'skia/src/effects/Sk',
|
|
|
|
'skia/src/fonts/',
|
|
|
|
'skia/src/images/',
|
2016-04-29 05:55:26 +03:00
|
|
|
'skia/src/ports/SkImageGenerator',
|
2016-10-25 05:40:40 +03:00
|
|
|
'skia/src/sksl/',
|
|
|
|
'skia/src/gpu/vk/',
|
2015-12-18 21:53:25 +03:00
|
|
|
'SkBitmapRegion',
|
2016-10-25 05:40:40 +03:00
|
|
|
'SkLight',
|
|
|
|
'SkRadialShadow',
|
|
|
|
'SkShadow',
|
|
|
|
'SkNormal',
|
|
|
|
'SkLite',
|
2015-12-18 21:53:25 +03:00
|
|
|
'codec',
|
2013-12-10 22:57:22 +04:00
|
|
|
'SkWGL',
|
2014-07-28 04:56:09 +04:00
|
|
|
'SkMemory_malloc',
|
2015-12-18 21:53:25 +03:00
|
|
|
'SkOpts_',
|
2014-07-28 04:56:09 +04:00
|
|
|
'opts_check_x86',
|
|
|
|
'third_party',
|
2016-05-10 03:40:57 +03:00
|
|
|
# unused in skia/src/utils
|
|
|
|
'SkBoundaryPatch',
|
|
|
|
'SkCamera',
|
|
|
|
'SkCanvasStack',
|
|
|
|
'SkCanvasStateUtils',
|
2016-10-25 05:40:40 +03:00
|
|
|
'SkCurveMeasure',
|
|
|
|
'SkDeferredCanvas',
|
2016-05-10 03:40:57 +03:00
|
|
|
'SkDumpCanvas',
|
|
|
|
'SkFrontBufferedStream',
|
|
|
|
'SkInterpolator',
|
|
|
|
'SkLayer',
|
|
|
|
'SkMeshUtils',
|
|
|
|
'SkMD5',
|
2016-10-25 05:40:40 +03:00
|
|
|
'SkMultiPictureDocument',
|
2016-05-10 03:40:57 +03:00
|
|
|
'SkNinePatch',
|
|
|
|
'SkNullCanvas',
|
|
|
|
'SkNWayCanvas',
|
|
|
|
'SkPaintFilterCanvas',
|
|
|
|
'SkParseColor',
|
|
|
|
'SkPatchGrid',
|
|
|
|
'SkRTConf',
|
|
|
|
'SkTextBox',
|
|
|
|
'SkWhitelistTypefaces',
|
2013-12-10 22:57:22 +04:00
|
|
|
]
|
|
|
|
|
|
|
|
def isblacklisted(value):
|
|
|
|
for item in blacklist:
|
|
|
|
if value.find(item) >= 0:
|
|
|
|
return True
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
2015-02-26 08:14:02 +03:00
|
|
|
separated = defaultdict(set, {
|
2013-12-10 22:57:22 +04:00
|
|
|
'common': {
|
2016-10-25 05:40:40 +03:00
|
|
|
'skia/src/core/SkBlurImageFilter.cpp',
|
|
|
|
'skia/src/core/SkGpuBlurUtils.cpp',
|
2016-05-10 03:40:57 +03:00
|
|
|
'skia/src/effects/SkDashPathEffect.cpp',
|
|
|
|
'skia/src/effects/SkImageSource.cpp',
|
|
|
|
'skia/src/effects/SkLayerRasterizer.cpp',
|
2015-07-30 18:51:29 +03:00
|
|
|
'skia/src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
|
|
|
|
'skia/src/ports/SkDiscardableMemory_none.cpp',
|
|
|
|
'skia/src/ports/SkMemory_mozalloc.cpp',
|
2016-04-29 05:55:26 +03:00
|
|
|
'skia/src/ports/SkImageEncoder_none.cpp',
|
|
|
|
'skia/src/ports/SkImageGenerator_none.cpp',
|
2013-12-10 22:57:22 +04:00
|
|
|
},
|
|
|
|
'android': {
|
2015-07-30 18:51:29 +03:00
|
|
|
# 'skia/src/ports/SkDebug_android.cpp',
|
|
|
|
'skia/src/ports/SkFontHost_cairo.cpp',
|
|
|
|
# 'skia/src/ports/SkFontHost_FreeType.cpp',
|
|
|
|
# 'skia/src/ports/SkFontHost_FreeType_common.cpp',
|
|
|
|
# 'skia/src/ports/SkTime_Unix.cpp',
|
|
|
|
# 'skia/src/utils/SkThreadUtils_pthread.cpp',
|
2013-12-10 22:57:22 +04:00
|
|
|
},
|
|
|
|
'linux': {
|
2015-07-30 18:51:29 +03:00
|
|
|
'skia/src/ports/SkFontHost_cairo.cpp',
|
2013-12-10 22:57:22 +04:00
|
|
|
},
|
|
|
|
'intel': {
|
2014-07-28 04:56:09 +04:00
|
|
|
# There is currently no x86-specific opt for SkTextureCompression
|
2015-07-30 18:51:29 +03:00
|
|
|
'skia/src/opts/opts_check_x86.cpp',
|
2015-12-18 21:53:25 +03:00
|
|
|
'skia/src/opts/SkOpts_ssse3.cpp',
|
|
|
|
'skia/src/opts/SkOpts_sse41.cpp',
|
2016-10-25 05:40:40 +03:00
|
|
|
'skia/src/opts/SkOpts_sse42.cpp',
|
|
|
|
'skia/src/opts/SkOpts_avx.cpp',
|
|
|
|
'skia/src/opts/SkOpts_hsw.cpp',
|
2013-12-10 22:57:22 +04:00
|
|
|
},
|
|
|
|
'arm': {
|
2015-07-30 18:51:29 +03:00
|
|
|
'skia/src/core/SkUtilsArm.cpp',
|
2014-03-08 02:27:10 +04:00
|
|
|
},
|
|
|
|
'neon': {
|
2015-12-18 21:53:25 +03:00
|
|
|
'skia/src/opts/SkOpts_neon.cpp',
|
2013-12-10 22:57:22 +04:00
|
|
|
},
|
2015-12-30 20:17:32 +03:00
|
|
|
'none': set(),
|
2016-10-26 21:23:07 +03:00
|
|
|
'pdf': set(),
|
2015-12-30 20:17:32 +03:00
|
|
|
'gpu': set()
|
2015-02-26 08:14:02 +03:00
|
|
|
})
|
2013-12-10 22:57:22 +04:00
|
|
|
|
|
|
|
for plat in platform_sources.keys():
|
|
|
|
for value in platform_sources[plat]:
|
|
|
|
if isblacklisted(value):
|
|
|
|
continue
|
|
|
|
|
2015-02-26 08:14:02 +03:00
|
|
|
if value in separated['common']:
|
2013-12-10 22:57:22 +04:00
|
|
|
continue
|
|
|
|
|
2015-02-26 08:14:02 +03:00
|
|
|
key = plat
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2015-02-26 08:14:02 +03:00
|
|
|
if '_SSE' in value or '_SSSE' in value:
|
|
|
|
key = 'intel'
|
|
|
|
elif '_neon' in value:
|
|
|
|
key = 'neon'
|
|
|
|
elif '_arm' in value:
|
|
|
|
key = 'arm'
|
|
|
|
elif '_none' in value:
|
|
|
|
key = 'none'
|
2015-12-30 20:17:32 +03:00
|
|
|
elif 'gpu' in value or 'Gpu' in value:
|
|
|
|
key = 'gpu'
|
2015-02-26 08:14:02 +03:00
|
|
|
elif all(value in platform_sources.get(p, {})
|
|
|
|
for p in platforms if p != plat):
|
|
|
|
key = 'common'
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2015-02-26 08:14:02 +03:00
|
|
|
separated[key].add(value)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2016-10-26 21:23:07 +03:00
|
|
|
if os.system("cd skia && GYP_GENERATORS=dump_mozbuild ./gyp_skia -D OS=linux -D host_os=linux -R pdf gyp/pdf.gyp") != 0:
|
|
|
|
print 'Failed to generate sources for Skia PDF'
|
|
|
|
else:
|
|
|
|
f = open('skia/sources.json');
|
|
|
|
separated['pdf'].add('skia/src/core/SkMD5.cpp');
|
|
|
|
separated['pdf'].update(filter(lambda x: 'pdf' in x, set(v.replace('../', 'skia/') for v in json.load(f))));
|
|
|
|
f.close()
|
|
|
|
|
2013-12-10 22:57:22 +04:00
|
|
|
return separated
|
|
|
|
|
|
|
|
def uniq(seq):
|
|
|
|
seen = set()
|
|
|
|
seen_add = seen.add
|
|
|
|
return [ x for x in seq if x not in seen and not seen_add(x)]
|
|
|
|
|
2014-03-08 02:27:10 +04:00
|
|
|
def write_cflags(f, values, subsearch, cflag, indent):
|
|
|
|
def write_indent(indent):
|
|
|
|
for _ in range(indent):
|
|
|
|
f.write(' ')
|
|
|
|
|
2016-10-25 05:40:40 +03:00
|
|
|
if isinstance(subsearch, str):
|
|
|
|
subsearch = [ subsearch ]
|
|
|
|
|
|
|
|
def iswhitelisted(value):
|
|
|
|
for item in subsearch:
|
|
|
|
if value.find(item) >= 0:
|
|
|
|
return True
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
2015-02-26 08:14:02 +03:00
|
|
|
val_list = uniq(sorted(values, key=lambda x: x.lower()))
|
2014-03-08 02:27:10 +04:00
|
|
|
|
|
|
|
if len(val_list) == 0:
|
|
|
|
return
|
|
|
|
|
|
|
|
for val in val_list:
|
2016-10-25 05:40:40 +03:00
|
|
|
if iswhitelisted(val):
|
2014-03-08 02:27:10 +04:00
|
|
|
write_indent(indent)
|
2016-09-14 12:34:19 +03:00
|
|
|
f.write("SOURCES[\'" + val + "\'].flags += " + cflag + "\n")
|
2014-03-08 02:27:10 +04:00
|
|
|
|
2016-10-25 05:40:40 +03:00
|
|
|
opt_whitelist = [
|
|
|
|
'skia/src/opts/Sk',
|
|
|
|
'SkOpts',
|
|
|
|
'SkBitmapProcState',
|
|
|
|
'SkBlitMask',
|
|
|
|
'SkBlitRow',
|
|
|
|
'SkBlitter',
|
|
|
|
'SkSpriteBlitter',
|
|
|
|
'SkMatrix.cpp',
|
|
|
|
]
|
2014-03-12 09:06:29 +04:00
|
|
|
|
2016-10-25 05:40:40 +03:00
|
|
|
# Unfortunately for now the gpu and pathops directories are
|
|
|
|
# non-unifiable. Keep track of this and fix it.
|
|
|
|
unified_blacklist = [
|
|
|
|
'FontHost',
|
|
|
|
'SkAdvancedTypefaceMetrics',
|
|
|
|
'SkBitmapProcState_matrixProcs.cpp',
|
|
|
|
'SkBlitter_A8.cpp',
|
|
|
|
'SkBlitter_ARGB32.cpp',
|
|
|
|
'SkBlitter_RGB16.cpp',
|
|
|
|
'SkBlitter_Sprite.cpp',
|
|
|
|
'SkScan_Antihair.cpp',
|
|
|
|
'SkParse.cpp',
|
2016-10-26 21:23:07 +03:00
|
|
|
'SkPDFFont.cpp',
|
2016-10-25 05:40:40 +03:00
|
|
|
'SkPictureData.cpp',
|
|
|
|
'GrDrawContext',
|
|
|
|
'GrResourceCache',
|
|
|
|
'GrAA',
|
|
|
|
'GrGL',
|
|
|
|
'GrBatchAtlas.cpp',
|
|
|
|
'GrMSAAPathRenderer.cpp',
|
|
|
|
'GrNonAAFillRect',
|
|
|
|
'SkColorSpace',
|
|
|
|
'SkImage_Gpu.cpp',
|
|
|
|
'SkPathOpsDebug.cpp',
|
|
|
|
'SkParsePath.cpp',
|
|
|
|
'SkRecorder.cpp',
|
|
|
|
'SkMiniRecorder.cpp',
|
|
|
|
'SkXfermode',
|
|
|
|
'SkMatrix44.cpp',
|
|
|
|
] + opt_whitelist
|
2014-03-08 02:27:10 +04:00
|
|
|
|
2016-10-25 05:40:40 +03:00
|
|
|
def write_sources(f, values, indent):
|
2014-03-12 09:06:29 +04:00
|
|
|
def isblacklisted(value):
|
|
|
|
for item in unified_blacklist:
|
|
|
|
if value.find(item) >= 0:
|
|
|
|
return True
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
sources = {}
|
|
|
|
sources['nonunified'] = set()
|
|
|
|
sources['unified'] = set()
|
|
|
|
|
|
|
|
for item in values:
|
|
|
|
if isblacklisted(item):
|
|
|
|
sources['nonunified'].add(item)
|
|
|
|
else:
|
|
|
|
sources['unified'].add(item)
|
|
|
|
|
|
|
|
write_list(f, "UNIFIED_SOURCES", sources['unified'], indent)
|
|
|
|
write_list(f, "SOURCES", sources['nonunified'], indent)
|
|
|
|
|
2013-12-10 22:57:22 +04:00
|
|
|
def write_list(f, name, values, indent):
|
|
|
|
def write_indent(indent):
|
|
|
|
for _ in range(indent):
|
|
|
|
f.write(' ')
|
|
|
|
|
2015-02-26 08:14:02 +03:00
|
|
|
val_list = uniq(sorted(values, key=lambda x: x.lower()))
|
2013-12-10 22:57:22 +04:00
|
|
|
|
|
|
|
if len(val_list) == 0:
|
|
|
|
return
|
|
|
|
|
|
|
|
write_indent(indent)
|
|
|
|
f.write(name + ' += [\n')
|
|
|
|
for val in val_list:
|
|
|
|
write_indent(indent + 4)
|
|
|
|
f.write('\'' + val + '\',\n')
|
|
|
|
|
2014-03-08 02:27:10 +04:00
|
|
|
write_indent(indent)
|
2013-12-10 22:57:22 +04:00
|
|
|
f.write(']\n')
|
|
|
|
|
2015-07-30 19:05:22 +03:00
|
|
|
def write_mozbuild(sources):
|
2013-12-10 22:57:22 +04:00
|
|
|
filename = 'moz.build'
|
|
|
|
f = open(filename, 'w')
|
|
|
|
|
2014-02-20 02:10:33 +04:00
|
|
|
f.write(header)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2014-03-12 09:06:29 +04:00
|
|
|
write_sources(f, sources['common'], 0)
|
2016-10-25 05:40:40 +03:00
|
|
|
write_cflags(f, sources['common'], opt_whitelist, 'skia_opt_flags', 0)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2016-10-26 21:23:07 +03:00
|
|
|
f.write("if CONFIG['MOZ_ENABLE_SKIA_PDF']:\n")
|
|
|
|
write_sources(f, sources['pdf'], 4)
|
|
|
|
|
2015-12-30 20:17:32 +03:00
|
|
|
f.write("if CONFIG['MOZ_ENABLE_SKIA_GPU']:\n")
|
|
|
|
write_sources(f, sources['gpu'], 4)
|
|
|
|
|
2016-10-25 15:59:42 +03:00
|
|
|
f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'):\n")
|
2014-03-12 09:06:29 +04:00
|
|
|
write_sources(f, sources['android'], 4)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2015-02-05 23:10:28 +03:00
|
|
|
f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in {'cocoa', 'uikit'}:\n")
|
2014-03-12 09:06:29 +04:00
|
|
|
write_sources(f, sources['mac'], 4)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2016-03-16 08:06:26 +03:00
|
|
|
f.write("if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:\n")
|
2014-03-12 09:06:29 +04:00
|
|
|
write_sources(f, sources['linux'], 4)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
|
|
|
f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':\n")
|
2014-07-28 04:56:09 +04:00
|
|
|
# Windows-specific files don't get unification because of nasty headers.
|
|
|
|
# Luckily there are not many files in this.
|
|
|
|
write_list(f, "SOURCES", sources['win'], 4)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
|
|
|
f.write("if CONFIG['INTEL_ARCHITECTURE']:\n")
|
2014-03-12 09:06:29 +04:00
|
|
|
write_sources(f, sources['intel'], 4)
|
2016-10-25 05:40:40 +03:00
|
|
|
write_cflags(f, sources['intel'], opt_whitelist, 'skia_opt_flags', 4)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2016-08-23 10:54:06 +03:00
|
|
|
f.write("elif CONFIG['CPU_ARCH'] in ('arm', 'aarch64') and CONFIG['GNU_CC']:\n")
|
2014-03-12 09:06:29 +04:00
|
|
|
write_sources(f, sources['arm'], 4)
|
2016-10-25 05:40:40 +03:00
|
|
|
write_cflags(f, sources['arm'], opt_whitelist, 'skia_opt_flags', 4)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
2016-08-23 10:54:06 +03:00
|
|
|
f.write(" if CONFIG['CPU_ARCH'] == 'aarch64':\n")
|
|
|
|
write_sources(f, sources['neon'], 8)
|
|
|
|
f.write(" elif CONFIG['BUILD_ARM_NEON']:\n")
|
2014-03-08 02:27:10 +04:00
|
|
|
write_list(f, 'SOURCES', sources['neon'], 8)
|
2016-09-14 12:34:19 +03:00
|
|
|
write_cflags(f, sources['neon'], 'neon', "CONFIG['NEON_FLAGS']", 8)
|
2014-03-08 02:27:10 +04:00
|
|
|
|
2016-10-25 05:40:40 +03:00
|
|
|
f.write(" if CONFIG['CPU_ARCH'] == 'aarch64' or CONFIG['BUILD_ARM_NEON']:\n")
|
|
|
|
write_cflags(f, sources['neon'], opt_whitelist, 'skia_opt_flags', 8)
|
|
|
|
|
2013-12-10 22:57:22 +04:00
|
|
|
f.write("else:\n")
|
2014-03-12 09:06:29 +04:00
|
|
|
write_sources(f, sources['none'], 4)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
|
|
|
f.write(footer)
|
|
|
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
print 'Wrote ' + filename
|
|
|
|
|
|
|
|
def main():
|
|
|
|
platform_sources = generate_platform_sources()
|
|
|
|
separated_sources = generate_separated_sources(platform_sources)
|
2015-07-30 19:05:22 +03:00
|
|
|
write_mozbuild(separated_sources)
|
2013-12-10 22:57:22 +04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|