cdc9694ba7e83a971fd3f6d64a3e1110135e94f9
[WebKit-https.git] / Source / WebCore / WebCore.pri
1 # Include file for WebCore
2
3 include(../common.pri)
4 include(features.pri)
5
6 # We enable TextureMapper by default; remove this line to enable GraphicsLayerQt.
7 CONFIG += texmap
8
9 QT *= network
10
11 SOURCE_DIR = $$replace(PWD, /WebCore, "")
12
13 contains(QT_CONFIG, qpa)|contains(QT_CONFIG, embedded): CONFIG += embedded
14
15 # Use a config-specific target to prevent parallel builds file clashes on Mac
16 mac: CONFIG(debug, debug|release): WEBCORE_TARGET = webcored
17 else: WEBCORE_TARGET = webcore
18
19 # Output in WebCore/<config>
20 CONFIG(debug, debug|release) : WEBCORE_DESTDIR = debug
21 else: WEBCORE_DESTDIR = release
22
23 CONFIG(standalone_package) {
24     isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = $$PWD/../WebCore/generated
25 } else {
26     isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = $$OUTPUT_DIR/WebCore/generated
27 }
28
29 V8_DIR = "$$[QT_INSTALL_PREFIX]/src/3rdparty/v8"
30 V8_LIB_DIR = "$$[QT_INSTALL_PREFIX]/src/script/v8"
31
32 v8 {
33     lessThan(QT_MAJOR_VERSION, 5): error("To build QtWebKit+V8 you need qtscript-staging's v8 branch. (See: http://qt.gitorious.org/+qt-developers/qt/qtscript-staging)")
34     !exists($${V8_DIR}$${QMAKE_DIR_SEP}include$${QMAKE_DIR_SEP}v8.h): error("Cannot build with V8. Needed file $${V8_DIR}$${QMAKE_DIR_SEP}include$${QMAKE_DIR_SEP}v8.h does not exist.")
35     !exists($${V8_LIB_DIR}$${QMAKE_DIR_SEP}libv8.a): error("Cannot build with V8. Needed library $${V8_LIB_DIR}$${QMAKE_DIR_SEP}libv8.a does not exist.")
36
37     message(Using V8 with QtScript)
38     QT += script
39     INCLUDEPATH += $${V8_DIR}/include
40
41     DEFINES *= V8_BINDING=1
42     DEFINES *= WTF_CHANGES=1
43     DEFINES *= WTF_USE_V8=1
44 }
45
46 v8 {
47     WEBCORE_INCLUDEPATH = \
48         $$SOURCE_DIR/WebCore/bindings/v8 \
49         $$SOURCE_DIR/WebCore/bindings/v8/custom \
50         $$SOURCE_DIR/WebCore/bindings/v8/specialization \
51         $$SOURCE_DIR/WebCore/bridge/qt/v8 \
52         $$SOURCE_DIR/WebCore/testing/v8
53
54 } else {
55     WEBCORE_INCLUDEPATH = \
56         $$SOURCE_DIR/WebCore/bridge/jsc \
57         $$SOURCE_DIR/WebCore/bindings/js \
58         $$SOURCE_DIR/WebCore/bindings/js/specialization \
59         $$SOURCE_DIR/WebCore/bridge/c \
60         $$SOURCE_DIR/WebCore/testing/js
61 }
62
63 WEBCORE_INCLUDEPATH = \
64     $$SOURCE_DIR/WebCore \
65     $$SOURCE_DIR/WebCore/accessibility \
66     $$SOURCE_DIR/WebCore/bindings \
67     $$SOURCE_DIR/WebCore/bindings/generic \
68     $$SOURCE_DIR/WebCore/bridge \
69     $$SOURCE_DIR/WebCore/css \
70     $$SOURCE_DIR/WebCore/dom \
71     $$SOURCE_DIR/WebCore/dom/default \
72     $$SOURCE_DIR/WebCore/editing \
73     $$SOURCE_DIR/WebCore/fileapi \
74     $$SOURCE_DIR/WebCore/history \
75     $$SOURCE_DIR/WebCore/html \
76     $$SOURCE_DIR/WebCore/html/canvas \
77     $$SOURCE_DIR/WebCore/html/parser \
78     $$SOURCE_DIR/WebCore/html/shadow \
79     $$SOURCE_DIR/WebCore/inspector \
80     $$SOURCE_DIR/WebCore/loader \
81     $$SOURCE_DIR/WebCore/loader/appcache \
82     $$SOURCE_DIR/WebCore/loader/archive \
83     $$SOURCE_DIR/WebCore/loader/cache \
84     $$SOURCE_DIR/WebCore/loader/icon \
85     $$SOURCE_DIR/WebCore/mathml \
86     $$SOURCE_DIR/WebCore/notifications \
87     $$SOURCE_DIR/WebCore/page \
88     $$SOURCE_DIR/WebCore/page/animation \
89     $$SOURCE_DIR/WebCore/platform \
90     $$SOURCE_DIR/WebCore/platform/animation \
91     $$SOURCE_DIR/WebCore/platform/audio \
92     $$SOURCE_DIR/WebCore/platform/graphics \
93     $$SOURCE_DIR/WebCore/platform/graphics/filters \
94     $$SOURCE_DIR/WebCore/platform/graphics/filters/arm \
95     $$SOURCE_DIR/WebCore/platform/graphics/texmap \
96     $$SOURCE_DIR/WebCore/platform/graphics/transforms \
97     $$SOURCE_DIR/WebCore/platform/image-decoders \
98     $$SOURCE_DIR/WebCore/platform/leveldb \
99     $$SOURCE_DIR/WebCore/platform/mock \
100     $$SOURCE_DIR/WebCore/platform/network \
101     $$SOURCE_DIR/WebCore/platform/sql \
102     $$SOURCE_DIR/WebCore/platform/text \
103     $$SOURCE_DIR/WebCore/platform/text/transcoder \
104     $$SOURCE_DIR/WebCore/platform/track \
105     $$SOURCE_DIR/WebCore/plugins \
106     $$SOURCE_DIR/WebCore/rendering \
107     $$SOURCE_DIR/WebCore/rendering/mathml \
108     $$SOURCE_DIR/WebCore/rendering/style \
109     $$SOURCE_DIR/WebCore/rendering/svg \
110     $$SOURCE_DIR/WebCore/storage \
111     $$SOURCE_DIR/WebCore/svg \
112     $$SOURCE_DIR/WebCore/svg/animation \
113     $$SOURCE_DIR/WebCore/svg/graphics \
114     $$SOURCE_DIR/WebCore/svg/graphics/filters \
115     $$SOURCE_DIR/WebCore/svg/properties \
116     $$SOURCE_DIR/WebCore/testing \
117     $$SOURCE_DIR/WebCore/webaudio \
118     $$SOURCE_DIR/WebCore/websockets \
119     $$SOURCE_DIR/WebCore/workers \
120     $$SOURCE_DIR/WebCore/xml \
121     $$WEBCORE_INCLUDEPATH
122
123 WEBCORE_INCLUDEPATH = \
124     $$SOURCE_DIR/WebCore/bridge/qt \
125     $$SOURCE_DIR/WebCore/page/qt \
126     $$SOURCE_DIR/WebCore/platform/graphics/qt \
127     $$SOURCE_DIR/WebCore/platform/network/qt \
128     $$SOURCE_DIR/WebCore/platform/qt \
129     $$SOURCE_DIR/WebKit/qt/Api \
130     $$SOURCE_DIR/WebKit/qt/WebCoreSupport \
131     $$WEBCORE_INCLUDEPATH
132
133 # On Symbian PREPEND_INCLUDEPATH is the best way to make sure that WebKit headers
134 # are included before platform headers.
135 symbian {
136     PREPEND_INCLUDEPATH = $$WEBCORE_INCLUDEPATH $$WC_GENERATED_SOURCES_DIR $$PREPEND_INCLUDEPATH
137 } else {
138     INCLUDEPATH = $$WEBCORE_INCLUDEPATH $$WC_GENERATED_SOURCES_DIR $$INCLUDEPATH
139 }
140
141 symbian {
142     v8 {
143         QMAKE_CXXFLAGS.ARMCC += -OTime -O3
144         QMAKE_CXXFLAGS.ARMCC += --fpu softvfp+vfpv2 --fpmode fast
145         LIBS += -llibpthread
146     }
147
148     # RO text (code) section in qtwebkit.dll exceeds allocated space for gcce udeb target.
149     # Move RW-section base address to start from 0x1000000 instead of the toolchain default 0x400000.
150     QMAKE_LFLAGS.ARMCC += --rw-base 0x1000000
151     QMAKE_LFLAGS.GCCE += -Tdata 0x1000000
152
153     CONFIG += do_not_build_as_thumb
154
155     CONFIG(release, debug|release): QMAKE_CXXFLAGS.ARMCC += -OTime -O3
156     # Symbian plugin support
157     LIBS += -lefsrv
158
159     !CONFIG(QTDIR_build) {
160         # Test if symbian OS comes with sqlite
161         exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso):CONFIG *= system-sqlite
162     } else:!symbian-abld:!symbian-sbsv2 {
163         # When bundled with Qt, all Symbian build systems extract their own sqlite files if
164         # necessary, but on non-mmp based ones we need to specify this ourselves.
165         include($$QT_SOURCE_TREE/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri)
166     }
167 }
168
169 contains(DEFINES, ENABLE_XSLT=1) {
170     contains(DEFINES, WTF_USE_LIBXML2=1) {
171         PKGCONFIG += libxslt
172     } else {
173         QT *= xmlpatterns
174     }
175 }
176
177 contains(DEFINES, WTF_USE_LIBXML2=1) {
178     PKGCONFIG += libxml-2.0
179 }
180
181 contains(DEFINES, ENABLE_SQLITE=1) {
182     !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) {
183             INCLUDEPATH += $${SQLITE3SRCDIR}
184             DEFINES += SQLITE_CORE SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE
185             CONFIG(release, debug|release): DEFINES *= NDEBUG
186             contains(DEFINES, ENABLE_SINGLE_THREADED=1): DEFINES += SQLITE_THREADSAFE=0
187     } else {
188         # Use sqlite3 from the underlying OS
189         CONFIG(QTDIR_build) {
190             QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE
191             LIBS *= $$QT_LFLAGS_SQLITE
192         } else {
193             INCLUDEPATH += $${SQLITE3SRCDIR}
194             LIBS += -lsqlite3
195         }
196     }
197     wince*:DEFINES += HAVE_LOCALTIME_S=0
198 }
199
200 contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) {
201     unix:!symbian {
202         mac {
203             INCLUDEPATH += platform/mac
204             # Note: XP_MACOSX is defined in npapi.h
205         } else {
206             !embedded {
207                 CONFIG += x11
208                 LIBS += -lXrender
209             }
210             maemo5 {
211                 DEFINES += MOZ_PLATFORM_MAEMO=5
212             }
213             contains(DEFINES, Q_WS_MAEMO_6) {
214                 DEFINES += MOZ_PLATFORM_MAEMO=6
215             }
216             DEFINES += XP_UNIX
217             DEFINES += ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE=1
218         }
219     }
220     win32-* {
221         LIBS += \
222             -ladvapi32 \
223             -lgdi32 \
224             -lshell32 \
225             -lshlwapi \
226             -luser32 \
227             -lversion
228     }
229 }
230
231 contains(DEFINES, ENABLE_GEOLOCATION=1) {
232     CONFIG *= mobility
233     MOBILITY *= location
234 }
235
236 contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) {
237     CONFIG *= mobility
238     MOBILITY *= sensors
239 }
240
241 contains(DEFINES, WTF_USE_QT_MOBILITY_SYSTEMINFO=1) {
242      CONFIG *= mobility
243      MOBILITY *= systeminfo
244 }
245
246 contains(DEFINES, WTF_USE_QT_BEARER=1) {
247     # Bearer management is part of Qt 4.7, so don't accidentially
248     # pull in Qt Mobility when building against >= 4.7
249     !greaterThan(QT_MINOR_VERSION, 6) {
250         CONFIG *= mobility
251         MOBILITY *= bearer
252     }
253 }
254
255 contains(DEFINES, ENABLE_VIDEO=1) {
256     contains(DEFINES, USE_QTKIT=1) {
257         DEFINES += WTF_USE_QTKIT=1
258
259         INCLUDEPATH += $$PWD/platform/graphics/mac
260
261         LIBS += -framework AppKit -framework AudioUnit \
262                 -framework AudioToolbox -framework CoreAudio \
263                 -framework QuartzCore -framework QTKit
264
265     } else:contains(DEFINES, USE_GSTREAMER=1) {
266         DEFINES += WTF_USE_GSTREAMER=1
267         DEFINES += ENABLE_GLIB_SUPPORT=1
268
269         INCLUDEPATH += $$PWD/platform/graphics/gstreamer
270
271         PKGCONFIG += glib-2.0 gio-2.0 gstreamer-0.10 gstreamer-app-0.10 gstreamer-base-0.10 gstreamer-interfaces-0.10 gstreamer-pbutils-0.10 gstreamer-plugins-base-0.10 gstreamer-video-0.10
272     } else:contains(MOBILITY_CONFIG, multimedia) {
273         CONFIG   *= mobility
274         MOBILITY *= multimedia
275         DEFINES  += WTF_USE_QT_MULTIMEDIA=1
276     } else:contains(QT_CONFIG, phonon) {
277         # Add phonon manually to prevent it from coming first in
278         # the include paths, as Phonon's path.h conflicts with
279         # WebCore's Path.h on case-insensitive filesystems.
280         qtAddLibrary(phonon)
281         INCLUDEPATH -= $$QT.phonon.includes
282         INCLUDEPATH += $$QT.phonon.includes
283         mac {
284             INCLUDEPATH -= $$QT.phonon.libs/phonon.framework/Headers
285             INCLUDEPATH += $$QT.phonon.libs/phonon.framework/Headers
286         }
287     }
288 }
289
290 contains(DEFINES, ENABLE_WEBGL=1) {
291     !contains(QT_CONFIG, opengl) {
292         error( "This configuration needs an OpenGL enabled Qt. Your Qt is missing OpenGL.")
293     }
294     QT *= opengl
295 }
296
297 contains(CONFIG, texmap) {
298     DEFINES += WTF_USE_TEXTURE_MAPPER=1
299     !symbian:!win32-*:contains(QT_CONFIG, opengl) {
300         DEFINES += WTF_USE_TEXTURE_MAPPER_GL
301         QT *= opengl
302     }
303 }
304
305 !CONFIG(webkit-debug):CONFIG(QTDIR_build) {
306     # Remove the following 2 lines if you want debug information in WebCore
307     CONFIG -= separate_debug_info
308     CONFIG += no_debug_info
309 }
310
311 !CONFIG(QTDIR_build) {
312     win32-*|wince* {
313         DLLDESTDIR = $$OUTPUT_DIR/bin
314         isEmpty(QT_SOURCE_TREE):build_pass: TARGET = $$qtLibraryTarget($$TARGET)
315
316         dlltarget.commands = $(COPY_FILE) $(DESTDIR_TARGET) $$[QT_INSTALL_BINS]
317         dlltarget.CONFIG = no_path
318         INSTALLS += dlltarget
319     }
320     mac {
321         LIBS += -framework Carbon -framework AppKit
322     }
323 }
324
325 win32-* {
326     INCLUDEPATH += $$SOURCE_DIR/WebCore/platform/win
327     LIBS += -lgdi32
328     LIBS += -lole32
329     LIBS += -luser32
330 }
331
332 # Remove whole program optimizations due to miscompilations
333 win32-msvc2005|win32-msvc2008|wince*:{
334     QMAKE_CFLAGS_RELEASE -= -GL
335     QMAKE_CXXFLAGS_RELEASE -= -GL
336
337     # Disable incremental linking for windows 32bit OS debug build as WebKit is so big
338     # that linker failes to link incrementally in debug mode.
339     ARCH = $$(PROCESSOR_ARCHITECTURE)
340     WOW64ARCH = $$(PROCESSOR_ARCHITEW6432)
341     equals(ARCH, x86):{
342         isEmpty(WOW64ARCH): QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO
343     }
344 }
345
346 wince* {
347     LIBS += -lmmtimer
348     LIBS += -lole32
349 }
350
351 mac {
352     LIBS_PRIVATE += -framework Carbon -framework AppKit
353 }
354
355 unix:!mac:*-g++*:QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
356 unix:!mac:*-g++*:QMAKE_LFLAGS += -Wl,--gc-sections
357 linux*-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
358
359 unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
360 unix:!mac:!symbian:CONFIG += link_pkgconfig
361
362 # Disable C++0x mode in WebCore for those who enabled it in their Qt's mkspec
363 *-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
364
365 enable_fast_mobile_scrolling: DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1
366
367 use_qt_mobile_theme: DEFINES += WTF_USE_QT_MOBILE_THEME=1
368
369 defineTest(prependWebCoreLib) {
370     pathToWebCoreOutput = $$ARGS/$$WEBCORE_DESTDIR
371
372     win32-msvc*|wince* {
373         LIBS = -l$$WEBCORE_TARGET $$LIBS
374         LIBS = -L$$pathToWebCoreOutput $$LIBS
375         POST_TARGETDEPS += $${pathToWebCoreOutput}$${QMAKE_DIR_SEP}$${WEBCORE_TARGET}.lib
376     } else:symbian {
377         LIBS = -l$${WEBCORE_TARGET}.lib $$LIBS
378         QMAKE_LIBDIR += $$pathToWebCoreOutput
379         POST_TARGETDEPS += $${pathToWebCoreOutput}$${QMAKE_DIR_SEP}$${WEBCORE_TARGET}.lib
380     } else {
381         QMAKE_LIBDIR = $$pathToWebCoreOutput $$QMAKE_LIBDIR
382         LIBS = -l$$WEBCORE_TARGET $$LIBS
383         POST_TARGETDEPS += $${pathToWebCoreOutput}$${QMAKE_DIR_SEP}lib$${WEBCORE_TARGET}.a
384     }
385     
386     CONFIG -= explicitlib
387     CONFIG -= staticlib
388     export(QMAKE_LIBDIR)
389     export(POST_TARGETDEPS)
390     export(CONFIG)
391     export(LIBS)
392
393     return(true)
394 }