Improve support for <MODULE>_PATH options

Several modules, including DBus, MySQL, and OpenSSL have
configure options of the form <MODULE>_PATH, which is used
on Windows (where pkg-config is not present) to specify the
locations of third-party libraries.  These switches had been
implemented by adding extra variables which were referenced
in .pro files, to add the appropriate compiler and linker
switches.  This is undesirable because it means there are
two independent paths for adding the switches to the build,
which can get out of sync with each other, and indeed this
had happened for some of the DBus tools.

To remedy the situation, all three of the switches were
reworked so that they added values directly to the principal
variables that are used in the project files.  This reduces
maintenance, by ensuring that the pkg-config and non-pkg-config
paths appear the same to the rest of the build system.

Change-Id: Iae342f1d14b79fbcfef9fe38aadc803ad3141799
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Matt Fischer 2013-04-08 17:07:13 -05:00 committed by The Qt Project
parent cd2a51a66f
commit d37dc75116
4 changed files with 19 additions and 24 deletions

View File

@ -3,9 +3,7 @@ QT = core-private
CONFIG += link_pkgconfig
MODULE_CONFIG = dbusadaptors dbusinterfaces
!isEmpty(DBUS_PATH) {
INCLUDEPATH += $$DBUS_PATH/include
QMAKE_LIBDIR += $$DBUS_PATH/lib
!contains(QT_LIBS_DBUS, .*dbus-1.*) {
win32:CONFIG(debug, debug|release):QT_LIBS_DBUS += -ldbus-1d
else:QT_LIBS_DBUS += -ldbus-1
}

View File

@ -41,11 +41,7 @@ contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
LIBS_PRIVATE += $$OPENSSL_LIBS_RELEASE
}
QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS
LIBS_PRIVATE += $$OPENSSL_LIBS
windows:LIBS += -lcrypt32
!isEmpty(OPENSSL_PATH) {
INCLUDEPATH += $$OPENSSL_PATH/include
QMAKE_LIBDIR += $$OPENSSL_PATH/lib
}
}

View File

@ -1,10 +1,8 @@
HEADERS += $$PWD/qsql_mysql_p.h
SOURCES += $$PWD/qsql_mysql.cpp
!isEmpty(MYSQL_PATH) {
INCLUDEPATH += $$MYSQL_PATH/include
QMAKE_LIBDIR += $$MYSQL_PATH/lib
}
QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
LIBS += $$QT_LFLAGS_MYSQL
unix {
isEmpty(QT_LFLAGS_MYSQL) {
@ -12,9 +10,6 @@ unix {
use_libmysqlclient_r:LIBS += -lmysqlclient_r
else:LIBS += -lmysqlclient
}
} else {
LIBS += $$QT_LFLAGS_MYSQL
QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
}
} else {
!contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql

View File

@ -988,7 +988,7 @@ void Configure::parseCmdLine()
} else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS_RELEASE=")) {
opensslLibsRelease = configCmdLine.at(i);
} else if (configCmdLine.at(i).startsWith("OPENSSL_PATH=")) {
opensslPath = QDir::fromNativeSeparators(configCmdLine.at(i));
opensslPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) {
psqlLibs = configCmdLine.at(i);
} else if (configCmdLine.at(i).startsWith("SYBASE=")) {
@ -996,9 +996,9 @@ void Configure::parseCmdLine()
} else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) {
sybaseLibs = configCmdLine.at(i);
} else if (configCmdLine.at(i).startsWith("DBUS_PATH=")) {
dbusPath = QDir::fromNativeSeparators(configCmdLine.at(i));
dbusPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("MYSQL_PATH=")) {
mysqlPath = QDir::fromNativeSeparators(configCmdLine.at(i));
mysqlPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("ZLIB_LIBS=")) {
zlibLibs = QDir::fromNativeSeparators(configCmdLine.at(i));
}
@ -2811,13 +2811,19 @@ void Configure::generateOutputVars()
} else if (opensslLibs.isEmpty()) {
qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
}
if (!opensslPath.isEmpty())
qmakeVars += opensslPath;
if (!opensslPath.isEmpty()) {
qmakeVars += QString("OPENSSL_CFLAGS += -I%1/include").arg(opensslPath);
qmakeVars += QString("OPENSSL_LIBS += -L%1/lib").arg(opensslPath);
}
}
if (dictionary[ "DBUS" ] != "no" && !dbusPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath);
}
if (dictionary[ "SQL_MYSQL" ] != "no" && !mysqlPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_MYSQL = -I%1/include").arg(mysqlPath);
qmakeVars += QString("QT_LFLAGS_MYSQL = -L%1/lib").arg(mysqlPath);
}
if (dictionary[ "DBUS" ] != "no" && !dbusPath.isEmpty())
qmakeVars += dbusPath;
if (dictionary[ "SQL_MYSQL" ] != "no" && !mysqlPath.isEmpty())
qmakeVars += mysqlPath;
if (!psqlLibs.isEmpty())
qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1);
if (!zlibLibs.isEmpty())