summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qt_tool.prf
blob: f0864f9e74f018e5768d5385c1451d156e641218 (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
#
#  W A R N I N G
#  -------------
#
# This file is not part of the Qt API.  It exists purely as an
# implementation detail.  It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#

load(qt_app)

CONFIG += console

# If we are doing a prefix build, create a "module" pri which enables
# qtPrepareTool() to work with the non-installed build.
# Non-bootstrapped tools always need this because of the environment setup.
!build_pass:if(!host_build|!force_bootstrap|force_independent) {
    isEmpty(MODULE):MODULE = $$TARGET

    !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, _private)

    load(qt_build_paths)

    load(resolve_target)

    TOOL_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_tool_$${MODULE}.pri

    vars = binary depends
    !isEmpty(QT_TOOL_ENV) {
        vars += envvars
        module_var_names =
        module_var_sets =
        for(var, QT_TOOL_ENV) {
            vars += env.$${var}.name env.$${var}.value
            module_var_names += QT_TOOL.$${MODULE}.env.$${var}
            module_var_sets += \
                "QT_TOOL.$${MODULE}.env.$${var}.name = $$val_escape($${var}.name)" \
                "QT_TOOL.$${MODULE}.env.$${var}.value = $$val_escape($${var}.value)"
        }
        module_envvars = \
            "QT_TOOL.$${MODULE}.envvars = $$module_var_names" \
            $$module_var_sets
    } else {
        module_envvars =
    }
    TOOL_PRI_CONT = \
        "QT_TOOL.$${MODULE}.binary = $$QMAKE_RESOLVED_TARGET" \
        "QT_TOOL.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
        $$module_envvars
    write_file($$TOOL_PRI, TOOL_PRI_CONT)|error("Aborting.")

    # Then, inject the new tool into the current cache state
    !contains(QMAKE_INTERNAL_INCLUDED_FILES, $$TOOL_PRI) { # before the actual include()!
        added = $$TOOL_PRI
        cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, added)
        unset(added)
    }
    include($$TOOL_PRI)
    for(var, vars): \
        cache(QT_TOOL.$${MODULE}.$$var, transient)

}