[chromium] Add WebPluginScrollbar and WebPluginScrollbarClient stub implementations
[WebKit-https.git] / Source / api.pri
1 # -------------------------------------------------------------------
2 # Project file for the QtWebKit C++ APIs
3 #
4 # See 'Tools/qmake/README' for an overview of the build system
5 # -------------------------------------------------------------------
6
7 TEMPLATE = lib
8 TARGET = QtWebKit
9
10 WEBKIT_DESTDIR = $${ROOT_BUILD_DIR}/lib
11
12 haveQt(5) {
13     # Use Qt5's module system
14     load(qt_module)
15     MODULE = webkit
16     MODULE_PRI = $$QT.webkit.module_pri
17     CONFIG += module
18
19     BASE_TARGET = $$TARGET
20
21     load(qt_module_config)
22
23     # Make sure the module config doesn't override our preferred build config.
24     debug_and_release:if(!debug|!release) {
25         # Removing debug_and_release causes issues with lib suffixes when building debug on Windows.
26         # Work around it by only removing build_all, and still create the Makefiles for both configurations.
27         win32*: CONFIG -= build_all
28         else: CONFIG -= debug_and_release
29     }
30
31     # Allow doing a debug-only build of WebKit (not supported by Qt)
32     macx:!debug_and_release:debug: TARGET = $$BASE_TARGET
33
34     # ---------------- Custom developer-build handling -------------------
35     #
36     # The assumption for Qt developer builds is that the module file
37     # will be put into qtbase/mkspecs/modules, and the libraries into
38     # qtbase/lib, with rpath/install_name set to the Qt lib dir.
39     #
40     # For WebKit we don't want that behavior for the libraries, as we want
41     # them to be self-contained in the WebKit build dir. To achive that we
42     # trick Qt into thinking it's not a developer build, but setting QTDIR
43     # to a bogus path in default_pre.prf.
44     #
45     # We still want the module file to live in the Qt dir so the module can
46     # be used by setting QT += webkit, so we copy the file manually. We also
47     # have to make sure the rpath/install_name of the libraries are relative
48     # to the webkit build dir.
49
50     !build_pass {
51         # Make a more accessible copy of the module forward file
52         # in the WebKit build directory.
53         convenience_module_path = $$toSystemPath($${ROOT_BUILD_DIR})$${QMAKE_DIR_SEP}modules
54         module_filename = $$basename(QT.webkit.module_pri)
55
56         # The QMAKE_EXTRA_MODULE_FORWARDS might contain more than one path,
57         # so we iterate the paths and find one that matches our build dir.
58         for(module_forward, QMAKE_EXTRA_MODULE_FORWARDS) {
59             in_build_dir = $$find(module_forward, ^$${ROOT_BUILD_DIR})
60             !isEmpty(in_build_dir) {
61                 webkit_module_forward = $$module_forward
62                 break()
63             }
64         }
65
66         isEmpty(webkit_module_forward) {
67             warning(Could not resolve QMAKE_EXTRA_MODULE_FORWARDS path!)
68         } else {
69             make_module_fwd_convenience.target = $$convenience_module_path$${QMAKE_DIR_SEP}$$module_filename
70             make_module_fwd_convenience.commands = $$QMAKE_MKDIR $$convenience_module_path \
71                 && echo \"include($$webkit_module_forward$${QMAKE_DIR_SEP}$$module_filename)\" > $$convenience_module_path$${QMAKE_DIR_SEP}$$module_filename
72             make_module_fwd_convenience.depends = $$webkit_module_forward$${QMAKE_DIR_SEP}$$module_filename
73
74             QMAKE_EXTRA_TARGETS += make_module_fwd_convenience
75             DEFAULT_TARGETS += make_module_fwd_convenience
76         }
77
78         qt_developer_build {
79             # Copy the module forward file into Qt so that the module
80             # is immediately accessible.
81             qt_modules_path = $$[QT_INSTALL_PREFIX]$${QMAKE_DIR_SEP}mkspecs$${QMAKE_DIR_SEP}modules
82
83             copy_module_fwd_file.target = $$qt_modules_path$${QMAKE_DIR_SEP}$$module_filename
84             copy_module_fwd_file.commands = $$QMAKE_COPY  $$toSystemPath($$QMAKE_EXTRA_MODULE_FORWARDS)$${QMAKE_DIR_SEP}$$module_filename $$qt_modules_path
85             # FIXME: Add dependendy that ensures we copy the forward file if the target is updated
86             copy_module_fwd_file.depends = $$QMAKE_EXTRA_MODULE_FORWARDS$${QMAKE_DIR_SEP}$$module_filename
87
88             QMAKE_EXTRA_TARGETS += copy_module_fwd_file
89             DEFAULT_TARGETS += copy_module_fwd_file
90         }
91     }
92
93     # Make sure the install_name of the QtWebKit library point to webkit
94     macx {
95         # We do our own absolute path so that we can trick qmake into
96         # using the webkit build path instead of the Qt install path.
97         CONFIG -= absolute_library_soname
98         QMAKE_LFLAGS_SONAME = $$QMAKE_LFLAGS_SONAME$$WEBKIT_DESTDIR/
99
100         !debug_and_release|build_pass {
101             # We also have to make sure the install_name is correct when
102             # the library is installed.
103             change_install_name.depends = install_target
104
105             # The install rules generated by qmake for frameworks are busted in
106             # that both the debug and the release makefile copy QtWebKit.framework
107             # into the install dir, so whatever changes we did to the release library
108             # will get overwritten when the debug library is installed. We work around
109             # that by running install_name on both, for both configs.
110             change_install_name.commands = framework_dir=\$\$(dirname $(TARGETD)); \
111                 for file in \$\$(ls $$[QT_INSTALL_LIBS]/\$\$framework_dir/$$BASE_TARGET*); do \
112                     install_name_tool -id \$\$file \$\$file; \
113                 done
114             default_install_target.target = install
115             default_install_target.depends += change_install_name
116
117             QMAKE_EXTRA_TARGETS += change_install_name default_install_target
118         }
119     }
120 } else {
121     VERSION = $$QT_VERSION
122     DESTDIR = $$WEBKIT_DESTDIR
123 }
124
125 runSyncQt() # Generate forwarding headers for the QtWebKit API
126
127 load(features)
128
129 include(WebKit/WebKit.pri)
130
131 WEBKIT += wtf
132
133 !v8:WEBKIT += javascriptcore
134
135 WEBKIT += webcore
136
137 !no_webkit2 {
138     WEBKIT += webkit2
139     QT += declarative
140
141     # Ensure that changes to the WebKit2 API will trigger a qmake of this
142     # file, which in turn runs syncqt to update the forwarding headers.
143     QMAKE_INTERNAL_INCLUDED_FILES *= WebKit2/Target.pri
144 }
145
146 QT += network
147 haveQt(5): QT += widgets printsupport quick
148
149 contains(DEFINES, WTF_USE_TEXTURE_MAPPER_GL=1)|contains(DEFINES, ENABLE_WEBGL=1) {
150     QT *= opengl
151     # Make sure OpenGL libs are after the webcore lib so MinGW can resolve symbols
152     win32*:!win32-msvc*: LIBS += $$QMAKE_LIBS_OPENGL
153 }
154
155 !static: DEFINES += QT_MAKEDLL
156
157 SOURCES += \
158     $$PWD/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp \
159     $$PWD/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp \
160     $$PWD/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp \
161     $$PWD/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp \
162     $$PWD/WebKit/qt/WebCoreSupport/DragClientQt.cpp \
163     $$PWD/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp \
164     $$PWD/WebKit/qt/WebCoreSupport/EditorClientQt.cpp \
165     $$PWD/WebKit/qt/WebCoreSupport/UndoStepQt.cpp \
166     $$PWD/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp \
167     $$PWD/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \
168     $$PWD/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \
169     $$PWD/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp \
170     $$PWD/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \
171     $$PWD/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp \
172     $$PWD/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \
173     $$PWD/WebKit/qt/WebCoreSupport/PageClientQt.cpp \
174     $$PWD/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp \
175     $$PWD/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp \
176     $$PWD/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp \
177     $$PWD/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.cpp \
178     $$PWD/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp \
179     $$PWD/WebKit/qt/WebCoreSupport/TextCheckerClientQt.cpp \
180     $$PWD/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp \
181     $$PWD/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
182
183 HEADERS += \
184     $$PWD/WebKit/qt/WebCoreSupport/InitWebCoreQt.h \
185     $$PWD/WebKit/qt/WebCoreSupport/InspectorServerQt.h \
186     $$PWD/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \
187     $$PWD/WebKit/qt/WebCoreSupport/QtWebComboBox.h \
188     $$PWD/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \
189     $$PWD/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h \
190     $$PWD/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h \
191     $$PWD/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \
192     $$PWD/WebKit/qt/WebCoreSupport/PageClientQt.h \
193     $$PWD/WebKit/qt/WebCoreSupport/PopupMenuQt.h \
194     $$PWD/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h \
195     $$PWD/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h \
196     $$PWD/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.h \
197     $$PWD/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h \
198     $$PWD/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h \
199     $$PWD/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.h \
200     $$PWD/WebKit/qt/WebCoreSupport/WebEventConversion.h
201
202 INCLUDEPATH += \
203     $$PWD/WebKit/qt/Api \
204     $$PWD/WebKit/qt/WebCoreSupport \
205     $$PWD/WTF/wtf/qt
206
207 contains(DEFINES, ENABLE_VIDEO=1) {
208     !contains(DEFINES, WTF_USE_QTKIT=1):!contains(DEFINES, WTF_USE_GSTREAMER=1):contains(DEFINES, WTF_USE_QT_MULTIMEDIA=1) {
209         HEADERS += $$PWD/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h
210         SOURCES += $$PWD/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp
211     }
212
213     contains(DEFINES, WTF_USE_QTKIT=1) | contains(DEFINES, WTF_USE_GSTREAMER=1) | contains(DEFINES, WTF_USE_QT_MULTIMEDIA=1) {
214         HEADERS += $$PWD/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h
215         SOURCES += $$PWD/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp
216     }
217
218     contains(DEFINES, WTF_USE_QTKIT=1) {
219         INCLUDEPATH += \
220             $$PWD/WebCore/platform/qt/ \
221             $$PWD/WebCore/platform/mac/ \
222             $$PWD/../WebKitLibraries/
223
224         DEFINES += NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
225
226         contains(CONFIG, "x86") {
227             DEFINES+=NS_BUILD_32_LIKE_64
228         }
229
230         HEADERS += \
231             $$PWD/WebKit/qt/WebCoreSupport/WebSystemInterface.h \
232             $$PWD/WebKit/qt/WebCoreSupport/QTKitFullScreenVideoHandler.h
233
234         OBJECTIVE_SOURCES += \
235             $$PWD/WebKit/qt/WebCoreSupport/WebSystemInterface.mm \
236             $$PWD/WebKit/qt/WebCoreSupport/QTKitFullScreenVideoHandler.mm
237
238         LIBS += -framework Security -framework IOKit
239
240         # We can know the Mac OS version by using the Darwin major version
241         DARWIN_VERSION = $$split(QMAKE_HOST.version, ".")
242         DARWIN_MAJOR_VERSION = $$first(DARWIN_VERSION)
243         equals(DARWIN_MAJOR_VERSION, "11") {
244             LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceLion.a
245         } else:equals(DARWIN_MAJOR_VERSION, "10") {
246             LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a
247         } else:equals(DARWIN_MAJOR_VERSION, "9") {
248             LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceLeopard.a
249         }
250     }
251 }
252
253 contains(DEFINES, ENABLE_ICONDATABASE=1) {
254     HEADERS += \
255         $$PWD/WebCore/loader/icon/IconDatabaseClient.h \
256         $$PWD/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h
257
258     SOURCES += \
259         $$PWD/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp
260 }
261
262 contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) || contains(DEFINES, ENABLE_ORIENTATION_EVENTS=1) {
263     haveQt(5) {
264         QT += sensors
265     } else {
266         CONFIG *= mobility
267         MOBILITY *= sensors
268     }
269 }
270
271 contains(DEFINES, ENABLE_GEOLOCATION=1) {
272      haveQt(5): QT += location
273
274      HEADERS += \
275         $$PWD/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
276      SOURCES += \
277         $$PWD/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
278 }
279
280 contains(CONFIG, texmap) {
281     DEFINES += WTF_USE_TEXTURE_MAPPER=1
282 }
283
284 plugin_backend_xlib: PKGCONFIG += x11
285
286 # ------------- Install rules -------------
287
288 haveQt(5) {
289     # Install rules handled by Qt's module system
290 } else {
291     # For Qt4 we have to set up install rules manually
292
293     # Syncqt has already run at this point, so we can use headers.pri
294     # as a basis for our install-rules
295     HEADERS_PRI = $${ROOT_BUILD_DIR}/include/$${QT.webkit.name}/headers.pri
296     !include($$HEADERS_PRI): error(Failed to resolve install headers)
297
298     headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
299     !isEmpty(INSTALL_HEADERS): headers.path = $$INSTALL_HEADERS/$${TARGET}
300     else: headers.path = $$[QT_INSTALL_HEADERS]/$${TARGET}
301     INSTALLS += headers
302
303     !isEmpty(INSTALL_LIBS): target.path = $$INSTALL_LIBS
304     else: target.path = $$[QT_INSTALL_LIBS]
305     INSTALLS += target
306
307     unix {
308         CONFIG += create_pc create_prl
309         QMAKE_PKGCONFIG_LIBDIR = $$target.path
310         QMAKE_PKGCONFIG_INCDIR = $$headers.path
311         QMAKE_PKGCONFIG_DESTDIR = pkgconfig
312         lib_replace.match = $$re_escape($$DESTDIR)
313         lib_replace.replace = $$[QT_INSTALL_LIBS]
314         QMAKE_PKGCONFIG_INSTALL_REPLACE += lib_replace
315     }
316
317     mac {
318         !static:contains(QT_CONFIG, qt_framework) {
319             # Build QtWebKit as a framework, to match how Qt was built
320             CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework
321
322             # For debug_and_release configs, only copy headers in release
323             !debug_and_release|if(build_pass:CONFIG(release, debug|release)) {
324                 FRAMEWORK_HEADERS.version = Versions
325                 FRAMEWORK_HEADERS.files = $${headers.files}
326                 FRAMEWORK_HEADERS.path = Headers
327                 QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
328             }
329         }
330
331         QMAKE_LFLAGS_SONAME = "$${QMAKE_LFLAGS_SONAME}$${DESTDIR}$${QMAKE_DIR_SEP}"
332     }
333 }