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