3bd2c690f4
foo.name = VAR foo.value = baz bar foo.CONFIG = prepend QT_TOOL_ENV += foo will add the respective environment assignment to the generated command line. if value is a list, the elements are joined with the shell's path list separator. the value must be in the final form (correct path separators and shell-escaped). if .CONFIG prepend is set, the generated command will prepend the new value to a pre-existing one. Change-Id: I62c6dfb3ec50ce73d3a85a2099275f92b57a52dc Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
99 lines
3.4 KiB
Plaintext
99 lines
3.4 KiB
Plaintext
TEMPLATE = app
|
|
|
|
CONFIG += qt warn_on console
|
|
isEmpty(QMAKE_INFO_PLIST): CONFIG -= app_bundle
|
|
|
|
build_all:!build_pass {
|
|
CONFIG -= build_all
|
|
CONFIG += release
|
|
}
|
|
|
|
target.path = $$[QT_INSTALL_BINS]
|
|
INSTALLS += target
|
|
|
|
# If we are doing a prefix build, create a "module" pri which enables
|
|
# qtPrepareTool() to work with the non-installed build.
|
|
!build_pass:!exists($$[QT_INSTALL_PREFIX]/.qmake.cache) {
|
|
|
|
isEmpty(MODULE):MODULE = $$TARGET
|
|
|
|
MODULE_DEPENDS = $$replace(QT, -private$, )
|
|
|
|
# Find the module's source root dir.
|
|
MODULE_PROFILE_DIR = $$_PRO_FILE_PWD_
|
|
for(ever) {
|
|
exists($$MODULE_PROFILE_DIR/sync.profile):break()
|
|
nmpri = $$dirname(MODULE_PROFILE_DIR)
|
|
equals(nmpri, $$MODULE_PROFILE_DIR): \
|
|
error("No sync.profile found. This does not look like a Qt module source tree.")
|
|
MODULE_PROFILE_DIR = $$nmpri
|
|
unset(nmpri)
|
|
}
|
|
|
|
isEmpty(MODULE_BASE_DIR): MODULE_BASE_DIR = $$MODULE_PROFILE_DIR
|
|
MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_DIR)
|
|
isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR
|
|
|
|
load(resolve_target)
|
|
cmd = $$shell_path($$QMAKE_RESOLVED_TARGET)
|
|
deps = $$resolve_depends(QT, "QT.")
|
|
!isEmpty(deps) {
|
|
plugin_paths =
|
|
for(dep, deps) {
|
|
deppath += $$shell_path($$eval(QT.$${dep}.libs))
|
|
for(rpath, QT.$${dep}.rpath_link): \
|
|
deppath += $$shell_path($$rpath)
|
|
plugin_paths += $$eval(QT.$${dep}.plugin_path) $$eval(QT.$${dep}.plugins)
|
|
}
|
|
equals(QMAKE_HOST.os, Windows): \
|
|
deppath.name = PATH
|
|
else:contains(QMAKE_HOST.os, Linux|FreeBSD): \
|
|
deppath.name = LD_LIBRARY_PATH
|
|
else:equals(QMAKE_HOST.os, Darwin): \
|
|
deppath.name = DYLD_LIBRARY_PATH
|
|
else: \
|
|
error("Operating system not supported.")
|
|
deppath.value = $$unique(deppath)
|
|
deppath.CONFIG = prepend
|
|
pluginpath.name = QT_PLUGIN_PATH
|
|
pluginpath.value =
|
|
plugin_paths = $$unique(plugin_paths)
|
|
for(ppath, plugin_paths): \
|
|
exists($$ppath): \
|
|
pluginpath.value += $$shell_path($$ppath)
|
|
QT_TOOL_ENV += deppath pluginpath
|
|
}
|
|
|
|
for(env, QT_TOOL_ENV) {
|
|
value = $$eval($${env}.value)
|
|
!isEmpty(value) {
|
|
name = $$eval($${env}.name)
|
|
equals(QMAKE_DIR_SEP, /) {
|
|
contains($${env}.CONFIG, prepend): infix = \${$$name:+:\$$$name}
|
|
else: infix =
|
|
cmd = "$$name=$$join(value, :)$$infix $$cmd"
|
|
} else {
|
|
# Escape closing parens when expanding the variable, otherwise cmd confuses itself.
|
|
contains($${env}.CONFIG, prepend): infix = ;%$$name:)=^)%
|
|
else: infix =
|
|
cmd = "(set $$name=$$join(value, ;)$$infix) & $$cmd"
|
|
}
|
|
}
|
|
}
|
|
|
|
TOOL_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_$${MODULE}.pri
|
|
|
|
TOOL_PRI_CONT = "QT_TOOL.$${MODULE}.command = $$val_escape(cmd)"
|
|
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)
|
|
cache(QT_TOOL.$${MODULE}.command, transient)
|
|
|
|
}
|