f8805d71c0eb1dcdada9622995fac7e25deaebbb
[WebKit-https.git] / Source / WebKit / PlatformGTK.cmake
1 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKITGTK_DIR})
2 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKITGTK_API_DIR})
3 configure_file(gtk/webkit/webkitversion.h.in ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitversion.h)
4 configure_file(gtk/webkit.pc.in ${WebKit_PKGCONFIG_FILE} @ONLY)
5
6 add_definitions(-DPACKAGE_LOCALE_DIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
7
8 list(APPEND WebKit_INCLUDE_DIRECTORIES
9     ${DERIVED_SOURCES_DIR}
10     ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
11     ${DERIVED_SOURCES_WEBKITGTK_DIR}
12     ${DERIVED_SOURCES_WEBKITGTK_API_DIR}
13     ${THIRDPARTY_DIR}/ANGLE/include/GLSLANG
14     ${THIRDPARTY_DIR}/ANGLE/src
15     ${THIRDPARTY_DIR}/ANGLE/include
16     ${THIRDPARTY_DIR}/ANGLE/include/KHR
17     ${THIRDPARTY_DIR}/ANGLE/include/GLSLANG
18     ${WEBCORE_DIR}/ForwardingHeaders
19     ${WEBCORE_DIR}/accessibility/atk
20     ${WEBCORE_DIR}/platform/cairo
21     ${WEBCORE_DIR}/platform/geoclue
22     ${WEBCORE_DIR}/platform/graphics/cairo
23     ${WEBCORE_DIR}/platform/graphics/gtk
24     ${WEBCORE_DIR}/platform/graphics/opentype
25     ${WEBCORE_DIR}/platform/graphics/texmap
26     ${WEBCORE_DIR}/platform/gtk
27     ${WEBCORE_DIR}/platform/network/soup
28     ${WEBCORE_DIR}/platform/text/enchant
29     ${WEBKIT_DIR}/gtk
30     ${WEBKIT_DIR}/gtk/webkit
31     ${WEBKIT_DIR}/gtk/WebCoreSupport
32     ${ENCHANT_INCLUDE_DIRS}
33     ${GEOCLUE_INCLUDE_DIRS}
34     ${GTK_INCLUDE_DIRS}
35     ${LIBSOUP_INCLUDE_DIRS}
36 )
37
38 list(APPEND WebKit_SOURCES
39     ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.cpp
40     ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitmarshal.cpp
41
42     gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
43     gtk/WebCoreSupport/ChromeClientGtk.cpp
44     gtk/WebCoreSupport/ContextMenuClientGtk.cpp
45     gtk/WebCoreSupport/DeviceMotionClientGtk.cpp
46     gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp
47     gtk/WebCoreSupport/DocumentLoaderGtk.cpp
48     gtk/WebCoreSupport/DragClientGtk.cpp
49     gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
50     gtk/WebCoreSupport/EditorClientGtk.cpp
51     gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
52     gtk/WebCoreSupport/FrameNetworkingContextGtk.cpp
53     gtk/WebCoreSupport/GeolocationClientGtk.cpp
54     gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp
55     gtk/WebCoreSupport/InspectorClientGtk.cpp
56     gtk/WebCoreSupport/NavigatorContentUtilsClientGtk.cpp
57     gtk/WebCoreSupport/PlatformStrategiesGtk.cpp
58     gtk/WebCoreSupport/ProgressTrackerClientGtk.cpp
59     gtk/WebCoreSupport/TextCheckerClientGtk.cpp
60     gtk/WebCoreSupport/UserMediaClientGtk.cpp
61     gtk/WebCoreSupport/WebViewInputMethodFilter.cpp
62
63     gtk/webkit/webkitapplicationcache.cpp
64     gtk/webkit/webkitauthenticationdialog.cpp
65     gtk/webkit/webkitdownload.cpp
66     gtk/webkit/webkiterror.cpp
67     gtk/webkit/webkitfavicondatabase.cpp
68     gtk/webkit/webkitfilechooserrequest.cpp
69     gtk/webkit/webkitgeolocationpolicydecision.cpp
70     gtk/webkit/webkitglobals.cpp
71     gtk/webkit/webkithittestresult.cpp
72     gtk/webkit/webkiticondatabase.cpp
73     gtk/webkit/webkitnetworkrequest.cpp
74     gtk/webkit/webkitnetworkresponse.cpp
75     gtk/webkit/webkitsecurityorigin.cpp
76     gtk/webkit/webkitsoupauthdialog.cpp
77     gtk/webkit/webkitspellchecker.cpp
78     gtk/webkit/webkitspellcheckerenchant.cpp
79     gtk/webkit/webkitversion.cpp
80     gtk/webkit/webkitviewportattributes.cpp
81     gtk/webkit/webkitwebbackforwardlist.cpp
82     gtk/webkit/webkitwebdatabase.cpp
83     gtk/webkit/webkitwebdatasource.cpp
84     gtk/webkit/webkitwebframe.cpp
85     gtk/webkit/webkitwebhistoryitem.cpp
86     gtk/webkit/webkitwebinspector.cpp
87     gtk/webkit/webkitwebnavigationaction.cpp
88     gtk/webkit/webkitwebplugin.cpp
89     gtk/webkit/webkitwebplugindatabase.cpp
90     gtk/webkit/webkitwebpolicydecision.cpp
91     gtk/webkit/webkitwebresource.cpp
92     gtk/webkit/webkitwebsettings.cpp
93     gtk/webkit/webkitwebview.cpp
94     gtk/webkit/webkitwebwindowfeatures.cpp
95 )
96
97 list(APPEND WebKitGTK_INSTALLED_HEADERS
98     ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.h
99     ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitversion.h
100     ${WEBKIT_DIR}/gtk/webkit/webkit.h
101     ${WEBKIT_DIR}/gtk/webkit/webkitapplicationcache.h
102     ${WEBKIT_DIR}/gtk/webkit/webkitdefines.h
103     ${WEBKIT_DIR}/gtk/webkit/webkitdom.h
104     ${WEBKIT_DIR}/gtk/webkit/webkitdownload.h
105     ${WEBKIT_DIR}/gtk/webkit/webkiterror.h
106     ${WEBKIT_DIR}/gtk/webkit/webkitfavicondatabase.h
107     ${WEBKIT_DIR}/gtk/webkit/webkitfilechooserrequest.h
108     ${WEBKIT_DIR}/gtk/webkit/webkitgeolocationpolicydecision.h
109     ${WEBKIT_DIR}/gtk/webkit/webkitglobals.h
110     ${WEBKIT_DIR}/gtk/webkit/webkithittestresult.h
111     ${WEBKIT_DIR}/gtk/webkit/webkiticondatabase.h
112     ${WEBKIT_DIR}/gtk/webkit/webkitnetworkrequest.h
113     ${WEBKIT_DIR}/gtk/webkit/webkitnetworkresponse.h
114     ${WEBKIT_DIR}/gtk/webkit/webkitsecurityorigin.h
115     ${WEBKIT_DIR}/gtk/webkit/webkitsoupauthdialog.h
116     ${WEBKIT_DIR}/gtk/webkit/webkitspellchecker.h
117     ${WEBKIT_DIR}/gtk/webkit/webkitviewportattributes.h
118     ${WEBKIT_DIR}/gtk/webkit/webkitwebbackforwardlist.h
119     ${WEBKIT_DIR}/gtk/webkit/webkitwebdatabase.h
120     ${WEBKIT_DIR}/gtk/webkit/webkitwebdatasource.h
121     ${WEBKIT_DIR}/gtk/webkit/webkitwebframe.h
122     ${WEBKIT_DIR}/gtk/webkit/webkitwebhistoryitem.h
123     ${WEBKIT_DIR}/gtk/webkit/webkitwebinspector.h
124     ${WEBKIT_DIR}/gtk/webkit/webkitwebnavigationaction.h
125     ${WEBKIT_DIR}/gtk/webkit/webkitwebplugin.h
126     ${WEBKIT_DIR}/gtk/webkit/webkitwebplugindatabase.h
127     ${WEBKIT_DIR}/gtk/webkit/webkitwebpolicydecision.h
128     ${WEBKIT_DIR}/gtk/webkit/webkitwebresource.h
129     ${WEBKIT_DIR}/gtk/webkit/webkitwebsettings.h
130     ${WEBKIT_DIR}/gtk/webkit/webkitwebview.h
131     ${WEBKIT_DIR}/gtk/webkit/webkitwebwindowfeatures.h
132 )
133
134 # Since the GObjectDOMBindings convenience library exports API that is unused except
135 # in embedding applications we need to instruct the linker to link all symbols explicitly.
136 list(APPEND WebKit_LIBRARIES
137     -Wl,--whole-archive GObjectDOMBindings -Wl,--no-whole-archive
138     WebCorePlatformGTK
139 )
140
141 set(WebKit_MARSHAL_LIST ${WEBKIT_DIR}/gtk/webkitmarshal.list)
142
143 add_custom_command(
144     OUTPUT ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitmarshal.cpp
145            ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitmarshal.h
146     MAIN_DEPENDENCY ${WebKit_MARSHAL_LIST}
147
148     COMMAND echo extern \"C\" { > ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitmarshal.cpp
149     COMMAND glib-genmarshal --prefix=webkit_marshal ${WebKit_MARSHAL_LIST} --body >> ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitmarshal.cpp
150     COMMAND echo } >> ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitmarshal.cpp
151
152     COMMAND glib-genmarshal --prefix=webkit_marshal ${WebKit_MARSHAL_LIST} --header > ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitmarshal.h
153     VERBATIM
154 )
155
156 # To generate webkitenumtypes.h we want to use all installed headers, except webkitenumtypes.h itself.
157 set(WebKitGTK_ENUM_GENERATION_HEADERS ${WebKitGTK_INSTALLED_HEADERS})
158 list(REMOVE_ITEM WebKitGTK_ENUM_GENERATION_HEADERS ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.h)
159 add_custom_command(
160     OUTPUT ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.h
161            ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.cpp
162     DEPENDS ${WebKitGTK_ENUM_GENERATION_HEADERS}
163
164     COMMAND glib-mkenums --template ${WEBKIT_DIR}/gtk/webkit/webkitenumtypes.h.template ${WebKitGTK_ENUM_GENERATION_HEADERS} | sed s/web_kit/webkit/ | sed s/WEBKIT_TYPE_KIT/WEBKIT_TYPE/ > ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.h
165
166     COMMAND glib-mkenums --template ${WEBKIT_DIR}/gtk/webkit/webkitenumtypes.cpp.template ${WebKitGTK_ENUM_GENERATION_HEADERS} | sed s/web_kit/webkit/ > ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.cpp
167     VERBATIM
168 )
169
170 add_custom_command(
171     OUTPUT ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir
172     DEPENDS WebKit
173     DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
174     COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
175         ${INTROSPECTION_SCANNER}
176         --quiet
177         --warn-all
178         --symbol-prefix=webkit
179         --identifier-prefix=WebKit
180         --namespace=WebKit
181         --nsversion=${WEBKITGTK_API_VERSION}
182         --include=GObject-2.0
183         --include=Gtk-${WEBKITGTK_API_VERSION}
184         --include=Soup-2.4
185         --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
186         --library=webkitgtk-${WEBKITGTK_API_VERSION}
187         --library=javascriptcoregtk-${WEBKITGTK_API_VERSION}
188         -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
189         --no-libtool
190         --pkg=gobject-2.0
191         --pkg=gtk+-${WEBKITGTK_API_VERSION}
192         --pkg=libsoup-2.4
193         --pkg-export=webkitgtk-${WEBKITGTK_API_VERSION}
194         --output=${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir
195         --c-include="webkit/webkit.h"
196         -DBUILDING_WEBKIT
197         -I${CMAKE_SOURCE_DIR}/Source
198         -I${WEBKIT_DIR}/gtk
199         -I${JAVASCRIPTCORE_DIR}/ForwardingHeaders
200         -I${DERIVED_SOURCES_DIR}
201         -I${DERIVED_SOURCES_WEBKITGTK_DIR}
202         -I${WEBCORE_DIR}/platform/gtk
203         ${GObjectDOMBindings_GIR_HEADERS}
204         ${WebKitGTK_INSTALLED_HEADERS}
205         ${WEBKIT_DIR}/gtk/webkit/*.cpp
206 )
207
208 add_custom_command(
209     OUTPUT ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.typelib
210     DEPENDS ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir
211     COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir -o ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.typelib
212 )
213
214 ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.typelib)
215
216 install(FILES "${CMAKE_BINARY_DIR}/Source/WebKit/gtk/webkitgtk-${WEBKITGTK_API_VERSION}.pc"
217         DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
218 )
219 install(FILES "${WEBKIT_DIR}/gtk/resources/error.html"
220         DESTINATION "${DATA_INSTALL_DIR}/resources"
221 )
222 install(FILES ${WebKitGTK_INSTALLED_HEADERS}
223         DESTINATION "${WEBKITGTK_HEADER_INSTALL_DIR}/webkit"
224 )
225 install(FILES ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir
226         DESTINATION ${INTROSPECTION_INSTALL_GIRDIR}
227 )
228 install(FILES ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.typelib
229         DESTINATION ${INTROSPECTION_INSTALL_TYPELIBDIR}
230 )
231
232 file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-webkitgtk.cfg
233     "[webkitgtk]\n"
234     "pkgconfig_file=${WebKit_PKGCONFIG_FILE}\n"
235     "namespace=webkit\n"
236     "cflags=-I${DERIVED_SOURCES_DIR}\n"
237     "       -I${CMAKE_SOURCE_DIR}\n"
238     "       -I${CMAKE_SOURCE_DIR}/Source\n"
239     "       -I${CMAKE_SOURCE_DIR}/JavaScriptCore/ForwardingHeaders\n"
240     "doc_dir=${WEBKIT_DIR}/gtk/docs\n"
241     "source_dirs=${WEBKIT_DIR}/gtk/webkit\n"
242     "            ${DERIVED_SOURCES_WEBKITGTK_API_DIR}\n"
243     "headers=${WebKitGTK_ENUM_GENERATION_HEADERS}\n"
244 )