load(default_post)

contains(TEMPLATE, ".*app") {
    contains(CONFIG, stdbinary) {
        QMAKE_LIBS +=
    } else:contains(CONFIG,qt) {
        QMAKE_LIBS += $$QMAKE_LIBS_QT_ENTRY
    } else {
        QMAKE_LIBS += $$QMAKE_LIBS_NO_QT_ENTRY
    }

    contains(DESTDIR, "/.*") {
        default_bin_deployment.files += $$DESTDIR/$$symbianRemoveSpecialCharacters($$basename(TARGET)).exe
    } else:isEmpty(DESTDIR) {
        default_bin_deployment.files += $$OUT_PWD/$$symbianRemoveSpecialCharacters($$basename(TARGET)).exe
    } else {
        default_bin_deployment.files += $$OUT_PWD/$$DESTDIR/$$symbianRemoveSpecialCharacters($$basename(TARGET)).exe
    }
    default_bin_deployment.path += /sys/bin

    load(application_icon.prf)

    # Specify default graphics memory quota for applications unless explicitly set by developer.
    !contains(S60_VERSION, 5.0):!contains(S60_VERSION, 5.1):!contains(S60_VERSION, 5.2):!contains(S60_VERSION, 5.3) {
        !contains(RSS_RULES, .*graphics_memory.*) {
            contains(QT, gui) {
                RSS_RULES += "graphics_memory=24576;"
            } else {
                RSS_RULES += "graphics_memory=0;"
            }
        }
    }
}

contains(TEMPLATE, lib): {
    contains(CONFIG, staticlib)|contains(CONFIG, static): {
        # Static libs should not have LIBRARY statements in S60
        QMAKE_LIBS =
        # Static libs do not need def files
        MMP_RULES -= EXPORTUNFROZEN
    }
    contains(CONFIG, plugin):!contains(CONFIG, stdbinary): {
        # Plugins based on normal libraries have predefined def file
        MMP_RULES -= EXPORTUNFROZEN
    }
} else {
    # Applications don't need this
    MMP_RULES -= EXPORTUNFROZEN
}

isEmpty(TARGET.UID3):TARGET.UID3 = $$generate_uid("$${OUT_PWD}/$${TARGET}")
isEmpty(TARGET.UID2) {
    contains(CONFIG, stdbinary) {
        TARGET.UID2 = 0x20004C45
    } else {
        contains(TEMPLATE, app) {
            contains(QT, gui) {
                TARGET.UID2 = 0x100039CE
            } else {
                TARGET.UID2 = 0
            }
        } else:contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) {
            TARGET.UID2 = 0x1000008d
        }
    }
}

# Add dependency to Qt package to all other projects besides Qt libs.
# Note: Qt libs package with full capabilities has UID3 of 0x2001E61C,
#       while self-signed version typically has temporary UID3 of 0xE001E61C.
contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0xE001E61C):isEmpty(QT_LIBINFIX) {
    qt_pkg_name = Qt
    pkg_depends_qt += \
        "; Default dependency to Qt libraries" \
        "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {$$addLanguageDependentPkgItem(qt_pkg_name)}"

    # Projects linking to webkit need dependency to webkit
    contains(QT, webkit): {
        # these can be overridden by mkspecs/modules/qt_webkit.pri
        isEmpty(QT_WEBKIT_MAJOR_VERSION) {
            QT_WEBKIT_MAJOR_VERSION = $${QT_MAJOR_VERSION}
            QT_WEBKIT_MINOR_VERSION = $${QT_MINOR_VERSION}
            QT_WEBKIT_PATCH_VERSION = $${QT_PATCH_VERSION}
        }

        webkit_pkg_name = QtWebKit
        pkg_depends_webkit += \
            "; Dependency to Qt Webkit" \
            "(0x200267C2), $${QT_WEBKIT_MAJOR_VERSION}, $${QT_WEBKIT_MINOR_VERSION}, $${QT_WEBKIT_PATCH_VERSION}, {$$addLanguageDependentPkgItem(webkit_pkg_name)}"
    } else {
        default_deployment.pkg_prerules -= pkg_depends_webkit
    }
} else {
    default_deployment.pkg_prerules -= pkg_depends_webkit pkg_depends_qt
}

isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000
isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x020000 0x800000

# Supports Symbian^3 platforms by default and also S60 3.1, 3.2, and 5.0 if built against any of those.
platform_product_id = S60ProductID
platform_product_id = $$addLanguageDependentPkgItem(platform_product_id)
pkg_platform_dependencies = \
    "; Default HW/platform dependencies" \
    "[0x20022E6D],0,0,0,{$$platform_product_id}" \
    "[0x2003A678],0,0,0,{$$platform_product_id}"
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
    pkg_platform_dependencies += \
        "[0x102032BE],0,0,0,{$$platform_product_id}" \
        "[0x102752AE],0,0,0,{$$platform_product_id}" \
        "[0x1028315F],0,0,0,{$$platform_product_id}"
}
