Unreviewed, reverting r260672.
[WebKit.git] / Source / WebKit / PlatformWPE.cmake
1 include(InspectorGResources.cmake)
2 include(GNUInstallDirs)
3
4 set(WebKit_OUTPUT_NAME WPEWebKit-${WPE_API_VERSION})
5 set(WebProcess_OUTPUT_NAME WPEWebProcess)
6 set(NetworkProcess_OUTPUT_NAME WPENetworkProcess)
7 set(GPUProcess_OUTPUT_NAME WPEGPUProcess)
8
9 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WPE_API_DIR})
10 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_DIR})
11 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_EXTENSION_DIR})
12 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_DOM_DIR})
13
14 configure_file(UIProcess/API/wpe/WebKitVersion.h.in ${DERIVED_SOURCES_WPE_API_DIR}/WebKitVersion.h)
15 configure_file(wpe/wpe-webkit.pc.in ${WPE_PKGCONFIG_FILE} @ONLY)
16 configure_file(wpe/wpe-web-extension.pc.in ${WPEWebExtension_PKGCONFIG_FILE} @ONLY)
17
18 add_definitions(-DWEBKIT2_COMPILATION)
19
20 add_definitions(-DLIBDIR="${LIB_INSTALL_DIR}")
21 add_definitions(-DPKGLIBDIR="${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}")
22 add_definitions(-DPKGLIBEXECDIR="${LIBEXEC_INSTALL_DIR}")
23 add_definitions(-DDATADIR="${CMAKE_INSTALL_FULL_DATADIR}")
24 add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
25
26 if (NOT DEVELOPER_MODE AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
27     WEBKIT_ADD_TARGET_PROPERTIES(WebKit LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/webkitglib-symbols.map")
28 endif ()
29
30 set(WebKit_USE_PREFIX_HEADER ON)
31
32 add_custom_target(webkitwpe-forwarding-headers
33     COMMAND ${PERL_EXECUTABLE} ${WEBKIT_DIR}/Scripts/generate-forwarding-headers.pl --include-path ${WEBKIT_DIR} --output ${FORWARDING_HEADERS_DIR} --platform wpe --platform soup
34 )
35
36  # These symbolic link allows includes like #include <wpe/WebkitWebView.h> which simulates installed headers.
37 add_custom_command(
38     OUTPUT ${FORWARDING_HEADERS_WPE_DIR}/wpe
39     DEPENDS ${WEBKIT_DIR}/UIProcess/API/wpe
40     COMMAND ln -n -s -f ${WEBKIT_DIR}/UIProcess/API/wpe ${FORWARDING_HEADERS_WPE_DIR}/wpe
41 )
42
43 add_custom_command(
44     OUTPUT ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
45     DEPENDS ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe
46     COMMAND ln -n -s -f ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
47 )
48
49 add_custom_command(
50     OUTPUT ${FORWARDING_HEADERS_WPE_DOM_DIR}/wpe
51     DEPENDS ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM
52     COMMAND ln -n -s -f ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM ${FORWARDING_HEADERS_WPE_DOM_DIR}/wpe
53     VERBATIM
54 )
55
56 add_custom_target(webkitwpe-fake-api-headers
57     DEPENDS ${FORWARDING_HEADERS_WPE_DIR}/wpe
58             ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
59             ${FORWARDING_HEADERS_WPE_DOM_DIR}/wpe
60 )
61
62 list(APPEND WebKit_DEPENDENCIES
63     webkitwpe-fake-api-headers
64     webkitwpe-forwarding-headers
65 )
66
67 list(APPEND WebProcess_SOURCES
68     WebProcess/EntryPoint/unix/WebProcessMain.cpp
69 )
70
71 list(APPEND NetworkProcess_SOURCES
72     NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp
73 )
74
75 list(APPEND GPUProcess_SOURCES
76     GPUProcess/EntryPoint/unix/GPUProcessMain.cpp
77 )
78
79 list(APPEND WebKit_UNIFIED_SOURCE_LIST_FILES
80     "SourcesWPE.txt"
81 )
82
83 list(APPEND WebKit_DERIVED_SOURCES
84     ${WebKit_DERIVED_SOURCES_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/WebKitAutocleanups.h
96     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitAutomationSession.h
97     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitBackForwardList.h
98     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitBackForwardListItem.h
99     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitCredential.h
100     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitColor.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/WebKitGeolocationManager.h
116     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitGeolocationPermissionRequest.h
117     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitHitTestResult.h
118     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitInputMethodContext.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/WebKitOptionMenu.h
128     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitOptionMenuItem.h
129     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPermissionRequest.h
130     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPlugin.h
131     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitPolicyDecision.h
132     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitRectangle.h
133     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitResponsePolicyDecision.h
134     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitScriptDialog.h
135     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSecurityManager.h
136     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSecurityOrigin.h
137     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitSettings.h
138     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIRequest.h
139     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIResponse.h
140     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURISchemeRequest.h
141     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIUtilities.h
142     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContent.h
143     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContentFilterStore.h
144     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContentManager.h
145     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserMediaPermissionRequest.h
146     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserMessage.h
147     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebContext.h
148     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebResource.h
149     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebView.h
150     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewBackend.h
151     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebViewSessionState.h
152     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebsiteData.h
153     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWebsiteDataManager.h
154     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitWindowProperties.h
155     ${WEBKIT_DIR}/UIProcess/API/wpe/webkit.h
156 )
157
158 set(WPE_WEB_EXTENSION_API_INSTALLED_HEADERS
159     ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
160     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h
161     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitFrame.h
162     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h
163     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h
164     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h
165     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h
166     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebHitTestResult.h
167     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h
168     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h
169     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/webkitdom.h
170     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDefines.h
171     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDocument.h
172     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMElement.h
173     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMNode.h
174     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMObject.h
175 )
176
177 # To generate WebKitEnumTypes.h we want to use all installed headers, except WebKitEnumTypes.h itself.
178 set(WPE_ENUM_GENERATION_HEADERS ${WPE_API_INSTALLED_HEADERS})
179 list(REMOVE_ITEM WPE_ENUM_GENERATION_HEADERS ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h)
180 add_custom_command(
181     OUTPUT ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.h
182            ${DERIVED_SOURCES_WPE_API_DIR}/WebKitEnumTypes.cpp
183     DEPENDS ${WPE_ENUM_GENERATION_HEADERS}
184
185     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
186
187     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
188     VERBATIM
189 )
190
191 set(WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS ${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS})
192 list(REMOVE_ITEM WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h)
193 add_custom_command(
194     OUTPUT ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.h
195            ${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.cpp
196     DEPENDS ${WPE_WEB_PROCESS_ENUM_GENERATION_HEADERS}
197
198     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
199
200     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
201     VERBATIM
202 )
203
204 set(WebKitResources
205 )
206
207 if (ENABLE_WEB_AUDIO)
208     list(APPEND WebKitResources
209         "        <file alias=\"audio/Composite\">Composite.wav</file>\n"
210     )
211 endif ()
212
213 file(WRITE ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.xml
214     "<?xml version=1.0 encoding=UTF-8?>\n"
215     "<gresources>\n"
216     "    <gresource prefix=\"/org/webkitwpe/resources\">\n"
217     ${WebKitResources}
218     "    </gresource>\n"
219     "</gresources>\n"
220 )
221
222 add_custom_command(
223     OUTPUT ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
224     DEPENDS ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.xml
225     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
226     VERBATIM
227 )
228
229 list(APPEND WebKit_INCLUDE_DIRECTORIES
230     "${DERIVED_SOURCES_JAVASCRIPCOREWPE_DIR}"
231     "${FORWARDING_HEADERS_DIR}"
232     "${FORWARDING_HEADERS_DIR}/JavaScriptCore/"
233     "${FORWARDING_HEADERS_DIR}/JavaScriptCore/glib"
234     "${FORWARDING_HEADERS_WPE_DIR}"
235     "${FORWARDING_HEADERS_WPE_EXTENSION_DIR}"
236     "${FORWARDING_HEADERS_WPE_DOM_DIR}"
237     "${DERIVED_SOURCES_DIR}"
238     "${DERIVED_SOURCES_WPE_API_DIR}"
239     "${WEBKIT_DIR}/NetworkProcess/glib"
240     "${WEBKIT_DIR}/NetworkProcess/soup"
241     "${WEBKIT_DIR}/Platform/IPC/glib"
242     "${WEBKIT_DIR}/Platform/IPC/unix"
243     "${WEBKIT_DIR}/Platform/classifier"
244     "${WEBKIT_DIR}/Shared/API/c/wpe"
245     "${WEBKIT_DIR}/Shared/API/glib"
246     "${WEBKIT_DIR}/Shared/CoordinatedGraphics"
247     "${WEBKIT_DIR}/Shared/CoordinatedGraphics/threadedcompositor"
248     "${WEBKIT_DIR}/Shared/glib"
249     "${WEBKIT_DIR}/Shared/libwpe"
250     "${WEBKIT_DIR}/Shared/soup"
251     "${WEBKIT_DIR}/UIProcess/API/C/cairo"
252     "${WEBKIT_DIR}/UIProcess/API/C/wpe"
253     "${WEBKIT_DIR}/UIProcess/API/glib"
254     "${WEBKIT_DIR}/UIProcess/API/wpe"
255     "${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
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/WebCoreSupport/soup"
267     "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics"
268     "${WEBKIT_DIR}/WebProcess/WebPage/atk"
269     "${WEBKIT_DIR}/WebProcess/WebPage/libwpe"
270     "${WEBKIT_DIR}/WebProcess/WebPage/wpe"
271     "${WTF_DIR}/wtf/gtk/"
272     "${WTF_DIR}/wtf/gobject"
273     "${WTF_DIR}"
274 )
275
276 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
277     ${ATK_INCLUDE_DIRS}
278     ${ATK_BRIDGE_INCLUDE_DIRS}
279     ${GIO_UNIX_INCLUDE_DIRS}
280     ${GLIB_INCLUDE_DIRS}
281     ${GSTREAMER_INCLUDE_DIRS}
282     ${GSTREAMER_AUDIO_INCLUDE_DIRS}
283     ${GSTREAMER_PBUTILS_INCLUDE_DIRS}
284     ${GSTREAMER_VIDEO_INCLUDE_DIRS}
285     ${LIBSECCOMP_INCLUDE_DIRS}
286     ${LIBSOUP_INCLUDE_DIRS}
287 )
288
289 list(APPEND WebKit_LIBRARIES
290     Cairo::Cairo
291     Freetype::Freetype
292     HarfBuzz::HarfBuzz
293     HarfBuzz::ICU
294     WPE::libwpe
295     ${ATK_LIBRARIES}
296     ${ATK_BRIDGE_LIBRARIES}
297     ${GLIB_LIBRARIES}
298     ${GLIB_GMODULE_LIBRARIES}
299     ${GSTREAMER_LIBRARIES}
300     ${LIBSECCOMP_LIBRARIES}
301     ${LIBSOUP_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} ${WebKit_PRIVATE_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         ${CMAKE_BINARY_DIR}
386         ${Qt5_INCLUDE_DIRS}
387         ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
388         ${LIBEPOXY_INCLUDE_DIRS}
389         ${WPEBACKEND_FDO_INCLUDE_DIRS}
390     )
391
392     list(APPEND WPE_API_INSTALLED_HEADERS
393         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtView.h
394         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h
395     )
396
397     add_library(qtwpe SHARED ${qtwpe_SOURCES})
398     set_target_properties(qtwpe PROPERTIES
399         OUTPUT_NAME qtwpe
400         AUTOMOC ON
401     )
402     target_compile_definitions(qtwpe PUBLIC QT_NO_KEYWORDS=1)
403     target_link_libraries(qtwpe ${qtwpe_LIBRARIES})
404     target_include_directories(qtwpe SYSTEM PRIVATE ${qtwpe_INCLUDE_DIRECTORIES})
405     install(TARGETS qtwpe DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qt5/qml/org/wpewebkit/qtwpe/")
406     install(FILES ${WEBKIT_DIR}/UIProcess/API/wpe/qt/qmldir DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qt5/qml/org/wpewebkit/qtwpe/")
407
408     file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qt5/qml/org/wpewebkit/qtwpe)
409     add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
410         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libqtwpe.so
411         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qt5/qml/org/wpewebkit/qtwpe)
412     add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
413         ${WEBKIT_DIR}/UIProcess/API/wpe/qt/qmldir
414         ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qt5/qml/org/wpewebkit/qtwpe)
415 endif ()
416
417 install(TARGETS WPEInjectedBundle
418         DESTINATION "${LIB_INSTALL_DIR}/wpe-webkit-${WPE_API_VERSION}/injected-bundle"
419 )
420
421 install(FILES "${CMAKE_BINARY_DIR}/wpe-webkit-${WPE_API_VERSION}.pc"
422               "${CMAKE_BINARY_DIR}/wpe-web-extension-${WPE_API_VERSION}.pc"
423         DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
424         COMPONENT "Development"
425 )
426
427 install(FILES ${WPE_API_INSTALLED_HEADERS}
428               ${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS}
429         DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-webkit-${WPE_API_VERSION}/wpe"
430         COMPONENT "Development"
431 )