aeb036ed87
it's confusing for the users if the examples' project files contain code to install their own sources. also, this constitutes an enormous code duplication, and lots of mistakes. consequently, automate it. more or less as a side effect, this also removes the entirely meaningless target installs in subdirs projects. Task-number: QTBUG-28184 Change-Id: I9fc1367a06db9e2c46aeb67d68729a4f67163ef9 Reviewed-by: hjk <qthjk@ovi.com>
72 lines
2.4 KiB
Plaintext
72 lines
2.4 KiB
Plaintext
probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples)
|
|
!contains(probase, ^\\..*) {
|
|
for(ex, EXAMPLE_FILES): \
|
|
sourcefiles += $$files($$absolute_path($$ex, $$_PRO_FILE_PWD_))
|
|
for(res, RESOURCES) {
|
|
rfile = $$cat($$absolute_path($$res, $$_PRO_FILE_PWD_), lines)
|
|
for(rline, rfile) {
|
|
resrc = $$replace(rline, ^[ \\t]*<file[^>]*>([^<]+)</file>[ \\t]*$, \\1)
|
|
!equals(resrc, $$rline): \
|
|
sourcefiles += $$resrc
|
|
}
|
|
}
|
|
for(res, RC_FILE) {
|
|
rfile = $$cat($$absolute_path($$res, $$_PRO_FILE_PWD_), lines)
|
|
for(rline, rfile) {
|
|
resrc = $$replace(rline, "^\\d+\\s+ICON\\s+[^\"]*\"([^\"]+)\"\$", \\1)
|
|
!equals(resrc, $$rline): \
|
|
sourcefiles += $$resrc
|
|
}
|
|
}
|
|
extras = \
|
|
$$_PRO_FILE_PWD_/README \
|
|
$$files($$_PRO_FILE_PWD_/*.pri) \
|
|
$$replace(_PRO_FILE_, \\.pro$, .json) \
|
|
$$replace(_PRO_FILE_, \\.pro$, .inf)
|
|
for(extra, extras): \
|
|
exists($$extra): \
|
|
sourcefiles += $$extra
|
|
|
|
# Just for Qt Creator
|
|
OTHER_FILES += $$sourcefiles
|
|
|
|
sourcefiles += \
|
|
$$_PRO_FILE_ $$RC_FILE $$DEF_FILE \
|
|
$$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \
|
|
$$DBUS_ADAPTORS $$DBUS_INTERFACES
|
|
for(sf, sourcefiles) {
|
|
sf = $$relative_path($$sf, $$_PRO_FILE_PWD_)
|
|
contains(sf, \\..*) {
|
|
check_examples: message("Notice: $$_PRO_FILE_ refers to $$sf")
|
|
} else {
|
|
sfp = $$replace(sf, /.*, )
|
|
!equals(sfp, $$sf): \
|
|
sources.files *= $$sfp
|
|
else: \
|
|
sources.files += $$sf
|
|
}
|
|
}
|
|
sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase
|
|
INSTALLS += sources
|
|
|
|
check_examples {
|
|
thefiles = $$files($$_PRO_FILE_PWD_/*)
|
|
for(i, thefiles): \
|
|
allfiles += $$relative_path($$i, $$_PRO_FILE_PWD_)
|
|
for(i, sources.files): \
|
|
allfiles -= $$relative_path($$i, $$_PRO_FILE_PWD_)
|
|
for(i, SUBDIRS) {
|
|
sd = $$eval($${i}.file)
|
|
!isEmpty(sd) {
|
|
sd ~= s,/.*,,
|
|
} else {
|
|
sd = $$eval($${i}.subdir)
|
|
isEmpty(sd): sd = $$i
|
|
}
|
|
allfiles -= $$sd
|
|
}
|
|
allfiles -= doc
|
|
!isEmpty(allfiles): warning("remaining files in $$_PRO_FILE_PWD_: $$allfiles")
|
|
}
|
|
}
|