[WPE] Do not use a sync IPC message to send the host FD to the web process
[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/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in
81 )
82
83 list(APPEND WebKit_DERIVED_SOURCES
84     ${DERIVED_SOURCES_WEBKIT_DIR}/WebKitResourcesGResourceBundle.c
85
86     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.cpp
87     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.cpp
88 )
89
90 set(WPE_API_INSTALLED_HEADERS
91     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h
92     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitVersion.h
93     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitApplicationInfo.h
94     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitAuthenticationRequest.h
95     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitAutomationSession.h
96     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitBackForwardList.h
97     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitBackForwardListItem.h
98     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitCredential.h
99     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenu.h
100     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenuActions.h
101     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenuItem.h
102     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitCookieManager.h
103     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDefines.h
104     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h
105     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDownload.h
106     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitEditingCommands.h
107     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitEditorState.h
108     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitError.h
109     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFaviconDatabase.h
110     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFileChooserRequest.h
111     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFindController.h
112     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFormSubmissionRequest.h
113     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitGeolocationPermissionRequest.h
114     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitHitTestResult.h
115     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitInstallMissingMediaPluginsPermissionRequest.h
116     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitJavascriptResult.h
117     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitMimeInfo.h
118     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNavigationAction.h
119     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNavigationPolicyDecision.h
120     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNetworkProxySettings.h
121     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNotificationPermissionRequest.h
122     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNotification.h
123     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPermissionRequest.h
124     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPlugin.h
125     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPolicyDecision.h
126     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitResponsePolicyDecision.h
127     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitScriptDialog.h
128     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSecurityManager.h
129     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSecurityOrigin.h
130     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSettings.h
131     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIRequest.h
132     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIResponse.h
133     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURISchemeRequest.h
134     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIUtilities.h
135     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContent.h
136     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContentManager.h
137     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserMediaPermissionRequest.h
138     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebContext.h
139     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebResource.h
140     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebView.h
141     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewBackend.h
142     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewSessionState.h
143     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebsiteData.h
144     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebsiteDataManager.h
145     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWindowProperties.h
146     ${WEBKIT_DIR}/UIProcess/API/wpe/webkit.h
147 )
148
149 set(WPE_WEB_EXTENSION_API_INSTALLED_HEADERS
150     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
151     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h
152     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitFrame.h
153     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h
154     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h
155     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.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 ${DERIVED_SOURCES_WEBKIT_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 ${DERIVED_SOURCES_WEBKIT_DIR}/WebKitResourcesGResourceBundle.c
214     DEPENDS ${DERIVED_SOURCES_WEBKIT_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=${DERIVED_SOURCES_WEBKIT_DIR}/WebKitResourcesGResourceBundle.c ${DERIVED_SOURCES_WEBKIT_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     "${WEBCORE_DIR}/platform/graphics/cairo"
230     "${WEBCORE_DIR}/platform/graphics/freetype"
231     "${WEBCORE_DIR}/platform/graphics/opentype"
232     "${WEBCORE_DIR}/platform/graphics/texmap/coordinated"
233     "${WEBCORE_DIR}/platform/network/soup"
234     "${WEBKIT_DIR}/NetworkProcess/CustomProtocols/soup"
235     "${WEBKIT_DIR}/NetworkProcess/soup"
236     "${WEBKIT_DIR}/NetworkProcess/unix"
237     "${WEBKIT_DIR}/Platform/IPC/glib"
238     "${WEBKIT_DIR}/Platform/IPC/unix"
239     "${WEBKIT_DIR}/Platform/classifier"
240     "${WEBKIT_DIR}/Shared/API/c/wpe"
241     "${WEBKIT_DIR}/Shared/API/glib"
242     "${WEBKIT_DIR}/Shared/CoordinatedGraphics"
243     "${WEBKIT_DIR}/Shared/CoordinatedGraphics/threadedcompositor"
244     "${WEBKIT_DIR}/Shared/glib"
245     "${WEBKIT_DIR}/Shared/libwpe"
246     "${WEBKIT_DIR}/Shared/soup"
247     "${WEBKIT_DIR}/Shared/unix"
248     "${WEBKIT_DIR}/UIProcess/API/C/cairo"
249     "${WEBKIT_DIR}/UIProcess/API/C/wpe"
250     "${WEBKIT_DIR}/UIProcess/API/glib"
251     "${WEBKIT_DIR}/UIProcess/API/wpe"
252     "${WEBKIT_DIR}/UIProcess/Network/CustomProtocols/soup"
253     "${WEBKIT_DIR}/UIProcess/gstreamer"
254     "${WEBKIT_DIR}/UIProcess/linux"
255     "${WEBKIT_DIR}/UIProcess/soup"
256     "${WEBKIT_DIR}/UIProcess/wpe"
257     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib"
258     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/DOM"
259     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe"
260     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM"
261     "${WEBKIT_DIR}/WebProcess/soup"
262     "${WEBKIT_DIR}/WebProcess/unix"
263     "${WEBKIT_DIR}/WebProcess/WebCoreSupport/soup"
264     "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics"
265     "${WEBKIT_DIR}/WebProcess/WebPage/wpe"
266     "${WTF_DIR}/wtf/gtk/"
267     "${WTF_DIR}/wtf/gobject"
268     "${WTF_DIR}"
269 )
270
271 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
272     ${CAIRO_INCLUDE_DIRS}
273     ${FREETYPE_INCLUDE_DIRS}
274     ${GLIB_INCLUDE_DIRS}
275     ${GSTREAMER_INCLUDE_DIRS}
276     ${HARFBUZZ_INCLUDE_DIRS}
277     ${LIBSOUP_INCLUDE_DIRS}
278     ${WPE_INCLUDE_DIRS}
279 )
280
281 list(APPEND WebKit_LIBRARIES
282     PRIVATE
283         ${CAIRO_LIBRARIES}
284         ${FREETYPE_LIBRARIES}
285         ${GLIB_LIBRARIES}
286         ${GLIB_GMODULE_LIBRARIES}
287         ${GSTREAMER_LIBRARIES}
288         ${HARFBUZZ_LIBRARIES}
289         ${LIBSOUP_LIBRARIES}
290         ${WPE_LIBRARIES}
291 )
292
293 WEBKIT_BUILD_INSPECTOR_GRESOURCES(${DERIVED_SOURCES_WEBINSPECTORUI_DIR})
294 list(APPEND WPEWebInspectorResources_DERIVED_SOURCES
295     ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c
296 )
297
298 list(APPEND WPEWebInspectorResources_LIBRARIES
299     ${GLIB_GIO_LIBRARIES}
300 )
301
302 list(APPEND WPEWebInspectorResources_SYSTEM_INCLUDE_DIRECTORIES
303     ${GLIB_INCLUDE_DIRS}
304 )
305
306 add_library(WPEWebInspectorResources SHARED ${WPEWebInspectorResources_DERIVED_SOURCES})
307 add_dependencies(WPEWebInspectorResources WebKit)
308 target_link_libraries(WPEWebInspectorResources ${WPEWebInspectorResources_LIBRARIES})
309 target_include_directories(WPEWebInspectorResources SYSTEM PUBLIC ${WPEWebInspectorResources_SYSTEM_INCLUDE_DIRECTORIES})
310 install(TARGETS WPEWebInspectorResources DESTINATION "${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}")
311
312 add_library(WPEInjectedBundle MODULE "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/WebKitInjectedBundleMain.cpp")
313 ADD_WEBKIT_PREFIX_HEADER(WPEInjectedBundle)
314 target_link_libraries(WPEInjectedBundle WebKit)
315
316 target_include_directories(WPEInjectedBundle PRIVATE ${WebKit_INCLUDE_DIRECTORIES})
317 target_include_directories(WPEInjectedBundle SYSTEM PRIVATE ${WebKit_SYSTEM_INCLUDE_DIRECTORIES})
318
319 file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-wpe.cfg
320     "[wpe-${WPE_API_VERSION}]\n"
321     "pkgconfig_file=${WPE_PKGCONFIG_FILE}\n"
322     "decorator=WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\\(.+\\)\n"
323     "deprecation_guard=WEBKIT_DISABLE_DEPRECATED\n"
324     "namespace=webkit\n"
325     "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
326     "       -I${WEBKIT_DIR}/Shared/API/glib\n"
327     "       -I${WEBKIT_DIR}/UIProcess/API/glib\n"
328     "       -I${WEBKIT_DIR}/UIProcess/API/wpe\n"
329     "       -I${FORWARDING_HEADERS_WPE_DIR}\n"
330     "doc_dir=${WEBKIT_DIR}/UIProcess/API/wpe/docs\n"
331     "source_dirs=${WEBKIT_DIR}/Shared/API/glib\n"
332     "            ${WEBKIT_DIR}/UIProcess/API/glib\n"
333     "            ${WEBKIT_DIR}/UIProcess/API/wpe\n"
334     "            ${DERIVED_SOURCES_WPE_API_DIR}\n"
335     "headers=${WPE_ENUM_GENERATION_HEADERS}\n"
336     "main_sgml_file=wpe-docs.sgml\n"
337 )
338
339 file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-webextensions.cfg
340     "[wpe-webextensions-${WPE_API_VERSION}]\n"
341     "pkgconfig_file=${WPEWebExtension_PKGCONFIG_FILE}\n"
342     "decorator=WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\\(.+\\)\n"
343     "deprecation_guard=WEBKIT_DISABLE_DEPRECATED\n"
344     "namespace=webkit_webextensions\n"
345     "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
346     "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe\n"
347     "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM\n"
348     "       -I${FORWARDING_HEADERS_WPE_DIR}\n"
349     "doc_dir=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/docs\n"
350     "source_dirs=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib\n"
351     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/DOM\n"
352     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe\n"
353     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM\n"
354     "headers=${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS}\n"
355     "main_sgml_file=wpe-webextensions-docs.sgml\n"
356 )
357
358 if (ENABLE_WPE_QT_API)
359     set(qtwpe_SOURCES
360         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp
361         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp
362         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtView.cpp
363         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp
364     )
365
366     set(qtwpe_LIBRARIES
367         Qt5::Core Qt5::Quick
368         WebKit
369         ${LIBEPOXY_LIBRARIES}
370         ${WPE_BACKEND_FDO_LIBRARIES}
371     )
372
373     set(qtwpe_INCLUDE_DIRECTORIES
374         ${Qt5_INCLUDE_DIRS}
375         ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
376         ${LIBEPOXY_INCLUDE_DIRS}
377         ${WPE_BACKEND_FDO_INCLUDE_DIRS}
378     )
379
380     list(APPEND WPE_API_INSTALLED_HEADERS
381         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtView.h
382         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h
383     )
384
385     add_library(qtwpe SHARED ${qtwpe_SOURCES})
386     set_target_properties(qtwpe PROPERTIES
387         OUTPUT_NAME qtwpe
388         AUTOMOC ON
389         CXX_STANDARD 14
390     )
391     target_compile_definitions(qtwpe PUBLIC QT_NO_KEYWORDS=1)
392     target_link_libraries(qtwpe ${qtwpe_LIBRARIES})
393     target_include_directories(qtwpe SYSTEM PRIVATE ${qtwpe_INCLUDE_DIRECTORIES})
394     install(TARGETS qtwpe DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qml/org/wpewebkit/qtwpe/")
395     install(FILES ${WEBKIT_DIR}/UIProcess/API/wpe/qt/qmldir DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qml/org/wpewebkit/qtwpe/")
396
397     file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
398     add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
399         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libqtwpe.so
400         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
401     add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
402         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/qmldir
403         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
404 endif ()
405
406 install(TARGETS WPEInjectedBundle
407         DESTINATION "${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}/injected-bundle"
408 )
409
410 install(FILES "${CMAKE_BINARY_DIR}/wpe-webkit-${WPE_API_VERSION}.pc"
411               "${CMAKE_BINARY_DIR}/wpe-web-extension-${WPE_API_VERSION}.pc"
412         DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
413         COMPONENT "Development"
414 )
415
416 install(FILES ${WPE_API_INSTALLED_HEADERS}
417               ${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS}
418         DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-webkit-${WPE_API_VERSION}/wpe"
419         COMPONENT "Development"
420 )