Some work about adaptive color scheme for Web UI (PR #19901)
http://[316:c51a:62a3:8b9::4]/d4708/qBittorrent/src/branch/adaptive-webui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.6 KiB
97 lines
2.6 KiB
/* |
|
-----BEGIN QCMOD----- |
|
name: libboost |
|
arg: with-libboost-inc=[path], Path to libboost include files |
|
arg: with-libboost-lib=[path], Path to libboost library files |
|
-----END QCMOD----- |
|
*/ |
|
#include <boost/version.hpp> |
|
#include <libtorrent/version.hpp> |
|
|
|
class qc_libboost : public ConfObj |
|
{ |
|
public: |
|
qc_libboost(Conf *c) : ConfObj(c) {} |
|
QString name() 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); |
|
} else { |
|
// Fall back to non -mt boost lib |
|
filters.clear(); |
|
filters << "libboost_"+lib+"*.so"; |
|
result = libDir.entryList(filters, QDir::Files); |
|
if(!result.empty()) { |
|
name = result.first().mid(3); |
|
// Remove .so |
|
name.chop(3); |
|
} |
|
} |
|
return name; |
|
} |
|
|
|
bool exec(){ |
|
QStringList sl; |
|
QString s = conf->getenv("QC_WITH_LIBBOOST_INC"); |
|
if (!s.isEmpty()) |
|
sl << s; |
|
sl << "/usr/include"; |
|
sl << "/usr/local/include"; |
|
bool found = false; |
|
foreach (s, sl) { |
|
if (conf->checkHeader(s, "boost/format.hpp") |
|
#if LIBTORRENT_VERSION_MAJOR == 0 && LIBTORRENT_VERSION_MINOR < 16 |
|
&& conf->checkHeader(s, "boost/filesystem/path.hpp") |
|
#endif |
|
) { |
|
found = true; |
|
break; |
|
} |
|
} |
|
if (!found) |
|
return false; |
|
|
|
conf->addIncludePath(s); |
|
|
|
// Find library |
|
s = conf->getenv("QC_WITH_LIBBOOST_LIB"); |
|
QStringList required_libs; |
|
#if BOOST_VERSION >= 103500 |
|
required_libs << "system"; |
|
#endif |
|
#if LIBTORRENT_VERSION_MAJOR == 0 && LIBTORRENT_VERSION_MINOR < 16 |
|
required_libs << "filesystem" ; |
|
#endif |
|
//required_libs << "thread"; |
|
QStringList libDirs; |
|
if (!s.isEmpty()) |
|
libDirs << s; |
|
libDirs << "/usr/lib/" << "/usr/lib/i386-linux-gnu/" << "/usr/lib64/" << "/usr/lib/x86_64-linux-gnu/" << "/usr/local/lib/" << "/usr/lib/local/i386-linux-gnu/" << "/usr/local/lib64/" << "/usr/local/lib/x86_64-linux-gnu/"; |
|
|
|
foreach(const QString& lib, required_libs) { |
|
bool found = false; |
|
foreach(const QString& libDir, libDirs) { |
|
QString detected_name = findBoostLib(libDir, lib); |
|
if(!detected_name.isEmpty()) { |
|
conf->addLib("-l"+detected_name); |
|
found = true; |
|
break; |
|
} |
|
} |
|
if(!found) { |
|
printf("Could not find boost %s library!\n", qPrintable(lib)); |
|
return false; |
|
} |
|
} |
|
return true; |
|
} |
|
};
|
|
|