1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2# vim: set filetype=python:
3# This Source Code Form is subject to the terms of the Mozilla Public
4# License, v. 2.0. If a copy of the MPL was not distributed with this
5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7with Files("*Text*"):
8    BUG_COMPONENT = ("Core", "Graphics: Text")
9
10with Files("*DWrite*"):
11    BUG_COMPONENT = ("Core", "Graphics: Text")
12
13XPIDL_SOURCES += [
14    "nsIFontLoadCompleteCallback.idl",
15]
16
17XPIDL_MODULE = "gfx"
18
19EXPORTS += [
20    "DrawMode.h",
21    "gfx2DGlue.h",
22    "gfxAlphaRecovery.h",
23    "gfxASurface.h",
24    "gfxBaseSharedMemorySurface.h",
25    "gfxBlur.h",
26    "gfxColor.h",
27    "gfxContext.h",
28    "gfxDrawable.h",
29    "gfxEnv.h",
30    "gfxFailure.h",
31    "gfxFont.h",
32    "gfxFontConstants.h",
33    "gfxFontEntry.h",
34    "gfxFontFeatures.h",
35    "gfxFontInfoLoader.h",
36    "gfxFontPrefLangList.h",
37    "gfxFontSrcPrincipal.h",
38    "gfxFontSrcURI.h",
39    "gfxFontUtils.h",
40    "gfxFontVariations.h",
41    "gfxGradientCache.h",
42    "gfxImageSurface.h",
43    "gfxLineSegment.h",
44    "gfxMathTable.h",
45    "gfxMatrix.h",
46    "gfxOTSUtils.h",
47    "gfxPattern.h",
48    "gfxPlatform.h",
49    "gfxPlatformFontList.h",
50    "gfxPoint.h",
51    "gfxQuad.h",
52    "gfxQuaternion.h",
53    "gfxRect.h",
54    "gfxSharedImageSurface.h",
55    "gfxSkipChars.h",
56    "gfxSVGGlyphs.h",
57    "gfxTextRun.h",
58    "gfxTypes.h",
59    "gfxUserFontSet.h",
60    "gfxUtils.h",
61    "SharedFontList.h",
62    "SoftwareVsyncSource.h",
63    "ThebesRLBoxTypes.h",
64    "VsyncSource.h",
65]
66
67EXPORTS.mozilla.gfx += [
68    "D3D11Checks.h",
69    "DeviceManagerDx.h",
70    "DisplayConfigWindows.h",
71    "PrintTarget.h",
72    "PrintTargetThebes.h",
73    "ThebesRLBox.h",
74]
75
76if CONFIG["MOZ_ENABLE_SKIA"]:
77    EXPORTS.mozilla.gfx += ["SkMemoryReporter.h"]
78
79if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
80    EXPORTS += [
81        "gfxAndroidPlatform.h",
82        "gfxFT2FontBase.h",
83        "gfxFT2Fonts.h",
84    ]
85    EXPORTS.mozilla.gfx += [
86        "PrintTargetPDF.h",
87    ]
88    SOURCES += [
89        "gfxAndroidPlatform.cpp",
90        "gfxFT2FontBase.cpp",
91        "gfxFT2FontList.cpp",
92        "gfxFT2Fonts.cpp",
93        "gfxFT2Utils.cpp",
94        "PrintTargetPDF.cpp",
95    ]
96elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
97    EXPORTS += [
98        "gfxPlatformMac.h",
99        "gfxQuartzNativeDrawing.h",
100        "gfxQuartzSurface.h",
101    ]
102    EXPORTS.mozilla.gfx += [
103        "PrintTargetCG.h",
104    ]
105    SOURCES += [
106        "gfxCoreTextShaper.cpp",
107        "gfxMacFont.cpp",
108        "gfxPlatformMac.cpp",
109        "gfxQuartzNativeDrawing.cpp",
110        "gfxQuartzSurface.cpp",
111        "PrintTargetCG.mm",
112    ]
113elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
114    EXPORTS += [
115        "gfxFT2FontBase.h",
116        "gfxGdkNativeRenderer.h",
117        "gfxPlatformGtk.h",
118    ]
119    EXPORTS.mozilla.gfx += [
120        "PrintTargetPDF.h",
121        "PrintTargetPS.h",
122    ]
123    SOURCES += [
124        "gfxFcPlatformFontList.cpp",
125        "gfxFT2FontBase.cpp",
126        "gfxFT2Utils.cpp",
127        "gfxGdkNativeRenderer.cpp",
128        "gfxPlatformGtk.cpp",
129        "PrintTargetPDF.cpp",
130        "PrintTargetPS.cpp",
131    ]
132
133    if CONFIG["MOZ_X11"]:
134        EXPORTS += [
135            "gfxXlibNativeRenderer.h",
136            "gfxXlibSurface.h",
137        ]
138        EXPORTS.mozilla.gfx += [
139            "XlibDisplay.h",
140        ]
141        SOURCES += [
142            "gfxXlibNativeRenderer.cpp",
143            "gfxXlibSurface.cpp",
144            "XlibDisplay.cpp",
145        ]
146
147elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
148    EXPORTS += [
149        "gfxDWriteFonts.h",
150        "gfxGDIFont.h",
151        "gfxGDIFontList.h",
152        "gfxWindowsNativeDrawing.h",
153        "gfxWindowsPlatform.h",
154        "gfxWindowsSurface.h",
155    ]
156    EXPORTS.mozilla.gfx += [
157        "PrintTargetPDF.h",
158        "PrintTargetWindows.h",
159    ]
160    SOURCES += [
161        "DisplayConfigWindows.cpp",
162        "gfxDWriteCommon.cpp",
163        "gfxDWriteFonts.cpp",
164        "gfxGDIFont.cpp",
165        "gfxGDIFontList.cpp",
166        "gfxWindowsNativeDrawing.cpp",
167        "gfxWindowsPlatform.cpp",
168        "gfxWindowsSurface.cpp",
169        "PrintTargetPDF.cpp",
170        "PrintTargetWindows.cpp",
171    ]
172    UNIFIED_SOURCES += [
173        "gfxDWriteFontList.cpp",
174    ]
175
176# Are we targeting x86 or x64?  If so, build gfxAlphaRecoverySSE2.cpp.
177if CONFIG["INTEL_ARCHITECTURE"]:
178    SOURCES += ["gfxAlphaRecoverySSE2.cpp"]
179    # The file uses SSE2 intrinsics, so it needs special compile flags on some
180    # compilers.
181    SOURCES["gfxAlphaRecoverySSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
182
183SOURCES += [
184    # Includes mac system header conflicting with point/size,
185    # and includes glxXlibSurface.h which drags in Xrender.h
186    "gfxASurface.cpp",
187    # on X11, gfxDrawable.cpp includes X headers for an old workaround which
188    # we could consider removing soon (affects Ubuntus older than 10.04 LTS)
189    # which currently prevent it from joining UNIFIED_SOURCES.
190    "gfxDrawable.cpp",
191    # gfxFontUtils.cpp and gfxPlatform.cpp include mac system header conflicting with point/size
192    "gfxFontUtils.cpp",
193    "gfxPlatform.cpp",
194    "PrintTarget.cpp",
195    "PrintTargetThebes.cpp",
196]
197
198UNIFIED_SOURCES += [
199    "CJKCompatSVS.cpp",
200    "gfxAlphaRecovery.cpp",
201    "gfxBaseSharedMemorySurface.cpp",
202    "gfxBlur.cpp",
203    "gfxContext.cpp",
204    "gfxFont.cpp",
205    "gfxFontEntry.cpp",
206    "gfxFontFeatures.cpp",
207    "gfxFontInfoLoader.cpp",
208    "gfxFontMissingGlyphs.cpp",
209    "gfxFontSrcPrincipal.cpp",
210    "gfxFontSrcURI.cpp",
211    "gfxGlyphExtents.cpp",
212    "gfxGradientCache.cpp",
213    "gfxGraphiteShaper.cpp",
214    "gfxHarfBuzzShaper.cpp",
215    "gfxImageSurface.cpp",
216    "gfxMathTable.cpp",
217    "gfxPattern.cpp",
218    "gfxPlatformFontList.cpp",
219    "gfxScriptItemizer.cpp",
220    "gfxSkipChars.cpp",
221    "gfxSVGGlyphs.cpp",
222    "gfxTextRun.cpp",
223    "gfxUserFontSet.cpp",
224    "gfxUtils.cpp",
225    "SharedFontList.cpp",
226    "SoftwareVsyncSource.cpp",
227    "VsyncSource.cpp",
228]
229
230if CONFIG["MOZ_ENABLE_SKIA"]:
231    UNIFIED_SOURCES += [
232        "SkMemoryReporter.cpp",
233    ]
234
235if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
236    UNIFIED_SOURCES += [
237        "gfxMacPlatformFontList.mm",
238    ]
239elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
240    UNIFIED_SOURCES += [
241        "D3D11Checks.cpp",
242    ]
243    SOURCES += [
244        "DeviceManagerDx.cpp",
245    ]
246
247if CONFIG["MOZ_ENABLE_SKIA_PDF"]:
248    EXPORTS.mozilla.gfx += [
249        "PrintTargetSkPDF.h",
250    ]
251    SOURCES += [
252        "PrintTargetSkPDF.cpp",
253    ]
254
255# We use ICU for normalization functions:
256USE_LIBS += [
257    "icu",
258]
259
260include("/ipc/chromium/chromium-config.mozbuild")
261
262FINAL_LIBRARY = "xul"
263
264LOCAL_INCLUDES += [
265    "/dom/base",
266    "/dom/media/platforms/apple",
267    "/dom/xml",
268]
269
270if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("android", "gtk"):
271    DEFINES["MOZ_ENABLE_FREETYPE"] = True
272
273if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
274    for var in ("MOZ_ENABLE_D3D10_LAYER",):
275        if CONFIG[var]:
276            DEFINES[var] = True
277
278CXXFLAGS += CONFIG["MOZ_CAIRO_CFLAGS"]
279CXXFLAGS += CONFIG["TK_CFLAGS"]
280CFLAGS += CONFIG["MOZ_CAIRO_CFLAGS"]
281CFLAGS += CONFIG["TK_CFLAGS"]
282
283if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("android"):
284    CXXFLAGS += CONFIG["CAIRO_FT_CFLAGS"]
285
286if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
287    CXXFLAGS += CONFIG["MOZ_PANGO_CFLAGS"]
288
289if CONFIG["MOZ_WAYLAND"]:
290    CXXFLAGS += CONFIG["MOZ_WAYLAND_CFLAGS"]
291
292LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
293
294if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
295    CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"]
296else:
297    DEFINES["GRAPHITE2_STATIC"] = True
298
299if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
300    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
301
302if CONFIG["CC_TYPE"] == "clang":
303    # Suppress warnings from Skia header files.
304    SOURCES["gfxPlatform.cpp"].flags += ["-Wno-implicit-fallthrough"]
305
306CXXFLAGS += ["-Werror=switch"]
307