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