summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/uic.prf
blob: eaf373a520fa843402a969d49534e477fae7ff6d (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

isEmpty(QMAKE_UIC3) {
    contains(QMAKE_HOST.os,Windows):QMAKE_UIC3 = $$[QT_INSTALL_BINS]\uic3.exe
    else:QMAKE_UIC3 = $$[QT_INSTALL_BINS]/uic3
}

isEmpty(QMAKE_UIC) {
   contains(QMAKE_HOST.os,Windows):QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe
   else:QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
}

isEmpty(UI_DIR):UI_DIR = .
isEmpty(UI_SOURCES_DIR):UI_SOURCES_DIR = $$UI_DIR
isEmpty(UI_HEADERS_DIR):UI_HEADERS_DIR = $$UI_DIR
isEmpty(QMAKE_MOD_UIC):QMAKE_MOD_UIC = ui_

# Allow FORMS3 to contain old UIC3 forms, while FORMS contains new
# UIC files in the same project. However, if CONFIG+=uic3 and no
# FORMS3 is defined, FORMS may only contain old UIC3 files.

!uic3|!isEmpty(FORMS3) {
    # If we have CONFIG+=uic3 and no FORMS3, then don't do this step,
    # as UIC3 files don't need a ui_<formname>.h file

    uic.commands = $$QMAKE_UIC ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
    uic.depend_command = "$$QMAKE_UIC" -d "${QMAKE_FILE_IN}"
    uic.output = $$UI_HEADERS_DIR/$${QMAKE_MOD_UIC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
    uic.input = FORMS
    uic.variable_out = GENERATED_FILES
    uic.CONFIG += no_link target_predeps
    uic.name = UIC ${QMAKE_FILE_IN}
    silent:uic.commands = @echo uic ${QMAKE_FILE_IN} && $$uic.commands
    QMAKE_EXTRA_COMPILERS += uic
    INCREDIBUILD_XGE += uic
}

!isEmpty(FORMS)|!isEmpty(FORMS3) {
    ui_dir_short = $$UI_HEADERS_DIR
    contains(QMAKE_HOST.os,Windows):ui_dir_short ~= s,^.:,/,
    contains(ui_dir_short, ^[/\\\\].*):INCLUDEPATH += $$UI_HEADERS_DIR
    else:INCLUDEPATH += $$OUT_PWD/$$UI_HEADERS_DIR
}

# Backwards compatibility: Make shadow builds with default UI_DIR work
# if the user did not add the source dir explicitly.
equals(UI_DIR, .) {
    CONFIG -= include_source_dir
    CONFIG = include_source_dir $$CONFIG
}

uic3 {
    isEmpty(FORMS3) {
        UIC3_FORMS = FORMS
        !build_pass:message("Project contains CONFIG+=uic3, but no files in FORMS3; UI files in FORMS treated as UIC3 form files.")
    } else {
        UIC3_FORMS = FORMS3
    }

    uic3_decl.commands = $$QMAKE_UIC3 ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
    uic3_decl.dependency_type = TYPE_UI
    uic3_decl.output = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
    uic3_decl.input = $$UIC3_FORMS
    uic3_decl.CONFIG += no_link
    uic3_decl.variable_out = GENERATED_FILES UIC3_HEADERS
    uic3_decl.name = UIC3 Decl ${QMAKE_FILE_IN}
    silent:uic3_decl.commands = @echo uic3 ${QMAKE_FILE_IN} && $$uic3_decl.commands
    QMAKE_EXTRA_COMPILERS += uic3_decl

    uic3_impl.commands = $$QMAKE_UIC3 -impl ${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
    uic3_impl.dependency_type = TYPE_UI
    uic3_impl.output = $$UI_SOURCES_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_CPP)}
    uic3_impl.depends = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
    uic3_impl.input = $$UIC3_FORMS
    uic3_impl.variable_out = GENERATED_SOURCES
    uic3_impl.name = UIC3 Impl ${QMAKE_FILE_IN}
    silent:uic3_impl.commands = @echo uic3 -impl ${QMAKE_FILE_IN} && $$uic3_impl.commands
    QMAKE_EXTRA_COMPILERS += uic3_impl

    ### add a moc step
    load(moc)
    uic3_moc.commands = $$moc_header.commands
    uic3_moc.output = $$moc_header.output
    uic3_moc.depends = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
    uic3_moc.input = UIC3_HEADERS
    uic3_moc.variable_out = GENERATED_SOURCES
    uic3_moc.name = $$moc_header.name
    QMAKE_EXTRA_COMPILERS += uic3_moc
}

defineReplace(imageCollectionCmd) {
    unset(EMBEDDED_IMAGES)
    RET =
    for(image, $$list($$split(1))) {
           EMBEDDED_IMAGES += $$image
           count(EMBEDDED_IMAGES, 5) {
                isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > images.tmp $$escape_expand(\n\t)
                else:         RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\n\t)
                unset(EMBEDDED_IMAGES)
           }
    }
    !isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\n\t)
    !isEmpty(RET) {
        RET += $$QMAKE_UIC3 -embed $$TARGET -f images.tmp -o $$2 $$escape_expand(\n\t)
        return($$RET)
    }
    return($$QMAKE_UIC3 -embed $$TARGET $$1 -o $$2)
}

image_collection.output = qmake_image_collection$${first(QMAKE_EXT_CPP)}
image_collection.variable_out = SOURCES
image_collection.input = IMAGES
image_collection.CONFIG += combine
image_collection.name = UIC3 Image collection in ${QMAKE_FILE_OUT}
!win32 {
    image_collection.commands = $$QMAKE_UIC3 -embed $$TARGET ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
    silent:image_collection.commands = @echo uic3 -embed ${QMAKE_FILE_IN} && $$image_collection.commands
} else {
    image_collection.commands = ${QMAKE_FUNC_imageCollectionCmd}
    silent:image_collection.commands = @echo uic3 -embed $$TARGET -f images.tmp && $image_collection.commands
}
QMAKE_EXTRA_COMPILERS += image_collection