Bug 1836072 [wpt PR 40324] - Fix scrollbar-width repaint issues on non viewports...
[gecko.git] / gfx / gl / moz.build
blobe594ba8ac904ea7c0dac7465d09b55097a293cf5
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/.
7 gl_provider = "Null"
9 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
10     gl_provider = "WGL"
11 elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
12     gl_provider = "CGL"
13 elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
14     gl_provider = "EAGL"
15 elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
16     gl_provider = "Linux"
17 elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
18     gl_provider = "EGL"
20 if CONFIG["MOZ_GL_PROVIDER"]:
21     gl_provider = CONFIG["MOZ_GL_PROVIDER"]
23 EXPORTS += [
24     "AndroidSurfaceTexture.h",
25     "AutoMappable.h",
26     "Colorspaces.h",
27     "ForceDiscreteGPUHelperCGL.h",
28     "GfxTexturesReporter.h",
29     "GLBlitHelper.h",
30     "GLConsts.h",
31     "GLContext.h",
32     "GLContextEGL.h",
33     "GLContextProvider.h",
34     "GLContextProviderImpl.h",
35     "GLContextSymbols.h",
36     "GLContextTypes.h",
37     "GLDefs.h",
38     "GLLibraryEGL.h",
39     "GLLibraryLoader.h",
40     "GLReadTexImageHelper.h",
41     "GLScreenBuffer.h",
42     "GLTextureImage.h",
43     "GLTypes.h",
44     "GLUploadHelpers.h",
45     "GLVendor.h",
46     "HeapCopyOfStackArray.h",
47     "MozFramebuffer.h",
48     "ScopedGLHelpers.h",
49     "SharedSurface.h",
50     "SharedSurfaceEGL.h",
51     "SharedSurfaceGL.h",
52     "SurfaceTypes.h",
55 # Win32 is a special snowflake, for ANGLE
56 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
57     EXPORTS += [
58         "GLContextWGL.h",
59         "SharedSurfaceANGLE.h",  # Needs <windows.h> for `HANDLE`.
60         "SharedSurfaceD3D11Interop.h",
61         "WGLLibrary.h",
62     ]
63     UNIFIED_SOURCES += [
64         "GLBlitHelperD3D.cpp",
65         "GLContextProviderWGL.cpp",
66         "SharedSurfaceANGLE.cpp",
67         "SharedSurfaceD3D11Interop.cpp",
68     ]
70 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
71     EXPORTS += [
72         "AndroidNativeWindow.h",
73         "SharedSurfaceAndroidHardwareBuffer.h",
74     ]
75     UNIFIED_SOURCES += [
76         "SharedSurfaceAndroidHardwareBuffer.cpp",
77     ]
79 if gl_provider == "CGL":
80     # These files include Mac headers that are unfriendly to unified builds
81     SOURCES += [
82         "GLContextProviderCGL.mm",
83     ]
84     EXPORTS += [
85         "GLContextCGL.h",
86         "SharedSurfaceIO.h",
87     ]
88     # SharedSurfaceIO.cpp includes MacIOSurface.h which include Mac headers
89     # which define Size and Point types in root namespace with often conflict with
90     # our own types. While I haven't actually hit this issue in the present case,
91     # it's been an issue in gfx/layers so let's not risk it.
92     SOURCES += [
93         "SharedSurfaceIO.cpp",
94     ]
95     OS_LIBS += [
96         "-framework IOSurface",
97     ]
99 elif gl_provider == "EAGL":
100     # These files include ObjC headers that are unfriendly to unified builds
101     SOURCES += [
102         "GLContextProviderEAGL.mm",
103     ]
104     EXPORTS += [
105         "GLContextEAGL.h",
106     ]
108 elif gl_provider == "Linux":
109     # GLContextProviderGLX.cpp needs to be kept out of UNIFIED_SOURCES
110     # as it includes X11 headers which cause conflicts.
111     SOURCES += [
112         "GLContextProviderLinux.cpp",
113     ]
114     EXPORTS += ["GLContextGLX.h", "GLXLibrary.h"]
115     if CONFIG["MOZ_X11"]:
116         SOURCES += ["GLContextProviderGLX.cpp"]
118 if CONFIG["MOZ_WAYLAND"]:
119     SOURCES += ["SharedSurfaceDMABUF.cpp"]
121 UNIFIED_SOURCES += [
122     "AndroidSurfaceTexture.cpp",
123     "Colorspaces.cpp",
124     "GfxTexturesReporter.cpp",
125     "GLBlitHelper.cpp",
126     "GLContext.cpp",
127     "GLContextFeatures.cpp",
128     "GLContextProviderEGL.cpp",
129     "GLDebugUtils.cpp",
130     "GLLibraryEGL.cpp",
131     "GLLibraryLoader.cpp",
132     "GLReadTexImageHelper.cpp",
133     "GLTextureImage.cpp",
134     "GLUploadHelpers.cpp",
135     "MozFramebuffer.cpp",
136     "ScopedGLHelpers.cpp",
137     "SharedSurface.cpp",
138     "SharedSurfaceEGL.cpp",
139     "SharedSurfaceGL.cpp",
141 SOURCES += [
142     "GLScreenBuffer.cpp",
145 TEST_DIRS += [
146     "gtest",
149 include("/ipc/chromium/chromium-config.mozbuild")
151 FINAL_LIBRARY = "xul"
153 if CONFIG["MOZ_D3DCOMPILER_VISTA_DLL"]:
154     DEFINES["MOZ_D3DCOMPILER_VISTA_DLL"] = CONFIG["MOZ_D3DCOMPILER_VISTA_DLL"]
156 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
157     CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
158     CFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
160 CXXFLAGS += ["-Werror=switch"]
162 if CONFIG["MOZ_WAYLAND"]:
163     CXXFLAGS += CONFIG["MOZ_WAYLAND_CFLAGS"]
164     CFLAGS += CONFIG["MOZ_WAYLAND_CFLAGS"]
166 LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
167 LOCAL_INCLUDES += [
168     "/gfx/cairo/cairo/src",