2012-12-11 21:08:15 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2013-01-24 19:32:30 +00:00
|
|
|
defineTest(addInstallFiles) {
|
|
|
|
for(sf, 2) {
|
|
|
|
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): \
|
|
|
|
$$1 *= $$sfp
|
|
|
|
else: \
|
|
|
|
$$1 += $$sf
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export($$1)
|
|
|
|
}
|
|
|
|
|
2019-10-21 13:39:50 +00:00
|
|
|
moduleRoot = $$dirname(_QMAKE_CONF_)
|
|
|
|
probase = $$relative_path($$_PRO_FILE_PWD_, $$moduleRoot/examples)
|
2017-06-28 14:16:04 +00:00
|
|
|
isEmpty(probase)|contains(probase, ^\\..*): \
|
2017-06-28 14:07:19 +00:00
|
|
|
return()
|
|
|
|
|
2017-06-28 14:16:04 +00:00
|
|
|
isEmpty(_QMAKE_CACHE_) {
|
2019-10-21 13:39:50 +00:00
|
|
|
moduleRootRelativeToBuildDir = $$relative_path($$moduleRoot, $$OUT_PWD)
|
|
|
|
# Check if OUT_PWD is inside module root
|
|
|
|
equals(moduleRootRelativeToBuildDir, .)|contains(moduleRootRelativeToBuildDir, \(\.\./\)+\(\.\.\)?): \
|
|
|
|
error("You cannot build examples inside the Qt source tree, except as part of a proper Qt build.")
|
2017-06-28 14:16:04 +00:00
|
|
|
}
|
|
|
|
|
2017-06-28 14:08:36 +00:00
|
|
|
contains(TEMPLATE, "vc.*"): \
|
|
|
|
return()
|
|
|
|
|
|
|
|
contains(TEMPLATE, .*app): \
|
|
|
|
qtSetQmlPath()
|
|
|
|
|
2017-06-28 14:07:19 +00:00
|
|
|
for(ex, EXAMPLE_FILES): \
|
|
|
|
sourcefiles += $$files($$absolute_path($$ex, $$_PRO_FILE_PWD_))
|
|
|
|
for(res, RESOURCES) {
|
2018-02-21 11:33:29 +00:00
|
|
|
!contains(res, .*\\.qrc): \
|
2018-01-15 11:02:16 +00:00
|
|
|
next()
|
|
|
|
rfile = $$absolute_path($$res, $$_PRO_FILE_PWD_)
|
|
|
|
rpath = $$dirname(rfile)
|
|
|
|
rcont = $$cat($$rfile, lines)
|
|
|
|
for (rline, rcont) {
|
2017-06-28 14:07:19 +00:00
|
|
|
resrc = $$replace(rline, ^[ \\t]*<file[^>]*>([^<]+)</file>[ \\t]*$, \\1)
|
|
|
|
!equals(resrc, $$rline): \
|
2018-01-15 11:02:16 +00:00
|
|
|
sourcefiles += $$absolute_path($$resrc, $$rpath)
|
2012-11-27 19:40:16 +00:00
|
|
|
}
|
2017-06-28 14:07:19 +00:00
|
|
|
}
|
|
|
|
for(res, RC_FILE) {
|
2018-01-15 11:02:16 +00:00
|
|
|
rfile = $$absolute_path($$res, $$_PRO_FILE_PWD_)
|
|
|
|
rpath = $$dirname(rfile)
|
|
|
|
rcont = $$cat($$rfile, lines)
|
|
|
|
for (rline, rcont) {
|
2017-06-28 14:07:19 +00:00
|
|
|
resrc = $$replace(rline, "^\\d+\\s+ICON\\s+[^\"]*\"([^\"]+)\"\$", \\1)
|
|
|
|
!equals(resrc, $$rline): \
|
2018-01-15 11:02:16 +00:00
|
|
|
sourcefiles += $$absolute_path($$resrc, $$rpath)
|
2012-11-27 19:40:16 +00:00
|
|
|
}
|
2017-06-28 14:07:19 +00:00
|
|
|
}
|
|
|
|
sourcefiles += \
|
|
|
|
$$ANDROID_PACKAGE_SOURCE_DIR \
|
|
|
|
$$QMAKE_INFO_PLIST \
|
|
|
|
$$DISTFILES
|
|
|
|
extras = \
|
|
|
|
$$_PRO_FILE_PWD_/README \
|
|
|
|
$$_PRO_FILE_PWD_/README.TXT \
|
2020-04-22 07:52:52 +00:00
|
|
|
$$_PRO_FILE_PWD_/qmldir \
|
2017-06-28 14:07:19 +00:00
|
|
|
$$files($$_PRO_FILE_PWD_/*.pri) \
|
|
|
|
$$replace(_PRO_FILE_, \\.pro$, .qmlproject) \
|
|
|
|
$$replace(_PRO_FILE_, \\.pro$, .json) \
|
|
|
|
$$replace(_PRO_FILE_, \\.pro$, .inf)
|
|
|
|
for(extra, extras): \
|
|
|
|
exists($$extra): \
|
|
|
|
sourcefiles += $$extra
|
2012-11-27 19:40:16 +00:00
|
|
|
|
2017-06-28 14:07:19 +00:00
|
|
|
# Just for Qt Creator
|
|
|
|
OTHER_FILES += $$sourcefiles
|
2012-11-27 19:40:16 +00:00
|
|
|
|
2017-06-28 14:07:19 +00:00
|
|
|
sourcefiles += \
|
|
|
|
$$_PRO_FILE_ $$RC_FILE $$DEF_FILE \
|
|
|
|
$$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \
|
|
|
|
$$DBUS_ADAPTORS $$DBUS_INTERFACES
|
|
|
|
addInstallFiles(sources.files, $$sourcefiles)
|
|
|
|
sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase
|
|
|
|
INSTALLS += sources
|
2012-11-27 19:40:16 +00:00
|
|
|
|
2017-06-28 14:07:19 +00:00
|
|
|
check_examples {
|
|
|
|
srcfiles = $$sources.files
|
|
|
|
for(inst, INSTALLS): \
|
|
|
|
!equals(inst, target):!contains($${inst}.CONFIG, no_check_exist): \
|
|
|
|
for(file, $${inst}.files): \
|
|
|
|
instfiles += $$files($$absolute_path($$file, $$_PRO_FILE_PWD_))
|
|
|
|
addInstallFiles(srcfiles, $$instfiles)
|
2013-01-24 19:32:30 +00:00
|
|
|
|
2017-06-28 14:07:19 +00:00
|
|
|
thefiles = $$files($$_PRO_FILE_PWD_/*)
|
|
|
|
for(i, thefiles): \
|
|
|
|
allfiles += $$relative_path($$i, $$_PRO_FILE_PWD_)
|
|
|
|
for(i, srcfiles): \
|
|
|
|
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
|
2012-11-27 19:40:16 +00:00
|
|
|
}
|
2017-06-28 14:07:19 +00:00
|
|
|
allfiles -= $$sd
|
2012-11-27 19:40:16 +00:00
|
|
|
}
|
2017-06-28 14:07:19 +00:00
|
|
|
allfiles -= doc
|
|
|
|
!isEmpty(allfiles): warning("remaining files in $$_PRO_FILE_PWD_: $$allfiles")
|
|
|
|
}
|
2012-12-21 18:36:12 +00:00
|
|
|
|
2017-06-28 14:07:19 +00:00
|
|
|
equals(TEMPLATE, app)|equals(TEMPLATE, lib) {
|
|
|
|
!contains(INSTALLS, target) {
|
|
|
|
!install_ok: \
|
|
|
|
error("$$_PRO_FILE_ is lacking an install target.")
|
|
|
|
else: check_examples: \
|
|
|
|
warning("$$_PRO_FILE_ is lacking an install target.")
|
|
|
|
} else: !equals(target.path, $$sources.path) {
|
|
|
|
!install_ok: \
|
|
|
|
error("$$_PRO_FILE_ installs target to unexpected location.")
|
|
|
|
else: check_examples: \
|
|
|
|
warning("$$_PRO_FILE_ installs target to unexpected location.")
|
2016-04-20 19:11:03 +00:00
|
|
|
}
|
2017-06-28 14:07:19 +00:00
|
|
|
}
|
2016-04-20 19:11:03 +00:00
|
|
|
|
2017-06-28 14:07:19 +00:00
|
|
|
!equals(TEMPLATE, subdirs):!compile_examples {
|
|
|
|
TEMPLATE = aux
|
|
|
|
CONFIG -= have_target qt staticlib dll
|
|
|
|
SOURCES =
|
|
|
|
OBJECTIVE_SOURCES =
|
|
|
|
INSTALLS -= target
|
2020-04-22 07:52:52 +00:00
|
|
|
QMAKE_SUBSTITUTES =
|
|
|
|
QMAKE_EXTRA_COMPILERS =
|
|
|
|
COPIES =
|
2017-06-28 14:07:19 +00:00
|
|
|
} else {
|
|
|
|
CONFIG += relative_qt_rpath # Examples built as part of Qt should be relocatable
|
2012-11-27 19:40:16 +00:00
|
|
|
}
|