2011-11-24 07:01:08 +00:00
|
|
|
defineReplace(qtPlatformTargetSuffix) {
|
|
|
|
CONFIG(debug, debug|release) {
|
|
|
|
!debug_and_release|build_pass {
|
|
|
|
mac:return(_debug)
|
|
|
|
win32:return(d)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return()
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
defineReplace(qtLibraryTarget) {
|
|
|
|
unset(LIBRARY_NAME)
|
|
|
|
LIBRARY_NAME = $$1
|
|
|
|
mac:!static:contains(QT_CONFIG, qt_framework) {
|
|
|
|
QMAKE_FRAMEWORK_BUNDLE_NAME = $$LIBRARY_NAME
|
|
|
|
export(QMAKE_FRAMEWORK_BUNDLE_NAME)
|
|
|
|
}
|
2011-11-24 07:01:08 +00:00
|
|
|
unset(LIBRARY_SUFFIX)
|
|
|
|
contains(TEMPLATE, .*lib):LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
|
|
|
|
isEmpty(LIBRARY_SUFFIX):return($$LIBRARY_NAME)
|
|
|
|
else:return($$member(LIBRARY_NAME, 0)$$LIBRARY_SUFFIX)
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
defineTest(qtAddLibrary) {
|
2012-03-01 17:49:29 +00:00
|
|
|
warning("qtAddLibrary() is deprecated. Use qtAddModule() or QT+= instead.")
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-03-01 17:49:29 +00:00
|
|
|
# Reverse-engineer the module name from the library name.
|
|
|
|
for(var, $$list($$find($$list($$enumerate_vars()), ^QT\\.[^.]+\\.name$))) {
|
|
|
|
isEqual($$var, $$1) {
|
|
|
|
var ~= s,^QT\\.([^.]+)\\.name$,\\1,
|
|
|
|
qtAddModule($$var):return(true):break()
|
|
|
|
return(false):break() # Yes, the break is insanity. But necessary.
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2012-03-01 17:49:29 +00:00
|
|
|
error("No module matching library '$$1' found.")
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 04:20:01 +00:00
|
|
|
defineTest(qtAddModule) {
|
|
|
|
MODULE_NAME = $$eval(QT.$${1}.name)
|
|
|
|
MODULE_INCLUDES = $$eval(QT.$${1}.includes)
|
|
|
|
MODULE_LIBS = $$eval(QT.$${1}.libs)
|
2011-09-15 22:47:33 +00:00
|
|
|
MODULE_CONFIG = $$eval(QT.$${1}.module_config)
|
2011-12-06 07:44:59 +00:00
|
|
|
MODULE_MAJOR_VERSION = $$eval(QT.$${1}.MAJOR_VERSION)
|
2010-11-25 04:20:01 +00:00
|
|
|
|
|
|
|
CONFIG += $$eval(QT.$${1}.CONFIG)
|
|
|
|
DEFINES += $$eval(QT.$${1}.DEFINES)
|
|
|
|
|
2012-04-10 16:49:01 +00:00
|
|
|
unix {
|
|
|
|
MODULE_INCLUDES -= /usr/include /usr/local/include
|
|
|
|
MODULE_LIBS -= /usr/lib /usr/local/lib
|
|
|
|
}
|
|
|
|
|
|
|
|
INCLUDEPATH *= $$MODULE_INCLUDES
|
2011-04-20 18:57:51 +00:00
|
|
|
isEqual(2, UsePrivate) { # Tests function parameter 2 ($$2) being equal to 'UsePrivate'
|
|
|
|
# This adds both
|
|
|
|
# <module privates include path>/
|
|
|
|
# and <module privates include path>/<module name>
|
|
|
|
# since we have code using both #include <QtCore/private/foo> and #include <private/foo>
|
|
|
|
# Both need to be supported with the new private includes structure
|
|
|
|
MODULE_INCLUDES_PRIVATES = $$eval(QT.$${1}.private_includes)
|
2012-04-10 16:49:01 +00:00
|
|
|
INCLUDEPATH += $$MODULE_INCLUDES_PRIVATES $$MODULE_INCLUDES_PRIVATES/$$MODULE_NAME
|
2011-04-20 18:57:51 +00:00
|
|
|
}
|
2010-11-25 04:20:01 +00:00
|
|
|
|
|
|
|
unset(LINKAGE)
|
|
|
|
mac {
|
2011-09-15 22:47:33 +00:00
|
|
|
!contains(MODULE_CONFIG,staticlib):CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced
|
|
|
|
QMAKE_FRAMEWORKPATH *= $${MODULE_LIBS}
|
2012-04-12 18:54:05 +00:00
|
|
|
FRAMEWORK_INCLUDE = $${MODULE_LIBS}.framework/Headers
|
2012-04-10 16:49:01 +00:00
|
|
|
!qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE): \
|
|
|
|
INCLUDEPATH *= $$FRAMEWORK_INCLUDE
|
2011-09-15 22:47:33 +00:00
|
|
|
LINKAGE = -framework $${MODULE_NAME}$${QT_LIBINFIX}
|
2011-08-24 07:47:20 +00:00
|
|
|
}
|
2010-11-25 04:20:01 +00:00
|
|
|
}
|
2011-08-24 07:47:20 +00:00
|
|
|
|
2011-12-06 07:44:59 +00:00
|
|
|
win32 {
|
|
|
|
# Make sure we link against the version pulled from the module's .pri
|
|
|
|
ver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}_VERSION_OVERRIDE
|
|
|
|
dver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}D_VERSION_OVERRIDE
|
|
|
|
$$ver_var = $$MODULE_MAJOR_VERSION
|
|
|
|
$$dver_var = $$MODULE_MAJOR_VERSION
|
|
|
|
export($$ver_var)
|
|
|
|
export($$dver_var)
|
|
|
|
}
|
|
|
|
|
2010-11-25 04:20:01 +00:00
|
|
|
isEmpty(LINKAGE) {
|
2012-03-12 11:03:47 +00:00
|
|
|
!isEmpty(MODULE_LIBS) {
|
2012-04-11 16:25:29 +00:00
|
|
|
QMAKE_LIBDIR *= $$MODULE_LIBS
|
|
|
|
!isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) {
|
|
|
|
# Make sure we can link to uninstalled libraries
|
2012-03-12 11:03:47 +00:00
|
|
|
unix:!mac:QMAKE_LFLAGS *= "-Wl,-rpath-link,$$MODULE_LIBS"
|
|
|
|
}
|
2010-11-25 04:20:01 +00:00
|
|
|
}
|
|
|
|
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
|
|
|
|
win32:LINKAGE = -l$${MODULE_NAME}$${QT_LIBINFIX}d
|
|
|
|
mac:LINKAGE = -l$${MODULE_NAME}$${QT_LIBINFIX}_debug
|
|
|
|
}
|
|
|
|
isEmpty(LINKAGE):LINKAGE = -l$${MODULE_NAME}$${QT_LIBINFIX}
|
|
|
|
}
|
2011-04-20 18:57:51 +00:00
|
|
|
# Only link to this module if a libs directory is set, else this is just a module
|
|
|
|
# to give access to sources or include files, and not for linking.
|
|
|
|
!isEmpty(MODULE_LIBS) {
|
|
|
|
!isEmpty(QMAKE_LSB) {
|
2012-03-05 10:49:51 +00:00
|
|
|
QMAKE_LFLAGS *= --lsb-libpath=$$MODULE_LIBS
|
2011-04-20 18:57:51 +00:00
|
|
|
QMAKE_LFLAGS *= -L/opt/lsb/lib
|
|
|
|
QMAKE_LFLAGS *= --lsb-shared-libs=$${MODULE_NAME}$${QT_LIBINFIX}
|
|
|
|
}
|
|
|
|
LIBS += $$LINKAGE
|
2010-11-25 04:20:01 +00:00
|
|
|
}
|
|
|
|
export(CONFIG)
|
|
|
|
export(DEFINES)
|
|
|
|
export(LIBS)
|
|
|
|
export(INCLUDEPATH)
|
|
|
|
export(QMAKE_FRAMEWORKPATH)
|
|
|
|
export(QMAKE_LFLAGS)
|
2011-01-24 09:14:42 +00:00
|
|
|
export(QMAKE_LIBDIR)
|
2010-11-25 04:20:01 +00:00
|
|
|
return(true)
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
# variable, default
|
|
|
|
defineTest(qtPrepareTool) {
|
2012-03-22 11:40:00 +00:00
|
|
|
MODBASE = $$[QT_HOST_BINS/get]
|
2011-01-06 18:52:17 +00:00
|
|
|
count(ARGS, 2, greaterThan) {
|
|
|
|
isEmpty(QT.$${3}.bins):warning("No QT.$${3}.bins, module path ignored for qtPrepareTool($$1, $$2, $$3)")
|
|
|
|
else:MODBASE = $$eval(QT.$${3}.bins)
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2011-01-06 18:52:17 +00:00
|
|
|
isEmpty($$1):$$1 = $$MODBASE/$$2
|
2011-04-27 10:05:43 +00:00
|
|
|
$$1 ~= s,[/\\\\],$$QMAKE_DIR_SEP,
|
|
|
|
contains(QMAKE_HOST.os, Windows):!contains($$1, .*\\.(exe|bat)$) {
|
|
|
|
exists($$eval($$1).bat) {
|
|
|
|
$$1 = $$eval($$1).bat
|
|
|
|
} else {
|
|
|
|
$$1 = $$eval($$1).exe
|
|
|
|
}
|
2012-03-26 09:32:52 +00:00
|
|
|
} else:contains(QMAKE_HOST.os, Darwin) {
|
|
|
|
BUNDLENAME = $$eval($$1).app/Contents/MacOS/$$2
|
|
|
|
exists($$BUNDLENAME) {
|
|
|
|
$$1 = $$BUNDLENAME
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2012-03-26 09:32:52 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
export($$1)
|
|
|
|
}
|
|
|
|
|
2011-10-19 13:36:33 +00:00
|
|
|
defineReplace(pkgConfigExecutable) {
|
|
|
|
isEmpty(PKG_CONFIG) {
|
|
|
|
PKG_CONFIG = pkg-config
|
|
|
|
|
|
|
|
!isEmpty(PKG_CONFIG_SYSROOT_DIR) {
|
|
|
|
win32:isEmpty(MINGW_IN_SHELL):PKG_CONFIG = set PKG_CONFIG_SYSROOT_DIR=$$PKG_CONFIG_SYSROOT_DIR& $$PKG_CONFIG
|
|
|
|
else:PKG_CONFIG = PKG_CONFIG_SYSROOT_DIR=\"$$PKG_CONFIG_SYSROOT_DIR\" $$PKG_CONFIG
|
|
|
|
}
|
|
|
|
|
|
|
|
!isEmpty(PKG_CONFIG_LIBDIR) {
|
|
|
|
win32:isEmpty(MINGW_IN_SHELL):PKG_CONFIG = set PKG_CONFIG_LIBDIR=$$PKG_CONFIG_LIBDIR& $$PKG_CONFIG
|
|
|
|
else:PKG_CONFIG = PKG_CONFIG_LIBDIR=\"$$PKG_CONFIG_LIBDIR\" $$PKG_CONFIG
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return($$PKG_CONFIG)
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
defineTest(packagesExist) {
|
|
|
|
# this can't be done in global scope here because qt_functions is loaded
|
|
|
|
# before the .pro is parsed, so if the .pro set PKG_CONFIG, we wouldn't know it
|
|
|
|
# yet. oops.
|
2011-10-19 13:36:33 +00:00
|
|
|
|
|
|
|
pkg_config = $$pkgConfigExecutable()
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
for(package, ARGS) {
|
2011-10-19 13:36:33 +00:00
|
|
|
!system($$pkg_config --exists $$package):return(false)
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return(true)
|
|
|
|
}
|
|
|
|
|