570a41cb5d8359629d5c8817e6a7e875332a837c
[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_MESSAGES_IN_FILES
79     NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in
80
81     UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in
82 )
83
84 list(APPEND WebKit_DERIVED_SOURCES
85     ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
86
87     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.cpp
88     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.cpp
89 )
90
91 set(WPE_API_INSTALLED_HEADERS
92     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h
93     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitVersion.h
94     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitApplicationInfo.h
95     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitAuthenticationRequest.h
96     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitAutocleanups.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/WebKitColor.h
102     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenu.h
103     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenuActions.h
104     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenuItem.h
105     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitCookieManager.h
106     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDefines.h
107     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h
108     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitDownload.h
109     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitEditingCommands.h
110     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitEditorState.h
111     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitError.h
112     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFaviconDatabase.h
113     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFileChooserRequest.h
114     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFindController.h
115     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitFormSubmissionRequest.h
116     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitGeolocationManager.h
117     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitGeolocationPermissionRequest.h
118     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitHitTestResult.h
119     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitInstallMissingMediaPluginsPermissionRequest.h
120     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitJavascriptResult.h
121     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitMimeInfo.h
122     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNavigationAction.h
123     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNavigationPolicyDecision.h
124     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNetworkProxySettings.h
125     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNotificationPermissionRequest.h
126     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitNotification.h
127     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPermissionRequest.h
128     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPlugin.h
129     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPolicyDecision.h
130     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitResponsePolicyDecision.h
131     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitScriptDialog.h
132     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSecurityManager.h
133     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSecurityOrigin.h
134     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSettings.h
135     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIRequest.h
136     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIResponse.h
137     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURISchemeRequest.h
138     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIUtilities.h
139     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContent.h
140     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContentFilterStore.h
141     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContentManager.h
142     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserMediaPermissionRequest.h
143     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebContext.h
144     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebResource.h
145     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebView.h
146     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewBackend.h
147     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewSessionState.h
148     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebsiteData.h
149     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebsiteDataManager.h
150     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWindowProperties.h
151     ${WEBKIT_DIR}/UIProcess/API/wpe/webkit.h
152 )
153
154 set(WPE_WEB_EXTENSION_API_INSTALLED_HEADERS
155     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
156     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h
157     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitFrame.h
158     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h
159     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h
160     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h
161     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h
162     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebHitTestResult.h
163     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h
164     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h
165     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/webkitdom.h
166     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDefines.h
167     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDocument.h
168     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMElement.h
169     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMNode.h
170     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMObject.h
171 )
172
173 # To generate WebKitEnumTypes.h we want to use all installed headers, except WebKitEnumTypes.h itself.
174 set(WPE_ENUM_GENERATION_HEADERS ${WPE_API_INSTALLED_HEADERS})
175 list(REMOVE_ITEM WPE_ENUM_GENERATION_HEADERS ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h)
176 add_custom_command(
177     OUTPUT ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h
178            ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.cpp
179     DEPENDS ${WPE_ENUM_GENERATION_HEADERS}
180
181     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
182
183     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
184     VERBATIM
185 )
186
187 set(WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS ${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS})
188 list(REMOVE_ITEM WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h)
189 add_custom_command(
190     OUTPUT ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
191            ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.cpp
192     DEPENDS ${WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS}
193
194     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
195
196     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
197     VERBATIM
198 )
199
200 set(WebKitResources
201 )
202
203 if (ENABLE_WEB_AUDIO)
204     list(APPEND WebKitResources
205         "        <file alias=\"audio/Composite\">Composite.wav</file>\n"
206     )
207 endif ()
208
209 file(WRITE ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.xml
210     "<?xml version=1.0 encoding=UTF-8?>\n"
211     "<gresources>\n"
212     "    <gresource prefix=\"/org/webkitwpe/resources\">\n"
213     ${WebKitResources}
214     "    </gresource>\n"
215     "</gresources>\n"
216 )
217
218 add_custom_command(
219     OUTPUT ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
220     DEPENDS ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.xml
221     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
222     VERBATIM
223 )
224
225 list(APPEND WebKit_INCLUDE_DIRECTORIES
226     "${DERIVED_SOURCES_JAVASCRIPCOREWPE_DIR}"
227     "${FORWARDING_HEADERS_DIR}"
228     "${FORWARDING_HEADERS_DIR}/JavaScriptCore/"
229     "${FORWARDING_HEADERS_DIR}/JavaScriptCore/glib"
230     "${FORWARDING_HEADERS_WPE_DIR}"
231     "${FORWARDING_HEADERS_WPE_EXTENSION_DIR}"
232     "${FORWARDING_HEADERS_WPE_DOM_DIR}"
233     "${DERIVED_SOURCES_DIR}"
234     "${DERIVED_SOURCES_WPE_API_DIR}"
235     "${WEBKIT_DIR}/NetworkProcess/CustomProtocols/soup"
236     "${WEBKIT_DIR}/NetworkProcess/glib"
237     "${WEBKIT_DIR}/NetworkProcess/soup"
238     "${WEBKIT_DIR}/NetworkProcess/unix"
239     "${WEBKIT_DIR}/Platform/IPC/glib"
240     "${WEBKIT_DIR}/Platform/IPC/unix"
241     "${WEBKIT_DIR}/Platform/classifier"
242     "${WEBKIT_DIR}/Shared/API/c/wpe"
243     "${WEBKIT_DIR}/Shared/API/glib"
244     "${WEBKIT_DIR}/Shared/CoordinatedGraphics"
245     "${WEBKIT_DIR}/Shared/CoordinatedGraphics/threadedcompositor"
246     "${WEBKIT_DIR}/Shared/glib"
247     "${WEBKIT_DIR}/Shared/libwpe"
248     "${WEBKIT_DIR}/Shared/soup"
249     "${WEBKIT_DIR}/Shared/unix"
250     "${WEBKIT_DIR}/UIProcess/API/C/cairo"
251     "${WEBKIT_DIR}/UIProcess/API/C/wpe"
252     "${WEBKIT_DIR}/UIProcess/API/glib"
253     "${WEBKIT_DIR}/UIProcess/API/wpe"
254     "${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
255     "${WEBKIT_DIR}/UIProcess/Network/CustomProtocols/soup"
256     "${WEBKIT_DIR}/UIProcess/geoclue"
257     "${WEBKIT_DIR}/UIProcess/gstreamer"
258     "${WEBKIT_DIR}/UIProcess/linux"
259     "${WEBKIT_DIR}/UIProcess/soup"
260     "${WEBKIT_DIR}/UIProcess/wpe"
261     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib"
262     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/DOM"
263     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe"
264     "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM"
265     "${WEBKIT_DIR}/WebProcess/soup"
266     "${WEBKIT_DIR}/WebProcess/unix"
267     "${WEBKIT_DIR}/WebProcess/WebCoreSupport/soup"
268     "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics"
269     "${WEBKIT_DIR}/WebProcess/WebPage/atk"
270     "${WEBKIT_DIR}/WebProcess/WebPage/libwpe"
271     "${WEBKIT_DIR}/WebProcess/WebPage/wpe"
272     "${WTF_DIR}/wtf/gtk/"
273     "${WTF_DIR}/wtf/gobject"
274     "${WTF_DIR}"
275 )
276
277 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
278     ${ATK_INCLUDE_DIRS}
279     ${ATK_BRIDGE_INCLUDE_DIRS}
280     ${CAIRO_INCLUDE_DIRS}
281     ${FREETYPE_INCLUDE_DIRS}
282     ${GLIB_INCLUDE_DIRS}
283     ${GSTREAMER_INCLUDE_DIRS}
284     ${HARFBUZZ_INCLUDE_DIRS}
285     ${LIBSECCOMP_INCLUDE_DIRS}
286     ${LIBSOUP_INCLUDE_DIRS}
287     ${WPE_INCLUDE_DIRS}
288 )
289
290 list(APPEND WebKit_LIBRARIES
291     ${ATK_LIBRARIES}
292     ${ATK_BRIDGE_LIBRARIES}
293     ${CAIRO_LIBRARIES}
294     ${FREETYPE_LIBRARIES}
295     ${GLIB_LIBRARIES}
296     ${GLIB_GMODULE_LIBRARIES}
297     ${GSTREAMER_LIBRARIES}
298     ${HARFBUZZ_LIBRARIES}
299     ${LIBSECCOMP_LIBRARIES}
300     ${LIBSOUP_LIBRARIES}
301     ${WPE_LIBRARIES}
302 )
303
304 WEBKIT_BUILD_INSPECTOR_GRESOURCES(${DERIVED_SOURCES_WEBINSPECTORUI_DIR})
305 list(APPEND WPEWebInspectorResources_DERIVED_SOURCES
306     ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c
307 )
308
309 list(APPEND WPEWebInspectorResources_LIBRARIES
310     ${GLIB_GIO_LIBRARIES}
311 )
312
313 list(APPEND WPEWebInspectorResources_SYSTEM_INCLUDE_DIRECTORIES
314     ${GLIB_INCLUDE_DIRS}
315 )
316
317 add_library(WPEWebInspectorResources SHARED ${WPEWebInspectorResources_DERIVED_SOURCES})
318 add_dependencies(WPEWebInspectorResources WebKit)
319 target_link_libraries(WPEWebInspectorResources ${WPEWebInspectorResources_LIBRARIES})
320 target_include_directories(WPEWebInspectorResources SYSTEM PUBLIC ${WPEWebInspectorResources_SYSTEM_INCLUDE_DIRECTORIES})
321 install(TARGETS WPEWebInspectorResources DESTINATION "${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}")
322
323 add_library(WPEInjectedBundle MODULE "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/WebKitInjectedBundleMain.cpp")
324 ADD_WEBKIT_PREFIX_HEADER(WPEInjectedBundle)
325 target_link_libraries(WPEInjectedBundle WebKit)
326
327 target_include_directories(WPEInjectedBundle PRIVATE ${WebKit_INCLUDE_DIRECTORIES})
328 target_include_directories(WPEInjectedBundle SYSTEM PRIVATE ${WebKit_SYSTEM_INCLUDE_DIRECTORIES})
329
330 file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-wpe.cfg
331     "[wpe-${WPE_API_VERSION}]\n"
332     "pkgconfig_file=${WPE_PKGCONFIG_FILE}\n"
333     "decorator=WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\\(.+\\)\n"
334     "deprecation_guard=WEBKIT_DISABLE_DEPRECATED\n"
335     "namespace=webkit\n"
336     "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
337     "       -I${WEBKIT_DIR}/Shared/API/glib\n"
338     "       -I${WEBKIT_DIR}/UIProcess/API/glib\n"
339     "       -I${WEBKIT_DIR}/UIProcess/API/wpe\n"
340     "       -I${FORWARDING_HEADERS_WPE_DIR}\n"
341     "doc_dir=${WEBKIT_DIR}/UIProcess/API/wpe/docs\n"
342     "source_dirs=${WEBKIT_DIR}/Shared/API/glib\n"
343     "            ${WEBKIT_DIR}/UIProcess/API/glib\n"
344     "            ${WEBKIT_DIR}/UIProcess/API/wpe\n"
345     "            ${DERIVED_SOURCES_WPE_API_DIR}\n"
346     "headers=${WPE_ENUM_GENERATION_HEADERS}\n"
347     "main_sgml_file=wpe-docs.sgml\n"
348 )
349
350 file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-webextensions.cfg
351     "[wpe-webextensions-${WPE_API_VERSION}]\n"
352     "pkgconfig_file=${WPEWebExtension_PKGCONFIG_FILE}\n"
353     "decorator=WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\\(.+\\)\n"
354     "deprecation_guard=WEBKIT_DISABLE_DEPRECATED\n"
355     "namespace=webkit_webextensions\n"
356     "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
357     "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe\n"
358     "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM\n"
359     "       -I${FORWARDING_HEADERS_WPE_DIR}\n"
360     "doc_dir=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/docs\n"
361     "source_dirs=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib\n"
362     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/DOM\n"
363     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe\n"
364     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM\n"
365     "headers=${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS}\n"
366     "main_sgml_file=wpe-webextensions-docs.sgml\n"
367 )
368
369 if (ENABLE_WPE_QT_API)
370     set(qtwpe_SOURCES
371         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp
372         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp
373         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtView.cpp
374         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp
375     )
376
377     set(qtwpe_LIBRARIES
378         Qt5::Core Qt5::Quick
379         WebKit
380         ${LIBEPOXY_LIBRARIES}
381         ${WPEBACKEND_FDO_LIBRARIES}
382     )
383
384     set(qtwpe_INCLUDE_DIRECTORIES
385         ${Qt5_INCLUDE_DIRS}
386         ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
387         ${LIBEPOXY_INCLUDE_DIRS}
388         ${WPEBACKEND_FDO_INCLUDE_DIRS}
389     )
390
391     list(APPEND WPE_API_INSTALLED_HEADERS
392         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtView.h
393         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h
394     )
395
396     add_library(qtwpe SHARED ${qtwpe_SOURCES})
397     set_target_properties(qtwpe PROPERTIES
398         OUTPUT_NAME qtwpe
399         AUTOMOC ON
400     )
401     target_compile_definitions(qtwpe PUBLIC QT_NO_KEYWORDS=1)
402     target_link_libraries(qtwpe ${qtwpe_LIBRARIES})
403     target_include_directories(qtwpe SYSTEM PRIVATE ${qtwpe_INCLUDE_DIRECTORIES})
404     install(TARGETS qtwpe DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qml/org/wpewebkit/qtwpe/")
405     install(FILES ${WEBKIT_DIR}/UIProcess/API/wpe/qt/qmldir DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qml/org/wpewebkit/qtwpe/")
406
407     file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
408     add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
409         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libqtwpe.so
410         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
411     add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
412         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/qmldir
413         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe)
414 endif ()
415
416 install(TARGETS WPEInjectedBundle
417         DESTINATION "${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}/injected-bundle"
418 )
419
420 install(FILES "${CMAKE_BINARY_DIR}/wpe-webkit-${WPE_API_VERSION}.pc"
421               "${CMAKE_BINARY_DIR}/wpe-web-extension-${WPE_API_VERSION}.pc"
422         DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
423         COMPONENT "Development"
424 )
425
426 install(FILES ${WPE_API_INSTALLED_HEADERS}
427               ${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS}
428         DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-webkit-${WPE_API_VERSION}/wpe"
429         COMPONENT "Development"
430 )