[CMake] Properly test if compiler supports compiler flags
[WebKit-https.git] / Source / WebCore / PlatformGTK.cmake
1 include(platform/Cairo.cmake)
2 include(platform/FreeType.cmake)
3 include(platform/GCrypt.cmake)
4 include(platform/GStreamer.cmake)
5 include(platform/ImageDecoders.cmake)
6 include(platform/Linux.cmake)
7
8 if (USE_TEXTURE_MAPPER)
9     include(platform/TextureMapper.cmake)
10 endif ()
11
12 set(WebCore_OUTPUT_NAME WebCoreGTK)
13
14 list(APPEND WebCore_INCLUDE_DIRECTORIES
15     "${THIRDPARTY_DIR}/ANGLE/"
16     "${THIRDPARTY_DIR}/ANGLE/include/KHR"
17     "${WEBCORE_DIR}/accessibility/atk"
18     "${WEBCORE_DIR}/editing/atk"
19     "${WEBCORE_DIR}/page/gtk"
20     "${WEBCORE_DIR}/platform/gamepad"
21     "${WEBCORE_DIR}/platform/gamepad/deprecated"
22     "${WEBCORE_DIR}/platform/gamepad/glib"
23     "${WEBCORE_DIR}/platform/geoclue"
24     "${WEBCORE_DIR}/platform/gtk"
25     "${WEBCORE_DIR}/platform/graphics/egl"
26     "${WEBCORE_DIR}/platform/graphics/glx"
27     "${WEBCORE_DIR}/platform/graphics/gtk"
28     "${WEBCORE_DIR}/platform/graphics/opengl"
29     "${WEBCORE_DIR}/platform/graphics/opentype"
30     "${WEBCORE_DIR}/platform/graphics/wayland"
31     "${WEBCORE_DIR}/platform/graphics/x11"
32     "${WEBCORE_DIR}/platform/mediastream/gtk"
33     "${WEBCORE_DIR}/platform/mock/mediasource"
34     "${WEBCORE_DIR}/platform/network/gtk"
35     "${WEBCORE_DIR}/platform/network/soup"
36     "${WEBCORE_DIR}/platform/text/gtk"
37 )
38
39 list(APPEND WebCore_SOURCES
40     accessibility/atk/AXObjectCacheAtk.cpp
41     accessibility/atk/AccessibilityObjectAtk.cpp
42     accessibility/atk/WebKitAccessibleHyperlink.cpp
43     accessibility/atk/WebKitAccessibleInterfaceAction.cpp
44     accessibility/atk/WebKitAccessibleInterfaceComponent.cpp
45     accessibility/atk/WebKitAccessibleInterfaceDocument.cpp
46     accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp
47     accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp
48     accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp
49     accessibility/atk/WebKitAccessibleInterfaceImage.cpp
50     accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
51     accessibility/atk/WebKitAccessibleInterfaceTable.cpp
52     accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp
53     accessibility/atk/WebKitAccessibleInterfaceText.cpp
54     accessibility/atk/WebKitAccessibleInterfaceValue.cpp
55     accessibility/atk/WebKitAccessibleUtil.cpp
56     accessibility/atk/WebKitAccessibleWrapperAtk.cpp
57
58     editing/atk/FrameSelectionAtk.cpp
59
60     loader/soup/CachedRawResourceSoup.cpp
61     loader/soup/SubresourceLoaderSoup.cpp
62
63     page/linux/ResourceUsageOverlayLinux.cpp
64     page/linux/ResourceUsageThreadLinux.cpp
65
66     platform/ScrollAnimationKinetic.cpp
67     platform/StaticPasteboard.cpp
68     platform/UserAgentQuirks.cpp
69
70     platform/audio/glib/AudioBusGLib.cpp
71
72     platform/gamepad/glib/GamepadsGlib.cpp
73
74     platform/geoclue/GeolocationProviderGeoclue1.cpp
75     platform/geoclue/GeolocationProviderGeoclue2.cpp
76
77     platform/glib/EventLoopGlib.cpp
78     platform/glib/FileSystemGlib.cpp
79     platform/glib/KeyedDecoderGlib.cpp
80     platform/glib/KeyedEncoderGlib.cpp
81     platform/glib/MainThreadSharedTimerGLib.cpp
82     platform/glib/SSLKeyGeneratorGLib.cpp
83     platform/glib/SharedBufferGlib.cpp
84
85     platform/graphics/GLContext.cpp
86     platform/graphics/GraphicsContext3DPrivate.cpp
87
88     platform/graphics/cairo/BackingStoreBackendCairoX11.cpp
89
90     platform/graphics/egl/GLContextEGL.cpp
91     platform/graphics/egl/GLContextEGLWayland.cpp
92     platform/graphics/egl/GLContextEGLX11.cpp
93
94     platform/graphics/glx/GLContextGLX.cpp
95
96     platform/graphics/gstreamer/ImageGStreamerCairo.cpp
97
98     platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
99     platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
100     platform/graphics/opengl/TemporaryOpenGLSetting.cpp
101
102     platform/graphics/opentype/OpenTypeVerticalData.cpp
103
104     platform/graphics/wayland/PlatformDisplayWayland.cpp
105
106     platform/graphics/x11/PlatformDisplayX11.cpp
107     platform/graphics/x11/XErrorTrapper.cpp
108     platform/graphics/x11/XUniqueResource.cpp
109
110     platform/gtk/DragDataGtk.cpp
111     platform/gtk/LocalizedStringsGtk.cpp
112     platform/gtk/PasteboardGtk.cpp
113     platform/gtk/ScrollAnimatorGtk.cpp
114     platform/gtk/SelectionData.cpp
115     platform/gtk/UserAgentGtk.cpp
116
117     platform/network/soup/AuthenticationChallengeSoup.cpp
118     platform/network/soup/CertificateInfo.cpp
119     platform/network/soup/CookieJarSoup.cpp
120     platform/network/soup/CookieStorageSoup.cpp
121     platform/network/soup/CredentialStorageSoup.cpp
122     platform/network/soup/DNSSoup.cpp
123     platform/network/soup/GRefPtrSoup.cpp
124     platform/network/soup/NetworkStorageSessionSoup.cpp
125     platform/network/soup/ProxyServerSoup.cpp
126     platform/network/soup/ResourceErrorSoup.cpp
127     platform/network/soup/ResourceHandleSoup.cpp
128     platform/network/soup/ResourceRequestSoup.cpp
129     platform/network/soup/ResourceResponseSoup.cpp
130     platform/network/soup/SocketStreamHandleImplSoup.cpp
131     platform/network/soup/SoupNetworkSession.cpp
132     platform/network/soup/SynchronousLoaderClientSoup.cpp
133     platform/network/soup/WebKitSoupRequestGeneric.cpp
134
135     platform/soup/PublicSuffixSoup.cpp
136     platform/soup/SharedBufferSoup.cpp
137     platform/soup/URLSoup.cpp
138
139     platform/text/Hyphenation.cpp
140     platform/text/LocaleICU.cpp
141
142     platform/text/enchant/TextCheckerEnchant.cpp
143
144     platform/text/hyphen/HyphenationLibHyphen.cpp
145
146     platform/unix/LoggingUnix.cpp
147
148     platform/xdg/MIMETypeRegistryXdg.cpp
149 )
150
151 list(APPEND WebCorePlatformGTK_SOURCES
152     editing/gtk/EditorGtk.cpp
153
154     page/gtk/DragControllerGtk.cpp
155     page/gtk/EventHandlerGtk.cpp
156
157     platform/graphics/PlatformDisplay.cpp
158
159     platform/graphics/gtk/ColorGtk.cpp
160     platform/graphics/gtk/GdkCairoUtilities.cpp
161     platform/graphics/gtk/IconGtk.cpp
162     platform/graphics/gtk/ImageBufferGtk.cpp
163     platform/graphics/gtk/ImageGtk.cpp
164
165     platform/gtk/CursorGtk.cpp
166     platform/gtk/DragImageGtk.cpp
167     platform/gtk/GRefPtrGtk.cpp
168     platform/gtk/GtkUtilities.cpp
169     platform/gtk/GtkVersioning.c
170     platform/gtk/PasteboardHelper.cpp
171     platform/gtk/PlatformKeyboardEventGtk.cpp
172     platform/gtk/PlatformMouseEventGtk.cpp
173     platform/gtk/PlatformPasteboardGtk.cpp
174     platform/gtk/PlatformScreenGtk.cpp
175     platform/gtk/PlatformWheelEventGtk.cpp
176     platform/gtk/RenderThemeGadget.cpp
177     platform/gtk/RenderThemeWidget.cpp
178     platform/gtk/ScrollbarThemeGtk.cpp
179     platform/gtk/WidgetGtk.cpp
180
181     rendering/RenderThemeGtk.cpp
182 )
183
184 if (USE_GEOCLUE2)
185     list(APPEND WebCore_DERIVED_SOURCES
186         ${DERIVED_SOURCES_WEBCORE_DIR}/Geoclue2Interface.c
187     )
188     execute_process(COMMAND pkg-config --variable dbus_interface geoclue-2.0 OUTPUT_VARIABLE GEOCLUE_DBUS_INTERFACE)
189     add_custom_command(
190          OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/Geoclue2Interface.c ${DERIVED_SOURCES_WEBCORE_DIR}/Geoclue2Interface.h
191          COMMAND gdbus-codegen --interface-prefix org.freedesktop.GeoClue2. --c-namespace Geoclue --generate-c-code ${DERIVED_SOURCES_WEBCORE_DIR}/Geoclue2Interface ${GEOCLUE_DBUS_INTERFACE}
192     )
193     set_source_files_properties(${DERIVED_SOURCES_WEBCORE_DIR}/Geoclue2Interface.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
194 endif ()
195
196 list(APPEND WebCore_USER_AGENT_STYLE_SHEETS
197     ${WEBCORE_DIR}/css/mediaControlsGtk.css
198 )
199
200 set(WebCore_USER_AGENT_SCRIPTS
201     ${WEBCORE_DIR}/English.lproj/mediaControlsLocalizedStrings.js
202     ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsBase.js
203     ${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsGtk.js
204 )
205
206 set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/platform/gtk/RenderThemeGtk.cpp)
207
208 list(APPEND WebCore_LIBRARIES
209     ${ATK_LIBRARIES}
210     ${CAIRO_LIBRARIES}
211     ${ENCHANT_LIBRARIES}
212     ${GEOCLUE_LIBRARIES}
213     ${GLIB_GIO_LIBRARIES}
214     ${GLIB_GMODULE_LIBRARIES}
215     ${GLIB_GOBJECT_LIBRARIES}
216     ${GLIB_LIBRARIES}
217     ${GUDEV_LIBRARIES}
218     ${LIBSECRET_LIBRARIES}
219     ${LIBSOUP_LIBRARIES}
220     ${LIBTASN1_LIBRARIES}
221     ${LIBXML2_LIBRARIES}
222     ${LIBXSLT_LIBRARIES}
223     ${HYPHEN_LIBRARIES}
224     ${SQLITE_LIBRARIES}
225     ${X11_X11_LIB}
226     ${X11_Xcomposite_LIB}
227     ${X11_Xdamage_LIB}
228     ${X11_Xrender_LIB}
229     ${X11_Xt_LIB}
230     ${ZLIB_LIBRARIES}
231     WTF
232 )
233
234 list(APPEND WebCoreTestSupport_LIBRARIES WTF)
235
236 list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
237     ${ATK_INCLUDE_DIRS}
238     ${CAIRO_INCLUDE_DIRS}
239     ${ENCHANT_INCLUDE_DIRS}
240     ${GEOCLUE_INCLUDE_DIRS}
241     ${GIO_UNIX_INCLUDE_DIRS}
242     ${GLIB_INCLUDE_DIRS}
243     ${GUDEV_INCLUDE_DIRS}
244     ${LIBSECRET_INCLUDE_DIRS}
245     ${LIBSOUP_INCLUDE_DIRS}
246     ${LIBTASN1_INCLUDE_DIRS}
247     ${LIBXML2_INCLUDE_DIR}
248     ${LIBXSLT_INCLUDE_DIR}
249     ${SQLITE_INCLUDE_DIR}
250     ${ZLIB_INCLUDE_DIRS}
251 )
252
253 if (USE_OPENGL_ES_2)
254     list(APPEND WebCore_SOURCES
255         platform/graphics/opengl/Extensions3DOpenGLES.cpp
256         platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
257     )
258 endif ()
259
260 if (USE_OPENGL)
261     list(APPEND WebCore_SOURCES
262         platform/graphics/OpenGLShims.cpp
263
264         platform/graphics/opengl/Extensions3DOpenGL.cpp
265         platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
266     )
267 endif ()
268
269 if (ENABLE_PLUGIN_PROCESS_GTK2)
270     # WebKitPluginProcess2 needs a version of WebCore compiled against GTK+2, so we've isolated all the GTK+
271     # dependent files into a separate library which can be used to construct a GTK+2 WebCore
272     # for the plugin process.
273     add_library(WebCorePlatformGTK2 ${WebCore_LIBRARY_TYPE} ${WebCorePlatformGTK_SOURCES})
274     add_dependencies(WebCorePlatformGTK2 WebCore)
275     set_property(TARGET WebCorePlatformGTK2
276         APPEND
277         PROPERTY COMPILE_DEFINITIONS GTK_API_VERSION_2=1
278     )
279     target_include_directories(WebCorePlatformGTK2 PRIVATE
280         ${WebCore_INCLUDE_DIRECTORIES}
281         ${GTK2_INCLUDE_DIRS}
282         ${GDK2_INCLUDE_DIRS}
283     )
284     target_include_directories(WebCorePlatformGTK2 SYSTEM PRIVATE
285         ${WebCore_SYSTEM_INCLUDE_DIRECTORIES}
286     )
287     target_link_libraries(WebCorePlatformGTK2
288          ${WebCore_LIBRARIES}
289          ${GTK2_LIBRARIES}
290          ${GDK2_LIBRARIES}
291     )
292 endif ()
293
294 if (ENABLE_WAYLAND_TARGET)
295     list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
296         ${WAYLAND_INCLUDE_DIRS}
297     )
298     list(APPEND WebCore_LIBRARIES
299         ${WAYLAND_LIBRARIES}
300     )
301 endif ()
302
303 add_library(WebCorePlatformGTK ${WebCore_LIBRARY_TYPE} ${WebCorePlatformGTK_SOURCES})
304 add_dependencies(WebCorePlatformGTK WebCore)
305 target_include_directories(WebCorePlatformGTK PRIVATE
306     ${WebCore_INCLUDE_DIRECTORIES}
307 )
308 target_include_directories(WebCorePlatformGTK SYSTEM PRIVATE
309     ${WebCore_SYSTEM_INCLUDE_DIRECTORIES}
310     ${GTK_INCLUDE_DIRS}
311     ${GDK_INCLUDE_DIRS}
312 )
313 target_link_libraries(WebCorePlatformGTK
314     ${WebCore_LIBRARIES}
315     ${GTK_LIBRARIES}
316     ${GDK_LIBRARIES}
317 )
318
319 include_directories(
320     ${WebCore_INCLUDE_DIRECTORIES}
321     "${WEBCORE_DIR}/bindings/gobject/"
322 )
323
324 include_directories(SYSTEM
325     ${WebCore_SYSTEM_INCLUDE_DIRECTORIES}
326 )
327
328 add_definitions(-DBUILDING_WEBKIT)
329
330 if (ENABLE_SMOOTH_SCROLLING)
331     list(APPEND WebCore_SOURCES
332         platform/ScrollAnimationSmooth.cpp
333     )
334 endif ()