[Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder
[WebKit-https.git] / Source / WebCore / WebCore.pri
1 # -------------------------------------------------------------------
2 # This file contains shared rules used both when building WebCore
3 # itself, and by targets that use WebCore.
4 #
5 # See 'Tools/qmake/README' for an overview of the build system
6 # -------------------------------------------------------------------
7
8 load(features)
9
10 SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/WebCore
11
12 # We enable TextureMapper by default; remove this line to enable GraphicsLayerQt.
13 CONFIG += texmap
14
15 QT *= network sql
16
17 WEBCORE_GENERATED_SOURCES_DIR = $${ROOT_BUILD_DIR}/Source/WebCore/$${GENERATED_SOURCES_DESTDIR}
18
19 INCLUDEPATH += \
20     $$SOURCE_DIR \
21     $$SOURCE_DIR/Modules/filesystem \
22     $$SOURCE_DIR/Modules/geolocation \
23     $$SOURCE_DIR/Modules/indexeddb \
24     $$SOURCE_DIR/Modules/webaudio \
25     $$SOURCE_DIR/Modules/webdatabase \
26     $$SOURCE_DIR/Modules/websockets \
27     $$SOURCE_DIR/accessibility \
28     $$SOURCE_DIR/bindings \
29     $$SOURCE_DIR/bindings/generic \
30     $$SOURCE_DIR/bridge \
31     $$SOURCE_DIR/bridge/qt \
32     $$SOURCE_DIR/css \
33     $$SOURCE_DIR/dom \
34     $$SOURCE_DIR/dom/default \
35     $$SOURCE_DIR/editing \
36     $$SOURCE_DIR/fileapi \
37     $$SOURCE_DIR/history \
38     $$SOURCE_DIR/html \
39     $$SOURCE_DIR/html/canvas \
40     $$SOURCE_DIR/html/parser \
41     $$SOURCE_DIR/html/shadow \
42     $$SOURCE_DIR/html/track \
43     $$SOURCE_DIR/inspector \
44     $$SOURCE_DIR/loader \
45     $$SOURCE_DIR/loader/appcache \
46     $$SOURCE_DIR/loader/archive \
47     $$SOURCE_DIR/loader/cache \
48     $$SOURCE_DIR/loader/icon \
49     $$SOURCE_DIR/mathml \
50     $$SOURCE_DIR/notifications \
51     $$SOURCE_DIR/page \
52     $$SOURCE_DIR/page/animation \
53     $$SOURCE_DIR/page/qt \
54     $$SOURCE_DIR/page/scrolling \
55     $$SOURCE_DIR/platform \
56     $$SOURCE_DIR/platform/animation \
57     $$SOURCE_DIR/platform/audio \
58     $$SOURCE_DIR/platform/graphics \
59     $$SOURCE_DIR/platform/graphics/filters \
60     $$SOURCE_DIR/platform/graphics/filters/arm \
61     $$SOURCE_DIR/platform/graphics/opengl \
62     $$SOURCE_DIR/platform/graphics/qt \
63     $$SOURCE_DIR/platform/graphics/surfaces \
64     $$SOURCE_DIR/platform/graphics/texmap \
65     $$SOURCE_DIR/platform/graphics/transforms \
66     $$SOURCE_DIR/platform/image-decoders \
67     $$SOURCE_DIR/platform/image-decoders/bmp \
68     $$SOURCE_DIR/platform/image-decoders/gif \
69     $$SOURCE_DIR/platform/image-decoders/ico \
70     $$SOURCE_DIR/platform/image-decoders/jpeg \
71     $$SOURCE_DIR/platform/image-decoders/png \
72     $$SOURCE_DIR/platform/leveldb \
73     $$SOURCE_DIR/platform/mock \
74     $$SOURCE_DIR/platform/network \
75     $$SOURCE_DIR/platform/network/qt \
76     $$SOURCE_DIR/platform/qt \
77     $$SOURCE_DIR/platform/sql \
78     $$SOURCE_DIR/platform/text \
79     $$SOURCE_DIR/platform/text/transcoder \
80     $$SOURCE_DIR/plugins \
81     $$SOURCE_DIR/rendering \
82     $$SOURCE_DIR/rendering/mathml \
83     $$SOURCE_DIR/rendering/style \
84     $$SOURCE_DIR/rendering/svg \
85     $$SOURCE_DIR/storage \
86     $$SOURCE_DIR/svg \
87     $$SOURCE_DIR/svg/animation \
88     $$SOURCE_DIR/svg/graphics \
89     $$SOURCE_DIR/svg/graphics/filters \
90     $$SOURCE_DIR/svg/properties \
91     $$SOURCE_DIR/testing \
92     $$SOURCE_DIR/websockets \
93     $$SOURCE_DIR/workers \
94     $$SOURCE_DIR/xml \
95     $$SOURCE_DIR/xml/parser \
96     $$SOURCE_DIR/../ThirdParty
97
98 v8 {
99     DEFINES *= V8_BINDING=1
100
101     INCLUDEPATH += \
102         $$SOURCE_DIR/bindings/v8 \
103         $$SOURCE_DIR/bindings/v8/custom \
104         $$SOURCE_DIR/bindings/v8/specialization \
105         $$SOURCE_DIR/bridge/qt/v8 \
106         $$SOURCE_DIR/testing/v8
107
108 } else {
109     INCLUDEPATH += \
110         $$SOURCE_DIR/bridge/jsc \
111         $$SOURCE_DIR/bindings/js \
112         $$SOURCE_DIR/bindings/js/specialization \
113         $$SOURCE_DIR/bridge/c \
114         $$SOURCE_DIR/testing/js
115 }
116
117 INCLUDEPATH += $$WEBCORE_GENERATED_SOURCES_DIR
118
119 contains(DEFINES, ENABLE_XSLT=1) {
120     contains(DEFINES, WTF_USE_LIBXML2=1) {
121         mac {
122             INCLUDEPATH += /usr/include/libxml2
123             LIBS += -lxml2 -lxslt
124         } else {
125             PKGCONFIG += libxslt
126         }
127     } else {
128         QT *= xmlpatterns
129     }
130 }
131
132 contains(DEFINES, WTF_USE_LIBXML2=1) {
133     PKGCONFIG += libxml-2.0
134 }
135
136 contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) {
137     unix {
138         mac {
139             INCLUDEPATH += platform/mac
140             # Note: XP_MACOSX is defined in npapi.h
141         } else {
142             !embedded {
143                 CONFIG += x11
144                 LIBS += -lXrender
145                 DEFINES += MOZ_X11
146             }
147             DEFINES += XP_UNIX
148             DEFINES += ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE=1
149         }
150     }
151     win32-* {
152         LIBS += \
153             -ladvapi32 \
154             -lgdi32 \
155             -lshell32 \
156             -lshlwapi \
157             -luser32 \
158             -lversion
159     }
160 }
161
162 contains(DEFINES, ENABLE_GEOLOCATION=1) {
163     CONFIG *= mobility
164     MOBILITY *= location
165 }
166
167 contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) {
168     haveQt(5) {
169         QT += sensors
170     } else {
171         CONFIG *= mobility
172         MOBILITY *= sensors
173     }
174 }
175
176 contains(DEFINES, WTF_USE_QT_MOBILITY_SYSTEMINFO=1) {
177      CONFIG *= mobility
178      MOBILITY *= systeminfo
179 }
180
181 contains(DEFINES, ENABLE_VIDEO=1) {
182     contains(DEFINES, WTF_USE_QTKIT=1) {
183         INCLUDEPATH += $$SOURCE_DIR/platform/graphics/mac
184
185         LIBS += -framework AppKit -framework AudioUnit \
186                 -framework AudioToolbox -framework CoreAudio \
187                 -framework QuartzCore -framework QTKit
188
189     } else:contains(DEFINES, WTF_USE_GSTREAMER=1) {
190         DEFINES += ENABLE_GLIB_SUPPORT=1
191
192         INCLUDEPATH += $$SOURCE_DIR/platform/graphics/gstreamer
193
194         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
195     } else:contains(DEFINES, WTF_USE_QT_MULTIMEDIA=1) {
196         CONFIG   *= mobility
197         MOBILITY *= multimedia
198     }
199 }
200
201 contains(DEFINES, ENABLE_WEBGL=1) {
202     !contains(QT_CONFIG, opengl) {
203         error( "This configuration needs an OpenGL enabled Qt. Your Qt is missing OpenGL.")
204     }
205 }
206
207 contains(CONFIG, texmap) {
208     DEFINES += WTF_USE_TEXTURE_MAPPER=1
209     !win32-*:contains(QT_CONFIG, opengl) {
210         DEFINES += WTF_USE_TEXTURE_MAPPER_GL=1
211         contains(QT_CONFIG, opengles2): LIBS += -lEGL
212     }
213     mac: LIBS += -framework IOSurface -framework CoreFoundation
214 }
215
216 contains(DEFINES, WTF_USE_TEXTURE_MAPPER_GL=1)|contains(DEFINES, ENABLE_WEBGL=1) {
217     # Only Qt 4 needs the opengl module, for Qt 5 everything we need is part of QtGui.
218     haveQt(4): QT *= opengl
219 }
220
221 !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) {
222     INCLUDEPATH += $${SQLITE3SRCDIR}
223     DEFINES += SQLITE_CORE SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE
224     CONFIG(release, debug|release): DEFINES *= NDEBUG
225 } else {
226     INCLUDEPATH += $${SQLITE3SRCDIR}
227     LIBS += -lsqlite3
228 }
229
230 contains(DEFINES, WTF_USE_WEBP=1) {
231     INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp
232     LIBS += -lwebp
233 }
234
235 haveQt(5) {
236     # Qt5 allows us to use config tests to check for the presence of these libraries
237     !contains(config_test_libjpeg, yes): error("JPEG library not found!")
238     !contains(config_test_libpng, yes): error("PNG 1.2 library not found!")
239 }
240
241 LIBS += -ljpeg -lpng12
242
243 win32-*|wince* {
244     DLLDESTDIR = $${ROOT_BUILD_DIR}/bin
245
246     dlltarget.commands = $(COPY_FILE) $(DESTDIR_TARGET) $$[QT_INSTALL_BINS]
247     dlltarget.CONFIG = no_path
248     INSTALLS += dlltarget
249 }
250 mac {
251     LIBS += -framework Carbon -framework AppKit
252 }
253
254 win32-* {
255     INCLUDEPATH += $$SOURCE_DIR/platform/win
256     LIBS += -lgdi32
257     LIBS += -lole32
258     LIBS += -luser32
259 }
260
261 # Remove whole program optimizations due to miscompilations
262 win32-msvc2005|win32-msvc2008|win32-msvc2010|wince*:{
263     QMAKE_CFLAGS_LTCG -= -GL
264     QMAKE_CXXFLAGS_LTCG -= -GL
265
266     # Disable incremental linking for windows 32bit OS debug build as WebKit is so big
267     # that linker failes to link incrementally in debug mode.
268     ARCH = $$(PROCESSOR_ARCHITECTURE)
269     WOW64ARCH = $$(PROCESSOR_ARCHITEW6432)
270     equals(ARCH, x86):{
271         isEmpty(WOW64ARCH): QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO
272     }
273 }
274
275 wince* {
276     DEFINES += HAVE_LOCALTIME_S=0
277     LIBS += -lmmtimer
278     LIBS += -lole32
279 }
280
281 mac {
282     LIBS_PRIVATE += -framework Carbon -framework AppKit
283 }
284
285 unix:!mac:*-g++*:QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
286 unix:!mac:*-g++*:QMAKE_LFLAGS += -Wl,--gc-sections
287 linux*-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
288
289 unix|win32-g++* {
290     QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
291     haveQt(5): QMAKE_PKGCONFIG_REQUIRES += QtWidgets
292 }
293
294 # Disable C++0x mode in WebCore for those who enabled it in their Qt's mkspec
295 *-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
296
297 enable_fast_mobile_scrolling: DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1
298