981dd3b314
Change-Id: I1db834500921681676a6f46e7750bdd81bf0093d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
200 lines
7.3 KiB
Plaintext
200 lines
7.3 KiB
Plaintext
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)
|
|
}
|
|
contains(TEMPLATE, .*lib):CONFIG(debug, debug|release) {
|
|
!debug_and_release|build_pass {
|
|
mac:RET = $$member(LIBRARY_NAME, 0)_debug
|
|
else:win32:RET = $$member(LIBRARY_NAME, 0)d
|
|
}
|
|
}
|
|
isEmpty(RET):RET = $$LIBRARY_NAME
|
|
return($$RET)
|
|
}
|
|
|
|
defineTest(qtAddLibrary) {
|
|
INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$1
|
|
INCLUDEPATH = $$QMAKE_INCDIR_QT/$$1 $$INCLUDEPATH
|
|
|
|
LIB_NAME = $$1
|
|
unset(LINKAGE)
|
|
mac {
|
|
CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced
|
|
QMAKE_FRAMEWORKPATH *= $${QMAKE_LIBDIR_QT}
|
|
FRAMEWORK_INCLUDE = $$QMAKE_LIBDIR_QT/$${LIB_NAME}.framework/Headers
|
|
!qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
|
|
INCLUDEPATH -= $$FRAMEWORK_INCLUDE
|
|
INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
|
|
}
|
|
LINKAGE = -framework $${LIB_NAME}$${QT_LIBINFIX}
|
|
} else:!qt_no_framework { #detection
|
|
for(frmwrk_dir, $$list($$QMAKE_LIBDIR_QT $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH) /Library/Frameworks)) {
|
|
exists($${frmwrk_dir}/$${LIB_NAME}.framework) {
|
|
QMAKE_FRAMEWORKPATH *= $${frmwrk_dir}
|
|
FRAMEWORK_INCLUDE = $$frmwrk_dir/$${LIB_NAME}.framework/Headers
|
|
!qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
|
|
INCLUDEPATH -= $$FRAMEWORK_INCLUDE
|
|
INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
|
|
}
|
|
LINKAGE = -framework $${LIB_NAME}
|
|
break()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
isEmpty(LINKAGE) {
|
|
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
|
|
win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d
|
|
mac:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}_debug
|
|
}
|
|
isEmpty(LINKAGE):LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}
|
|
}
|
|
!isEmpty(QMAKE_LSB) {
|
|
QMAKE_LFLAGS *= --lsb-libpath=$$$$QMAKE_LIBDIR_QT
|
|
QMAKE_LFLAGS *= -L/opt/lsb/lib
|
|
QMAKE_LFLAGS *= --lsb-shared-libs=$${LIB_NAME}$${QT_LIBINFIX}
|
|
}
|
|
LIBS += $$LINKAGE
|
|
export(LIBS)
|
|
export(INCLUDEPATH)
|
|
export(QMAKE_FRAMEWORKPATH)
|
|
export(QMAKE_LFLAGS)
|
|
return(true)
|
|
}
|
|
|
|
defineTest(qtAddModule) {
|
|
MODULE_NAME = $$eval(QT.$${1}.name)
|
|
MODULE_INCLUDES = $$eval(QT.$${1}.includes)
|
|
MODULE_LIBS = $$eval(QT.$${1}.libs)
|
|
MODULE_CONFIG = $$eval(QT.$${1}.module_config)
|
|
|
|
CONFIG += $$eval(QT.$${1}.CONFIG)
|
|
DEFINES += $$eval(QT.$${1}.DEFINES)
|
|
|
|
INCLUDEPATH -= $$MODULE_INCLUDES
|
|
INCLUDEPATH = $$MODULE_INCLUDES $$INCLUDEPATH
|
|
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)
|
|
INCLUDEPATH -= $$MODULE_INCLUDES_PRIVATES $$MODULE_INCLUDES_PRIVATES/$$MODULE_NAME
|
|
INCLUDEPATH = $$MODULE_INCLUDES_PRIVATES $$MODULE_INCLUDES_PRIVATES/$$MODULE_NAME $$INCLUDEPATH
|
|
}
|
|
|
|
unset(LINKAGE)
|
|
mac {
|
|
!contains(MODULE_CONFIG,staticlib):CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced
|
|
QMAKE_FRAMEWORKPATH *= $${MODULE_LIBS}
|
|
FRAMEWORK_INCLUDE = $$MODULE_INCLUDES.framework/Headers
|
|
!qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
|
|
INCLUDEPATH -= $$FRAMEWORK_INCLUDE
|
|
INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
|
|
}
|
|
LINKAGE = -framework $${MODULE_NAME}$${QT_LIBINFIX}
|
|
} else:!qt_no_framework { #detection
|
|
for(frmwrk_dir, $$list($$MODULE_LIBS $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH) /Library/Frameworks)) {
|
|
exists($${frmwrk_dir}/$${MODULE_NAME}.framework) {
|
|
QMAKE_FRAMEWORKPATH *= $${frmwrk_dir}
|
|
FRAMEWORK_INCLUDE = $$frmwrk_dir/$${MODULE_NAME}.framework/Headers
|
|
!qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
|
|
INCLUDEPATH -= $$FRAMEWORK_INCLUDE
|
|
INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
|
|
}
|
|
LINKAGE = -framework $${MODULE_NAME}
|
|
break()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isEmpty(LINKAGE) {
|
|
# Make sure we can link to uninstalled libraries
|
|
!isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) {
|
|
QMAKE_LIBDIR *= $$MODULE_LIBS
|
|
unix:!mac:QMAKE_LFLAGS *= "-Wl,-rpath-link,$$MODULE_LIBS"
|
|
}
|
|
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}
|
|
}
|
|
# 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) {
|
|
QMAKE_LFLAGS *= --lsb-libpath=$$$$QMAKE_LIBDIR_QT
|
|
QMAKE_LFLAGS *= -L/opt/lsb/lib
|
|
QMAKE_LFLAGS *= --lsb-shared-libs=$${MODULE_NAME}$${QT_LIBINFIX}
|
|
}
|
|
LIBS += $$LINKAGE
|
|
}
|
|
export(CONFIG)
|
|
export(DEFINES)
|
|
export(LIBS)
|
|
export(INCLUDEPATH)
|
|
export(QMAKE_FRAMEWORKPATH)
|
|
export(QMAKE_LFLAGS)
|
|
export(QMAKE_LIBDIR)
|
|
return(true)
|
|
}
|
|
|
|
# variable, default
|
|
defineTest(qtPrepareTool) {
|
|
MODBASE = $$[QT_INSTALL_BINS]
|
|
!isEmpty(QT_BUILD_TREE):MODBASE = $$QT_BUILD_TREE/bin
|
|
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)
|
|
}
|
|
isEmpty($$1):$$1 = $$MODBASE/$$2
|
|
$$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
|
|
}
|
|
}
|
|
export($$1)
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
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.
|
|
|
|
pkg_config = $$pkgConfigExecutable()
|
|
|
|
for(package, ARGS) {
|
|
!system($$pkg_config --exists $$package):return(false)
|
|
}
|
|
|
|
return(true)
|
|
}
|
|
|