summaryrefslogtreecommitdiff
path: root/Tools/qmake/mkspecs/features/features.prf
blob: 0aad660217bc6b3874e2756eb5036ccbe547bedd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# -------------------------------------------------------------------
# This file does basic 'configure' style checks to determine the
# set of enable/use/have defines and their values.
#
# See 'Tools/qmake/README' for an overview of the build system
# -------------------------------------------------------------------

defineTest(detectFeatures) {

    # -------------- Fill in static defaults --------------

    include(features.pri)

    for(feature, FEATURE_DEFAULTS) {
        enabledFeature = $$find(feature, =1$)
        !isEmpty(enabledFeature) {
        line ~= s/^.+include \"(.*)\"/\\1/
            enabledFeature ~= s/=1$//
            enabledFeature ~= s/^ENABLE_//
            WEBKIT_CONFIG += $$lower($$enabledFeature)
        }
    }

    WEBKIT_CONFIG += use_tiled_backing_store

    # ------------- Prepare for feature detection -------------

    # ---------- Dynamically detect optional features -------------
    #
    # Please note: static feature defaults go in features.pri
    #

    haveQtModule(quick): WEBKIT_CONFIG += have_qtquick
    else: CONFIGURE_WARNINGS += "QtQuick module not found, QML APIs will not be built"

    haveQtModule(printsupport): WEBKIT_CONFIG += have_qtprintsupport
    haveQtModule(widgets): WEBKIT_CONFIG += have_qstyle
    haveQtModule(testlib): WEBKIT_CONFIG += have_qttestlib

    config_libxml2: WEBKIT_CONFIG += use_libxml2
    config_libxslt: WEBKIT_CONFIG += xslt
    config_libzlib: WEBKIT_CONFIG += use_zlib
    config_libwebp: WEBKIT_CONFIG += use_webp

    config_libjpeg: WEBKIT_CONFIG += use_libjpeg
    else: CONFIGURE_WARNINGS += "JPEG library not found, QImageDecoder will decode JPEG images"

    config_libpng: WEBKIT_CONFIG += use_libpng
    else: CONFIGURE_WARNINGS += "PNG library not found, QImageDecoder will decode PNG images"

    linux-* {
        config_libXcomposite: WEBKIT_CONFIG += have_xcomposite
        config_libXrender: WEBKIT_CONFIG += have_xrender

        config_glx:!contains(QT_CONFIG, opengles2): WEBKIT_CONFIG += have_glx

        # We need fontconfig to set up the test fonts for DumpRenderTree and WebKitTestRunner.
        config_fontconfig: WEBKIT_CONFIG += have_fontconfig
    }

    # Nescape plugins support (NPAPI)
    xlibAvailable() {
        WEBKIT_CONFIG += \
            netscape_plugin_api \
            use_plugin_backend_xlib

        # WebKit2
        WEBKIT_CONFIG += \
            plugin_architecture_x11 \
            plugin_process

    } else: unix|win32-*:!embedded:!wince* {
        WEBKIT_CONFIG += netscape_plugin_api
        # WebKit2
        WEBKIT_CONFIG += plugin_architecture_unsupported
    } else {
        WEBKIT_CONFIG += plugin_architecture_unsupported
    }

    # Enable the USE(3D_GRAPHICS) flag when QtOpenGL is enabled.
    # Disable on Windows CE for now, as ANGLE won't compile.
    !wince*:contains(QT_CONFIG, opengl) {
        # On Windows we require GLES2/EGL through ANGLE.
        !win32|contains(QT_CONFIG, opengles2): WEBKIT_CONFIG += use_3d_graphics
    }

    # Temporarily disable FTPDIR on Windows CE (missing functions from time.h)
    wince* {
        WEBKIT_CONFIG -= ftpdir
    }

    # WebGL support - only enabled if we can use 3D graphics
    use?(3d_graphics): WEBKIT_CONFIG += webgl

    # Enable CSS shaders when CSS filters and WebGL are enabled
    enable?(css_filters):enable?(webgl): WEBKIT_CONFIG += css_shaders

    # Geolocation support if QtMobility exists
    haveQtModule(location): WEBKIT_CONFIG += geolocation

    # Orientation support
    haveQtModule(sensors): WEBKIT_CONFIG += orientation_events device_orientation

    # HTML5 Media Support
    mac {
        DARWIN_VERSION = $$split(QMAKE_HOST.version, ".")
        DARWIN_MAJOR_VERSION = $$first(DARWIN_VERSION)
        # QTKIT support requires 10.7 or newer
        greaterThan(DARWIN_MAJOR_VERSION, 10) {
            WEBKIT_CONFIG += video use_qtkit
        }

    } else: linux-* {
        !contains(QT_CONFIG, no-pkg-config):packagesExist("glib-2.0 gio-2.0 \'gstreamer-0.10 >= 0.10.30\' \'gstreamer-plugins-base-0.10 >= 0.10.30\'") {
            WEBKIT_CONFIG += video use_gstreamer
        } else {
            CONFIGURE_WARNINGS += "Missing GLib/Gio/GStreamer, disabling media element support"
        }
    } else: haveQtModule(multimediawidgets) {
        WEBKIT_CONFIG += video use_qt_multimedia
    }

    # Gamepad API Support
    !contains(QT_CONFIG, no-pkg-config):packagesExist(libudev): WEBKIT_CONFIG += gamepad

    # Support for Graphics Surface
    # GraphicsSurface requires GraphicsContext3D and hence use_3d_graphics
    use?(3d_graphics) {
        mac: WEBKIT_CONFIG += use_graphics_surface
        win32:contains(QT_CONFIG, opengles2): WEBKIT_CONFIG += use_graphics_surface
        linux-*:contains(WEBKIT_CONFIG, have_glx):contains(WEBKIT_CONFIG, have_xcomposite):contains(WEBKIT_CONFIG, have_xrender): WEBKIT_CONFIG += use_graphics_surface
    }

    # Slider Touch is sensible to use when compiling WebKit2
    enable?(touch_events): WEBKIT_CONFIG += touch_slider

    # ---------------- Sanitize features -------------------

    export(WEBKIT_CONFIG)
    export(CONFIGURE_WARNINGS)
}

defineTest(santizeFeatures) {
    # Disable SVG fonts if SVG is disabled
    !enable?(svg): WEBKIT_CONFIG -= svg_fonts

    # JavaScript debugger requires the inspector
    !enable?(inspector): WEBKIT_CONFIG -= javascript_debugger inspector_server

    # Disable animated smooth scrolling if request-animation-frame is disabled
    !enable?(request_animation_frame): WEBKIT_CONFIG -= smooth_scrolling

    # Fullscreen API relies on WebKit2
    !build?(webkit2): WEBKIT_CONFIG -= fullscreen_api

    # WK2's plugin process code requires NPAPI
    !enable?(netscape_plugin_api): WEBKIT_CONFIG -= plugin_process

    export(WEBKIT_CONFIG)
}