summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-09-04 12:23:11 (GMT)
committeraxis <qt-info@nokia.com>2009-10-23 15:33:00 (GMT)
commit267fe3cf638add295da001ff71116f1a00f96866 (patch)
tree19a2050c6f6f9de29a20b0074336b8e37bb26ea8 /qmake/generators
parent6475ca960a3d04eb591338801073db4d2a38b715 (diff)
downloadQt-267fe3cf638add295da001ff71116f1a00f96866.zip
Qt-267fe3cf638add295da001ff71116f1a00f96866.tar.gz
Qt-267fe3cf638add295da001ff71116f1a00f96866.tar.bz2
Added QMAKE_PREFIX_SHLIB and QMAKE_SYMBIAN_SHLIB support.
The first enables you to use a prefix in front of the library. It is by default enabled for all platforms which previously used "lib", and on Symbian it is set to the empty string. The second variable enables Symbian style linking, where you link to a stub .lib file, but the actual runtime library is .dll.
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/unix/unixmake.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index faa6415..62eee19 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -65,6 +65,10 @@ UnixMakefileGenerator::init()
}
}
+ if (project->isEmpty("QMAKE_PREFIX_SHLIB"))
+ // Prevent crash when using the empty variable.
+ project->values("QMAKE_PREFIX_SHLIB").append("");
+
if(!project->isEmpty("QMAKE_FAILED_REQUIREMENTS")) /* no point */
return;
@@ -451,7 +455,13 @@ UnixMakefileGenerator::findLibraries()
if(!libdirs.contains(f))
libdirs.append(f);
} else if(opt.startsWith("-l")) {
- if (project->isActiveConfig("rvct_linker")) {
+ if (!project->isEmpty("QMAKE_SYMBIAN_SHLIB")) {
+ if (opt.indexOf(".lib") == -1) {
+ (*it) = opt.mid(2) + ".lib";
+ } else {
+ (*it) = opt.mid(2);
+ }
+ } else if (project->isActiveConfig("rvct_linker")) {
(*it) = "lib" + opt.mid(2) + ".so";
} else {
stub = opt.mid(2);
@@ -491,26 +501,29 @@ UnixMakefileGenerator::findLibraries()
QStringList extens;
if(!extn.isNull())
extens << extn;
+ else if (!project->isEmpty("QMAKE_SYMBIAN_SHLIB"))
+ // In Symbian you link to the stub .lib file, but run with the .dll file.
+ extens << "lib";
else
extens << project->values("QMAKE_EXTENSION_SHLIB").first() << "a";
for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
if(dir.isNull()) {
- QString lib_stub;
for(QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin(); dep_it != libdirs.end(); ++dep_it) {
- if(exists((*dep_it).local() + Option::dir_sep + "lib" + stub +
- "." + (*extit))) {
- lib_stub = stub;
+ QString pathToLib = ((*dep_it).local() + Option::dir_sep
+ + project->values("QMAKE_PREFIX_SHLIB").first()
+ + stub + "." + (*extit));
+ if(exists(pathToLib)) {
+ if (!project->isEmpty("QMAKE_SYMBIAN_SHLIB"))
+ (*it) = pathToLib;
+ else
+ (*it) = "-l" + stub;
+ found = true;
break;
}
}
- if(!lib_stub.isNull()) {
- (*it) = "-l" + lib_stub;
- found = true;
- break;
- }
} else {
- if(exists("lib" + stub + "." + (*extit))) {
- (*it) = "lib" + stub + "." + (*extit);
+ if(exists(project->values("QMAKE_PREFIX_SHLIB").first() + stub + "." + (*extit))) {
+ (*it) = project->values("QMAKE_PREFIX_SHLIB").first() + stub + "." + (*extit);
found = true;
break;
}
@@ -518,8 +531,8 @@ UnixMakefileGenerator::findLibraries()
}
if(!found && project->isActiveConfig("compile_libtool")) {
for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
- if(exists(libdirs[dep_i].local() + Option::dir_sep + "lib" + stub + Option::libtool_ext)) {
- (*it) = libdirs[dep_i].real() + Option::dir_sep + "lib" + stub + Option::libtool_ext;
+ if(exists(libdirs[dep_i].local() + Option::dir_sep + project->values("QMAKE_PREFIX_SHLIB").first() + stub + Option::libtool_ext)) {
+ (*it) = libdirs[dep_i].real() + Option::dir_sep + project->values("QMAKE_PREFIX_SHLIB").first() + stub + Option::libtool_ext;
found = true;
break;
}
@@ -560,7 +573,7 @@ UnixMakefileGenerator::processPrlFiles()
for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
const QMakeLocalFileName &lfn = libdirs[dep_i];
if(!project->isActiveConfig("compile_libtool")) { //give them the .libs..
- QString la = lfn.local() + Option::dir_sep + "lib" + lib + Option::libtool_ext;
+ QString la = lfn.local() + Option::dir_sep + project->values("QMAKE_PREFIX_SHLIB").first() + lib + Option::libtool_ext;
if(exists(la) && QFile::exists(lfn.local() + Option::dir_sep + ".libs")) {
QString dot_libs = lfn.real() + Option::dir_sep + ".libs";
l.append("-L" + dot_libs);
@@ -568,7 +581,7 @@ UnixMakefileGenerator::processPrlFiles()
}
}
- QString prl = lfn.local() + Option::dir_sep + "lib" + lib;
+ QString prl = lfn.local() + Option::dir_sep + project->values("QMAKE_PREFIX_SHLIB").first() + lib;
if(!project->isEmpty("QMAKE_" + lib.toUpper() + "_SUFFIX"))
prl += project->first("QMAKE_" + lib.toUpper() + "_SUFFIX");
if(processPrlFile(prl)) {