blob: f84f1d87bf20157dcd12058c4851cd70b0862a95 (
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
|
defineReplace(generate_resource) {
GENERATED_FILE = $$OUT_PWD/$$1
INCLUDED_FILES = $$2
GENERATED_CONTENT = \
"<RCC>"
RESOURCE_PREFIX = ""
for (FILE, INCLUDED_FILES) {
RELATIVE_PATH = $$relative_path($$absolute_path($$FILE), $$_PRO_FILE_PWD_)
SUB_FOLDER = /$$dirname(RELATIVE_PATH)
!equals(SUB_FOLDER, $$RESOURCE_PREFIX) {
!isEmpty(RESOURCE_PREFIX): GENERATED_CONTENT += "</qresource>"
RESOURCE_PREFIX = "ExtrasImports"/$$TARGETPATH$$SUB_FOLDER
GENERATED_CONTENT += "<qresource prefix=\"$$RESOURCE_PREFIX\">"
}
ABSOLUTE_PATH = $$absolute_path($$FILE)
ALIAS_NAME = $$basename(FILE)
GENERATED_CONTENT += "<file alias=\"$$ALIAS_NAME\">$$ABSOLUTE_PATH</file>"
}
!isEmpty(RESOURCE_PREFIX): GENERATED_CONTENT += "</qresource>"
GENERATED_CONTENT += \
"</RCC>"
write_file($$GENERATED_FILE, GENERATED_CONTENT)|error("Failed to write resource file!")
return($$GENERATED_FILE)
}
|