mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-25 14:04:23 +00:00
Improved libbost detection
This commit is contained in:
parent
057743a779
commit
6148e6b192
64
configure
vendored
64
configure
vendored
@ -394,6 +394,19 @@ public:
|
|||||||
qc_libboost(Conf *c) : ConfObj(c) {}
|
qc_libboost(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "libboost"; }
|
QString name() const { return "libboost"; }
|
||||||
QString shortname() const { return "libboost"; }
|
QString shortname() const { return "libboost"; }
|
||||||
|
QString findBoostLib(QString path, QString lib) const {
|
||||||
|
QString name;
|
||||||
|
QDir libDir(path);
|
||||||
|
QStringList filters;
|
||||||
|
filters << "libboost_"+lib+"*-mt.so";
|
||||||
|
QStringList result = libDir.entryList(filters, QDir::Files);
|
||||||
|
if(!result.empty()) {
|
||||||
|
name = result.first().mid(3);
|
||||||
|
// Remove .so
|
||||||
|
name.chop(3);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QString s;
|
QString s;
|
||||||
s = conf->getenv("QC_WITH_LIBBOOST_INC");
|
s = conf->getenv("QC_WITH_LIBBOOST_INC");
|
||||||
@ -437,28 +450,35 @@ public:
|
|||||||
conf->addIncludePath(s);
|
conf->addIncludePath(s);
|
||||||
// Find library
|
// Find library
|
||||||
s = conf->getenv("QC_WITH_LIBBOOST_LIB");
|
s = conf->getenv("QC_WITH_LIBBOOST_LIB");
|
||||||
if(!s.isEmpty()) {
|
QStringList required_libs;
|
||||||
if(!conf->checkLibrary(s, "boost_system-mt")) {
|
required_libs << "system" << "filesystem" << "thread";
|
||||||
return false;
|
QStringList libDirs;
|
||||||
}
|
libDirs << "/usr/lib/" << "/usr/lib64/" << "/usr/local/lib/" << "/usr/local/lib64/";
|
||||||
}else{
|
foreach(const QString& lib, required_libs) {
|
||||||
QStringList sl;
|
if(!s.isEmpty()) {
|
||||||
sl << "/usr/lib/";
|
QString detected_name = findBoostLib(s, lib);
|
||||||
sl << "/usr/lib64/";
|
if(detected_name.isEmpty()) {
|
||||||
sl << "/usr/local/lib/";
|
printf("Could not find boost %s library!\n", qPrintable(lib));
|
||||||
sl << "/usr/local/lib64/";
|
return false;
|
||||||
bool found = false;
|
} else {
|
||||||
foreach(s, sl){
|
conf->addLib("-l"+detected_name);
|
||||||
if(conf->checkLibrary(s, "boost_system-mt")) {
|
}
|
||||||
found = true;
|
} else {
|
||||||
break;
|
bool found = false;
|
||||||
}
|
foreach(const QString& libDir, libDirs) {
|
||||||
}
|
QString detected_name = findBoostLib(libDir, lib);
|
||||||
if(!found)
|
if(!detected_name.isEmpty()) {
|
||||||
return false;
|
conf->addLib("-l"+detected_name);
|
||||||
}
|
found = true;
|
||||||
conf->addLib(QString("-L") + s);
|
break;
|
||||||
conf->addLib("-lboost_system-mt -lboost_filesystem-mt -lboost_thread-mt");
|
}
|
||||||
|
}
|
||||||
|
if(!found) {
|
||||||
|
printf("Could not find boost %s library!\n", qPrintable(lib));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -11,6 +11,19 @@ public:
|
|||||||
qc_libboost(Conf *c) : ConfObj(c) {}
|
qc_libboost(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "libboost"; }
|
QString name() const { return "libboost"; }
|
||||||
QString shortname() const { return "libboost"; }
|
QString shortname() const { return "libboost"; }
|
||||||
|
QString findBoostLib(QString path, QString lib) const {
|
||||||
|
QString name;
|
||||||
|
QDir libDir(path);
|
||||||
|
QStringList filters;
|
||||||
|
filters << "libboost_"+lib+"*-mt.so";
|
||||||
|
QStringList result = libDir.entryList(filters, QDir::Files);
|
||||||
|
if(!result.empty()) {
|
||||||
|
name = result.first().mid(3);
|
||||||
|
// Remove .so
|
||||||
|
name.chop(3);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QString s;
|
QString s;
|
||||||
s = conf->getenv("QC_WITH_LIBBOOST_INC");
|
s = conf->getenv("QC_WITH_LIBBOOST_INC");
|
||||||
@ -54,28 +67,35 @@ public:
|
|||||||
conf->addIncludePath(s);
|
conf->addIncludePath(s);
|
||||||
// Find library
|
// Find library
|
||||||
s = conf->getenv("QC_WITH_LIBBOOST_LIB");
|
s = conf->getenv("QC_WITH_LIBBOOST_LIB");
|
||||||
if(!s.isEmpty()) {
|
QStringList required_libs;
|
||||||
if(!conf->checkLibrary(s, "boost_system-mt")) {
|
required_libs << "system" << "filesystem" << "thread";
|
||||||
return false;
|
QStringList libDirs;
|
||||||
}
|
libDirs << "/usr/lib/" << "/usr/lib64/" << "/usr/local/lib/" << "/usr/local/lib64/";
|
||||||
}else{
|
foreach(const QString& lib, required_libs) {
|
||||||
QStringList sl;
|
if(!s.isEmpty()) {
|
||||||
sl << "/usr/lib/";
|
QString detected_name = findBoostLib(s, lib);
|
||||||
sl << "/usr/lib64/";
|
if(detected_name.isEmpty()) {
|
||||||
sl << "/usr/local/lib/";
|
printf("Could not find boost %s library!\n", qPrintable(lib));
|
||||||
sl << "/usr/local/lib64/";
|
return false;
|
||||||
bool found = false;
|
} else {
|
||||||
foreach(s, sl){
|
conf->addLib("-l"+detected_name);
|
||||||
if(conf->checkLibrary(s, "boost_system-mt")) {
|
}
|
||||||
found = true;
|
} else {
|
||||||
break;
|
bool found = false;
|
||||||
}
|
foreach(const QString& libDir, libDirs) {
|
||||||
}
|
QString detected_name = findBoostLib(libDir, lib);
|
||||||
if(!found)
|
if(!detected_name.isEmpty()) {
|
||||||
return false;
|
conf->addLib("-l"+detected_name);
|
||||||
}
|
found = true;
|
||||||
conf->addLib(QString("-L") + s);
|
break;
|
||||||
conf->addLib("-lboost_system-mt -lboost_filesystem-mt -lboost_thread-mt");
|
}
|
||||||
|
}
|
||||||
|
if(!found) {
|
||||||
|
printf("Could not find boost %s library!\n", qPrintable(lib));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user