[GTK][WPE] Stop using legacy custom protocol implementation
[WebKit-https.git] / Source / WebKit / PlatformWPE.cmake
1 include(InspectorGResources.cmake)
2 include(GNUInstallDirs)
3
4 set(WebKit_OUTPUT_NAME WPEWebKit-${WPE_API_VERSION})
5 set(WebKit_WebProcess_OUTPUT_NAME WPEWebProcess)
6 set(WebKit_NetworkProcess_OUTPUT_NAME WPENetworkProcess)
7
8 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WPE_API_DIR})
9 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_DIR})
10 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_EXTENSION_DIR})
11 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_DOM_DIR})
12
13 configure_file(UIProcess/API/wpe/WebKitVersion.h.in ${DERIVED_SOURCES_WPE_API_DIR}/WebKitVersion.h)
14 configure_file(wpe/wpe-webkit.pc.in ${WPE_PKGCONFIG_FILE} @ONLY)
15 configure_file(wpe/wpe-web-extension.pc.in ${WPEWebExtension_PKGCONFIG_FILE} @ONLY)
16
17 add_definitions(-DWEBKIT2_COMPILATION)
18
19 add_definitions(-DLIBDIR="${LIB_INSTALL_DIR}")
20 add_definitions(-DPKGLIBDIR="${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}")
21 add_definitions(-DPKGLIBEXECDIR="${LIBEXEC_INSTALL_DIR}")
22 add_definitions(-DDATADIR="${CMAKE_INSTALL_FULL_DATADIR}")
23 add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
24
25 if (NOT DEVELOPER_MODE AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
26     WEBKIT_ADD_TARGET_PROPERTIES(WebKit LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/webkitglib-symbols.map")
27 endif ()
28
29 set(WebKit_USE_PREFIX_HEADER ON)
30
31 add_custom_target(webkitwpe-forwarding-headers
32     COMMAND ${PERL_EXECUTABLE} ${WEBKIT_DIR}/Scripts/generate-forwarding-headers.pl --include-path ${WEBKIT_DIR} --output ${FORWARDING_HEADERS_DIR} --platform wpe --platform soup
33 )
34
35  # These symbolic link allows includes like #include <wpe/WebkitWebView.h> which simulates installed headers.
36 add_custom_command(
37     OUTPUT ${FORWARDING_HEADERS_WPE_DIR}/wpe
38     DEPENDS ${WEBKIT_DIR}/UIProcess/API/wpe
39     COMMAND ln -n -s -f ${WEBKIT_DIR}/UIProcess/API/wpe ${FORWARDING_HEADERS_WPE_DIR}/wpe
40 )
41
42 add_custom_command(
43     OUTPUT ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
44     DEPENDS ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe
45     COMMAND ln -n -s -f ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
46 )
47
48 add_custom_command(
49     OUTPUT ${FORWARDING_HEADERS_WPE_DOM_DIR}/wpe
50     DEPENDS ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM
51     COMMAND ln -n -s -f ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM ${FORWARDING_HEADERS_WPE_DOM_DIR}/wpe
52     VERBATIM
53 )
54
55 add_custom_target(webkitwpe-fake-api-headers
56     DEPENDS ${FORWARDING_HEADERS_WPE_DIR}/wpe
57             ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
58             ${FORWARDING_HEADERS_WPE_DOM_DIR}/wpe
59 )
60
61 set(WEBKIT_EXTRA_DEPENDENCIES
62     webkitwpe-fake-api-headers
63     webkitwpe-forwarding-headers
64 )
65
66 list(APPEND WebProcess_SOURCES
67     WebProcess/EntryPoint/unix/WebProcessMain.cpp
68 )
69
70 list(APPEND NetworkProcess_SOURCES
71     NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp
72 )
73
74 list(APPEND WebKit_UNIFIED_SOURCE_LIST_FILES
75     "SourcesWPE.txt"
76 )
77
78 list(APPEND WebKit_DERIVED_SOURCES
79     ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
80
81     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.cpp
82     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.cpp
83 )
84
85 set(WPE_API_INSTALLED_HEADERS
86     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h
87     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitVersion.h
88     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitApplicationInfo.h
89     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitAuthenticationRequest.h
90     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitAutocleanups.h
91     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitAutomationSession.h
92     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitBackForwardList.h
93     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitBackForwardListItem.h
94     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitCredential.h
95     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitColor.h
96     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenu.h
97     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenuActions.h
98     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenuItem.h
99     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitCookieManager.h
100     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDefines.h
101     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h
102     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDownload.h
103     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitEditingCommands.h
104     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitEditorState.h
105     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitError.h
106     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFaviconDatabase.h
107     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFileChooserRequest.h
108     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFindController.h
109     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFormSubmissionRequest.h
110     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitGeolocationManager.h
111     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitGeolocationPermissionRequest.h
112     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitHitTestResult.h
113     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitInstallMissingMediaPluginsPermissionRequest.h
114     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitJavascriptResult.h
115     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitMimeInfo.h
116     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNavigationAction.h
117     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNavigationPolicyDecision.h
118     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNetworkProxySettings.h
119     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNotificationPermissionRequest.h
120     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNotification.h
121     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPermissionRequest.h
122     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPlugin.h
123     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPolicyDecision.h
124     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitResponsePolicyDecision.h
125     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitScriptDialog.h
126     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSecurityManager.h
127     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSecurityOrigin.h
128     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSettings.h
129     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIRequest.h
130     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIResponse.h
131     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURISchemeRequest.h
132     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIUtilities.h
133     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContent.h
134     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContentFilterStore.h
135     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContentManager.h
136     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserMediaPermissionRequest.h
137     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebContext.h
138     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebResource.h
139     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebView.h
140     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewBackend.h
141     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewSessionState.h
142     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebsiteData.h
143     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebsiteDataManager.h
144     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWindowProperties.h
145     ${WEBKIT_DIR}/UIProcess/API/wpe/webkit.h
146 )
147
148 set(WPE_WEB_EXTENSION_API_INSTALLED_HEADERS
149     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
150     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h
151     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitFrame.h
152     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h
153     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h
154     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h
155     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h
156     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebHitTestResult.h
157     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h
158     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h
159     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/webkitdom.h
160     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDefines.h
161     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDocument.h
162     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMElement.h
163     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMNode.h
164     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMObject.h
165 )
166
167 # To generate WebKitEnumTypes.h we want to use all installed headers, except WebKitEnumTypes.h itself.
168 set(WPE_ENUM_GENERATION_HEADERS ${WPE_API_INSTALLED_HEADERS})
169 list(REMOVE_ITEM WPE_ENUM_GENERATION_HEADERS ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h)
170 add_custom_command(
171     OUTPUT ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h
172            ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.cpp
173     DEPENDS ${WPE_ENUM_GENERATION_HEADERS}
174
175     COMMAND glib-mkenums --template ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitEnumTypes.h.template ${WPE_ENUM_GENERATION_HEADERS} | sed s/web_kit/webkit/ | sed s/WEBKIT_TYPE_KIT/WEBKIT_TYPE/ > ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h
176
177     COMMAND glib-mkenums --template ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitEnumTypes.cpp.template ${WPE_ENUM_GENERATION_HEADERS} | sed s/web_kit/webkit/ > ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.cpp
178     VERBATIM
179 )
180
181 set(WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS ${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS})
182 list(REMOVE_ITEM WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h)
183 add_custom_command(
184     OUTPUT ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
185            ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.cpp
186     DEPENDS ${WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS}
187
188     COMMAND glib-mkenums --template ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebProcessEnumTypes.h.template ${WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS} | sed s/web_kit/webkit/ | sed s/WEBKIT_TYPE_KIT/WEBKIT_TYPE/ > ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
189
190     COMMAND glib-mkenums --template ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebProcessEnumTypes.cpp.template ${WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS} | sed s/web_kit/webkit/ > ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.cpp
191     VERBATIM
192 )
193
194 set(WebKitResources
195 )
196
197 if (ENABLE_WEB_AUDIO)
198     list(APPEND WebKitResources
199         "        <file alias=\"audio/Composite\">Composite.wav</file>\n"
200     )
201 endif ()
202
203 file(WRITE ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.xml
204     "<?xml version=1.0 encoding=UTF-8?>\n"
205     "<gresources>\n"
206     "    <gresource prefix=\"/org/webkitwpe/resources\">\n"
207     ${WebKitResources}
208     "    </gresource>\n"
209     "</gresources>\n"
210 )
211
212 add_custom_command(
213     OUTPUT ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
214     DEPENDS ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.xml
215     COMMAND glib-compile-resources --generate --sourcedir=${CMAKE_SOURCE_DIR}/Source/WebCore/Resources --sourcedir=${CMAKE_SOURCE_DIR}/Source/WebCore/platform/audio/resources --target=${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.xml
216     VERBATIM
217 )
218
219 list(APPEND WebKit_INCLUDE_DIRECTORIES
220     "${DERIVED_SOURCES_JAVASCRIPCOREWPE_DIR}"
221     "${FORWARDING_HEADERS_DIR}"
222     "${FORWARDING_HEADERS_DIR}/JavaScriptCore/"
223     "${FORWARDING_HEADERS_DIR}/JavaScriptCore/glib"
224     "${FORWARDING_HEADERS_WPE_DIR}"
225     "${FORWARDING_HEADERS_WPE_EXTENSION_DIR}"
226     "${FORWARDING_HEADERS_WPE_DOM_DIR}"
227     "${DERIVED_SOURCES_DIR}"
228     "${DERIVED_SOURCES_WPE_API_DIR}"
229     "${WEBKIT_DIR}/NetworkProcess/glib"
230     "${WEBKIT_DIR}/NetworkProcess/soup"
231     "${WEBKIT_DIR}/NetworkProcess/unix"
232     "${WEBKIT_DIR}/Platform/IPC/glib"
233     "${WEBKIT_DIR}/Platform/IPC/unix"
234     "${WEBKIT_DIR}/Platform/classifier"
235     "${WEBKIT_DIR}/Shared/API/c/wpe"
236     "${WEBKIT_DIR}/Shared/API/glib"
237     "${WEBKIT_DIR}/Shared/CoordinatedGraphics"
238     "${WEBKIT_DIR}/Shared/CoordinatedGraphics/threadedcompositor"
239     "${WEBKIT_DIR}/Shared/glib"
240     "${WEBKIT_DIR}/Shared/libwpe"
241     "${WEBKIT_DIR}/Shared/soup"
242     "${WEBKIT_DIR}/Shared/unix"
243     "${WEBKIT_DIR}/UIProcess/API/C/cairo"
244     "${WEBKIT_DIR}/UIProcess/API/C/wpe"
245     "${WEBKIT_DIR}/UIProcess/API/glib"
246     "${WEBKIT_DIR}/UIProcess/API/wpe"
247     "${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
248     "${WEBKIT_DIR}/UIProcess/geoclue"
249     "${WEBKIT_DIR}/UIProcess/gstreamer"
250     "${WEBKIT_DIR}/UIProcess/linux"
251     "${WEBKIT_DIR}/UIProcess/soup"
252     "${WEBKIT_DIR}/UIProcess/wpe"
253     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib"
254     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/DOM"
255     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe"
256     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM"
257     "${WEBKIT_DIR}/WebProcess/soup"
258     "${WEBKIT_DIR}/WebProcess/unix"
259     "${WEBKIT_DIR}/WebProcess/WebCoreSupport/soup"
260     "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics"
261     "${WEBKIT_DIR}/WebProcess/WebPage/atk"
262     "${WEBKIT_DIR}/WebProcess/WebPage/libwpe"
263     "${WEBKIT_DIR}/WebProcess/WebPage/wpe"
264     "${WTF_DIR}/wtf/gtk/"
265     "${WTF_DIR}/wtf/gobject"
266     "${WTF_DIR}"
267 )
268
269 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
270     ${ATK_INCLUDE_DIRS}
271     ${ATK_BRIDGE_INCLUDE_DIRS}
272     ${CAIRO_INCLUDE_DIRS}
273     ${FREETYPE_INCLUDE_DIRS}
274     ${GLIB_INCLUDE_DIRS}
275     ${GSTREAMER_INCLUDE_DIRS}
276     ${HARFBUZZ_INCLUDE_DIRS}
277     ${LIBSECCOMP_INCLUDE_DIRS}
278     ${LIBSOUP_INCLUDE_DIRS}
279     ${WPE_INCLUDE_DIRS}
280 )
281
282 list(APPEND WebKit_LIBRARIES
283     ${ATK_LIBRARIES}
284     ${ATK_BRIDGE_LIBRARIES}
285     ${CAIRO_LIBRARIES}
286     ${FREETYPE_LIBRARIES}
287     ${GLIB_LIBRARIES}
288     ${GLIB_GMODULE_LIBRARIES}
289     ${GSTREAMER_LIBRARIES}
290     ${HARFBUZZ_LIBRARIES}
291     ${LIBSECCOMP_LIBRARIES}
292     ${LIBSOUP_LIBRARIES}
293     ${WPE_LIBRARIES}
294 )
295
296 WEBKIT_BUILD_INSPECTOR_GRESOURCES(${DERIVED_SOURCES_WEBINSPECTORUI_DIR})
297 list(APPEND WPEWebInspectorResources_DERIVED_SOURCES
298     ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c
299 )
300
301 list(APPEND WPEWebInspectorResources_LIBRARIES
302     ${GLIB_GIO_LIBRARIES}
303 )
304
305 list(APPEND WPEWebInspectorResources_SYSTEM_INCLUDE_DIRECTORIES
306     ${GLIB_INCLUDE_DIRS}
307 )
308
309 add_library(WPEWebInspectorResources SHARED ${WPEWebInspectorResources_DERIVED_SOURCES})
310 add_dependencies(WPEWebInspectorResources WebKit)
311 target_link_libraries(WPEWebInspectorResources ${WPEWebInspectorResources_LIBRARIES})
312 target_include_directories(WPEWebInspectorResources SYSTEM PUBLIC ${WPEWebInspectorResources_SYSTEM_INCLUDE_DIRECTORIES})
313 install(TARGETS WPEWebInspectorResources DESTINATION "${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}")
314
315 add_library(WPEInjectedBundle MODULE "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/WebKitInjectedBundleMain.cpp")
316 ADD_WEBKIT_PREFIX_HEADER(WPEInjectedBundle)
317 target_link_libraries(WPEInjectedBundle WebKit)
318
319 target_include_directories(WPEInjectedBundle PRIVATE ${WebKit_INCLUDE_DIRECTORIES})
320 target_include_directories(WPEInjectedBundle SYSTEM PRIVATE ${WebKit_SYSTEM_INCLUDE_DIRECTORIES})
321
322 file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-wpe.cfg
323     "[wpe-${WPE_API_VERSION}]\n"
324     "pkgconfig_file=${WPE_PKGCONFIG_FILE}\n"
325     "decorator=WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\\(.+\\)\n"
326     "deprecation_guard=WEBKIT_DISABLE_DEPRECATED\n"
327     "namespace=webkit\n"
328     "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
329     "       -I${WEBKIT_DIR}/Shared/API/glib\n"
330     "       -I${WEBKIT_DIR}/UIProcess/API/glib\n"
331     "       -I${WEBKIT_DIR}/UIProcess/API/wpe\n"
332     "       -I${FORWARDING_HEADERS_WPE_DIR}\n"
333     "doc_dir=${WEBKIT_DIR}/UIProcess/API/wpe/docs\n"
334     "source_dirs=${WEBKIT_DIR}/Shared/API/glib\n"
335     "            ${WEBKIT_DIR}/UIProcess/API/glib\n"
336     "            ${WEBKIT_DIR}/UIProcess/API/wpe\n"
337     "            ${DERIVED_SOURCES_WPE_API_DIR}\n"
338     "headers=${WPE_ENUM_GENERATION_HEADERS}\n"
339     "main_sgml_file=wpe-docs.sgml\n"
340 )
341
342 file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-webextensions.cfg
343     "[wpe-webextensions-${WPE_API_VERSION}]\n"
344     "pkgconfig_file=${WPEWebExtension_PKGCONFIG_FILE}\n"
345     "decorator=WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\\(.+\\)\n"
346     "deprecation_guard=WEBKIT_DISABLE_DEPRECATED\n"
347     "namespace=webkit_webextensions\n"
348     "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
349     "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe\n"
350     "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM\n"
351     "       -I${FORWARDING_HEADERS_WPE_DIR}\n"
352     "doc_dir=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/docs\n"
353     "source_dirs=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib\n"
354     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/DOM\n"
355     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe\n"
356     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM\n"
357     "headers=${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS}\n"
358     "main_sgml_file=wpe-webextensions-docs.sgml\n"
359 )
360
361 if (ENABLE_WPE_QT_API)
362     set(qtwpe_SOURCES
363         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp
364         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp
365         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtView.cpp
366         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp
367     )
368
369     set(qtwpe_LIBRARIES
370         Qt5::Core Qt5::Quick
371         WebKit
372         ${LIBEPOXY_LIBRARIES}
373         ${WPEBACKEND_FDO_LIBRARIES}
374     )
375
376     set(qtwpe_INCLUDE_DIRECTORIES
377         ${Qt5_INCLUDE_DIRS}
378         ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
379         ${LIBEPOXY_INCLUDE_DIRS}
380         ${WPEBACKEND_FDO_INCLUDE_DIRS}
381     )
382
383     list(APPEND WPE_API_INSTALLED_HEADERS
384         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtView.h
385         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h
386     )
387
388     add_library(qtwpe SHARED ${qtwpe_SOURCES})
389     set_target_properties(qtwpe PROPERTIES
390         OUTPUT_NAME qtwpe
391         AUTOMOC ON
392     )
393     target_compile_definitions(qtwpe PUBLIC QT_NO_KEYWORDS=1)
394     target_link_libraries(qtwpe ${qtwpe_LIBRARIES})
395     target_include_directories(qtwpe SYSTEM PRIVATE ${qtwpe_INCLUDE_DIRECTORIES})
396     install(TARGETS qtwpe DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qml/org/wpewebkit/qtwpe/")
397     install(FILES ${WEBKIT_DIR}/UIProcess/API/wpe/qt/qmldir DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qml/org/wpewebkit/qtwpe/")
398
399     file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
400     add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
401         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libqtwpe.so
402         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
403     add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
404         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/qmldir
405         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
406 endif ()
407
408 install(TARGETS WPEInjectedBundle
409         DESTINATION "${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}/injected-bundle"
410 )
411
412 install(FILES "${CMAKE_BINARY_DIR}/wpe-webkit-${WPE_API_VERSION}.pc"
413               "${CMAKE_BINARY_DIR}/wpe-web-extension-${WPE_API_VERSION}.pc"
414         DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
415         COMPONENT "Development"
416 )
417
418 install(FILES ${WPE_API_INSTALLED_HEADERS}
419               ${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS}
420         DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-webkit-${WPE_API_VERSION}/wpe"
421         COMPONENT "Development"
422 )