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
76EXPORTS.mozilla.gfx += ["SkMemoryReporter.h"]
77
78if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
79    EXPORTS += [
80        "gfxAndroidPlatform.h",
81        "gfxFT2FontBase.h",
82        "gfxFT2Fonts.h",
83    ]
84    EXPORTS.mozilla.gfx += [
85        "PrintTargetPDF.h",
86    ]
87    SOURCES += [
88        "gfxAndroidPlatform.cpp",
89        "gfxFT2FontBase.cpp",
90        "gfxFT2FontList.cpp",
91        "gfxFT2Fonts.cpp",
92        "gfxFT2Utils.cpp",
93        "PrintTargetPDF.cpp",
94    ]
95elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
96    EXPORTS += [
97        "gfxPlatformMac.h",
98        "gfxQuartzNativeDrawing.h",
99        "gfxQuartzSurface.h",
100    ]
101    EXPORTS.mozilla.gfx += [
102        "PrintTargetCG.h",
103    ]
104    SOURCES += [
105        "gfxCoreTextShaper.cpp",
106        "gfxMacFont.cpp",
107        "gfxPlatformMac.cpp",
108        "gfxQuartzNativeDrawing.cpp",
109        "gfxQuartzSurface.cpp",
110        "PrintTargetCG.mm",
111    ]
112elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
113    EXPORTS += [
114        "gfxFT2FontBase.h",
115        "gfxPlatformGtk.h",
116    ]
117    EXPORTS.mozilla.gfx += [
118        "PrintTargetPDF.h",
119    ]
120    SOURCES += [
121        "gfxFcPlatformFontList.cpp",
122        "gfxFT2FontBase.cpp",
123        "gfxFT2Utils.cpp",
124        "gfxPlatformGtk.cpp",
125        "PrintTargetPDF.cpp",
126    ]
127
128    if CONFIG["MOZ_X11"]:
129        EXPORTS += [
130            "gfxXlibSurface.h",
131        ]
132        EXPORTS.mozilla.gfx += [
133            "XlibDisplay.h",
134        ]
135        SOURCES += [
136            "gfxXlibSurface.cpp",
137            "XlibDisplay.cpp",
138        ]
139
140elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
141    REQUIRES_UNIFIED_BUILD = True
142    EXPORTS += [
143        "gfxDWriteFonts.h",
144        "gfxGDIFont.h",
145        "gfxGDIFontList.h",
146        "gfxWindowsNativeDrawing.h",
147        "gfxWindowsPlatform.h",
148        "gfxWindowsSurface.h",
149    ]
150    EXPORTS.mozilla.gfx += [
151        "PrintTargetPDF.h",
152        "PrintTargetWindows.h",
153    ]
154    SOURCES += [
155        "DisplayConfigWindows.cpp",
156        "gfxDWriteCommon.cpp",
157        "gfxDWriteFonts.cpp",
158        "gfxGDIFont.cpp",
159        "gfxGDIFontList.cpp",
160        "gfxWindowsNativeDrawing.cpp",
161        "gfxWindowsPlatform.cpp",
162        "gfxWindowsSurface.cpp",
163        "PrintTargetPDF.cpp",
164        "PrintTargetWindows.cpp",
165    ]
166    UNIFIED_SOURCES += [
167        "gfxDWriteFontList.cpp",
168    ]
169
170# Are we targeting x86 or x64?  If so, build gfxAlphaRecoverySSE2.cpp.
171if CONFIG["INTEL_ARCHITECTURE"]:
172    SOURCES += ["gfxAlphaRecoverySSE2.cpp"]
173    # The file uses SSE2 intrinsics, so it needs special compile flags on some
174    # compilers.
175    SOURCES["gfxAlphaRecoverySSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
176
177SOURCES += [
178    # Includes mac system header conflicting with point/size,
179    # and includes glxXlibSurface.h which drags in Xrender.h
180    "gfxASurface.cpp",
181    # on X11, gfxDrawable.cpp includes X headers for an old workaround which
182    # we could consider removing soon (affects Ubuntus older than 10.04 LTS)
183    # which currently prevent it from joining UNIFIED_SOURCES.
184    "gfxDrawable.cpp",
185    # gfxFontUtils.cpp and gfxPlatform.cpp include mac system header conflicting with point/size
186    "gfxFontUtils.cpp",
187    "gfxPlatform.cpp",
188    "PrintTarget.cpp",
189    "PrintTargetThebes.cpp",
190]
191
192UNIFIED_SOURCES += [
193    "CJKCompatSVS.cpp",
194    "gfxAlphaRecovery.cpp",
195    "gfxBaseSharedMemorySurface.cpp",
196    "gfxBlur.cpp",
197    "gfxContext.cpp",
198    "gfxFont.cpp",
199    "gfxFontEntry.cpp",
200    "gfxFontFeatures.cpp",
201    "gfxFontInfoLoader.cpp",
202    "gfxFontMissingGlyphs.cpp",
203    "gfxFontSrcPrincipal.cpp",
204    "gfxFontSrcURI.cpp",
205    "gfxGlyphExtents.cpp",
206    "gfxGradientCache.cpp",
207    "gfxGraphiteShaper.cpp",
208    "gfxHarfBuzzShaper.cpp",
209    "gfxImageSurface.cpp",
210    "gfxMathTable.cpp",
211    "gfxPattern.cpp",
212    "gfxPlatformFontList.cpp",
213    "gfxScriptItemizer.cpp",
214    "gfxSkipChars.cpp",
215    "gfxSVGGlyphs.cpp",
216    "gfxTextRun.cpp",
217    "gfxUserFontSet.cpp",
218    "gfxUtils.cpp",
219    "SharedFontList.cpp",
220    "SoftwareVsyncSource.cpp",
221    "VsyncSource.cpp",
222]
223
224UNIFIED_SOURCES += [
225    "SkMemoryReporter.cpp",
226]
227
228if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
229    UNIFIED_SOURCES += [
230        "gfxMacPlatformFontList.mm",
231    ]
232elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
233    UNIFIED_SOURCES += [
234        "D3D11Checks.cpp",
235    ]
236    SOURCES += [
237        "DeviceManagerDx.cpp",
238    ]
239
240if CONFIG["MOZ_ENABLE_SKIA_PDF"]:
241    EXPORTS.mozilla.gfx += [
242        "PrintTargetSkPDF.h",
243    ]
244    SOURCES += [
245        "PrintTargetSkPDF.cpp",
246    ]
247
248# We use ICU for normalization functions:
249USE_LIBS += [
250    "icu",
251]
252
253include("/ipc/chromium/chromium-config.mozbuild")
254
255FINAL_LIBRARY = "xul"
256
257LOCAL_INCLUDES += [
258    "!/security/rlbox",
259    "/dom/base",
260    "/dom/media/platforms/apple",
261    "/dom/xml",
262    "/gfx/cairo/cairo/src",
263    "/widget/gtk",
264]
265
266if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("android", "gtk"):
267    DEFINES["MOZ_ENABLE_FREETYPE"] = True
268
269if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
270    for var in ("MOZ_ENABLE_D3D10_LAYER",):
271        if CONFIG[var]:
272            DEFINES[var] = True
273
274if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("android"):
275    CXXFLAGS += CONFIG["CAIRO_FT_CFLAGS"]
276
277if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
278    CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
279    CFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
280    CXXFLAGS += CONFIG["MOZ_PANGO_CFLAGS"]
281
282if CONFIG["MOZ_WAYLAND"]:
283    CXXFLAGS += CONFIG["MOZ_WAYLAND_CFLAGS"]
284
285LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
286
287if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
288    CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"]
289else:
290    DEFINES["GRAPHITE2_STATIC"] = True
291
292if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
293    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
294
295if CONFIG["CC_TYPE"] == "clang":
296    # Suppress warnings from Skia header files.
297    SOURCES["gfxPlatform.cpp"].flags += ["-Wno-implicit-fallthrough"]
298
299CXXFLAGS += ["-Werror=switch"]
300