diff options
-rw-r--r-- | doc/reference/module-providers/qbspkgconfig-module-provider.qdoc | 13 | ||||
-rw-r--r-- | share/qbs/module-providers/qbspkgconfig.qbs | 12 | ||||
-rw-r--r-- | src/lib/corelib/jsextensions/pkgconfigjs.cpp | 6 | ||||
-rw-r--r-- | src/lib/pkgconfig/pkgconfig.cpp | 9 | ||||
-rw-r--r-- | src/lib/pkgconfig/pkgconfig.h | 3 | ||||
-rw-r--r-- | tests/auto/pkgconfig/tst_pkgconfig.cpp | 2 |
6 files changed, 32 insertions, 13 deletions
diff --git a/doc/reference/module-providers/qbspkgconfig-module-provider.qdoc b/doc/reference/module-providers/qbspkgconfig-module-provider.qdoc index 4ba176794..debaa5992 100644 --- a/doc/reference/module-providers/qbspkgconfig-module-provider.qdoc +++ b/doc/reference/module-providers/qbspkgconfig-module-provider.qdoc @@ -57,7 +57,18 @@ \note You do not need to set this for cross-compilation in order to point to the sysroot. \QBS does that for you. - This property is the equivalent of the \c{PKG_CONFIG_PATH} / \c{PKG_CONFIG_LIBDIR} variables + This property is the equivalent of the \c{PKG_CONFIG_LIBDIR} variable + for the \c{pkg-config} tool. + + \nodefaultvalue +*/ + +/*! + \qmlproperty stringList qbspkgconfig::extraPaths + + Set this if you need to add extra search directories. + + This property is the equivalent of the \c{PKG_CONFIG_PATH} variable for the \c{pkg-config} tool. \nodefaultvalue diff --git a/share/qbs/module-providers/qbspkgconfig.qbs b/share/qbs/module-providers/qbspkgconfig.qbs index 5309610e1..52344d0b8 100644 --- a/share/qbs/module-providers/qbspkgconfig.qbs +++ b/share/qbs/module-providers/qbspkgconfig.qbs @@ -47,6 +47,7 @@ import qbs.TextFile ModuleProvider { property string executableFilePath + property stringList extraPaths property stringList libDirs property bool staticMode: false property path sysroot: { @@ -142,17 +143,18 @@ ModuleProvider { File.makePath(outputDir); var options = {}; - options.searchPaths = libDirs; + options.libDirs = libDirs; options.sysroot = sysroot; options.staticMode = staticMode; options.mergeDependencies = mergeDependencies; - if (options.sysroot && !options.searchPaths) { - options.searchPaths = [ + options.extraPaths = extraPaths; + if (options.sysroot && !options.libDirs) { + options.libDirs = [ sysroot + "/usr/lib/pkgconfig", sysroot + "/usr/share/pkgconfig" ]; } - if (!options.searchPaths) { + if (!options.libDirs) { // if we have pkg-config installed, let's ask it for its search paths (since // built-in search paths can differ between platforms) var executable = executableFilePath ? executableFilePath : getPkgConfigExecutable(qbs); @@ -161,7 +163,7 @@ ModuleProvider { if (p.exec(executable, ['pkg-config', '--variable=pc_path']) === 0) { var stdout = p.readStdOut().trim(); // TODO: qbs.pathListSeparator? depends on what pkg-config prints on Windows - options.searchPaths = stdout ? stdout.split(':'): []; + options.libDirs = stdout ? stdout.split(':'): []; } } } diff --git a/src/lib/corelib/jsextensions/pkgconfigjs.cpp b/src/lib/corelib/jsextensions/pkgconfigjs.cpp index 2bd7b5d17..3bace6f06 100644 --- a/src/lib/corelib/jsextensions/pkgconfigjs.cpp +++ b/src/lib/corelib/jsextensions/pkgconfigjs.cpp @@ -218,8 +218,10 @@ PkgConfigJs::PkgConfigJs( PkgConfig::Options PkgConfigJs::convertOptions(const QProcessEnvironment &env, const QVariantMap &map) { PkgConfig::Options result; - result.searchPaths = - stringListToStdVector(map.value(QStringLiteral("searchPaths")).toStringList()); + result.libDirs = + stringListToStdVector(map.value(QStringLiteral("libDirs")).toStringList()); + result.extraPaths = + stringListToStdVector(map.value(QStringLiteral("extraPaths")).toStringList()); result.sysroot = map.value(QStringLiteral("sysroot")).toString().toStdString(); result.topBuildDir = map.value(QStringLiteral("topBuildDir")).toString().toStdString(); result.allowSystemLibraryPaths = diff --git a/src/lib/pkgconfig/pkgconfig.cpp b/src/lib/pkgconfig/pkgconfig.cpp index 8a3c81c64..f017b365c 100644 --- a/src/lib/pkgconfig/pkgconfig.cpp +++ b/src/lib/pkgconfig/pkgconfig.cpp @@ -176,8 +176,8 @@ PkgConfig::PkgConfig() PkgConfig::PkgConfig(Options options) : m_options(std::move(options)) { - if (m_options.searchPaths.empty()) - m_options.searchPaths = split(PKG_CONFIG_PC_PATH, listSeparator()); + if (m_options.libDirs.empty()) + m_options.libDirs = split(PKG_CONFIG_PC_PATH, listSeparator()); if (m_options.topBuildDir.empty()) m_options.topBuildDir = "$(top_builddir)"; // pkg-config sets this for automake =) @@ -452,7 +452,10 @@ PkgConfig::Packages PkgConfig::findPackages() const m_options.systemLibraryPaths.begin(), m_options.systemLibraryPaths.end()) : std::unordered_set<std::string>(); - const auto pcFilePaths = getPcFilePaths(m_options.searchPaths); + auto allSearchPaths = m_options.extraPaths; + allSearchPaths.insert( + allSearchPaths.end(), m_options.libDirs.begin(), m_options.libDirs.end()); + const auto pcFilePaths = getPcFilePaths(allSearchPaths); for (const auto &pcFilePath : pcFilePaths) { if (m_options.disableUninstalled) { diff --git a/src/lib/pkgconfig/pkgconfig.h b/src/lib/pkgconfig/pkgconfig.h index 76e4a3ac3..6da1f053f 100644 --- a/src/lib/pkgconfig/pkgconfig.h +++ b/src/lib/pkgconfig/pkgconfig.h @@ -50,7 +50,8 @@ public: struct Options { using VariablesMap = PcPackage::VariablesMap; - std::vector<std::string> searchPaths; // PKG_CONFIG_PATH, PKG_CONFIG_LIBDIR + std::vector<std::string> libDirs; // PKG_CONFIG_LIBDIR + std::vector<std::string> extraPaths; // PKG_CONFIG_PATH std::string sysroot; // PKG_CONFIG_SYSROOT_DIR std::string topBuildDir; // PKG_CONFIG_TOP_BUILD_DIR bool allowSystemLibraryPaths{false}; // PKG_CONFIG_ALLOW_SYSTEM_LIBS diff --git a/tests/auto/pkgconfig/tst_pkgconfig.cpp b/tests/auto/pkgconfig/tst_pkgconfig.cpp index 1b04d231b..542984378 100644 --- a/tests/auto/pkgconfig/tst_pkgconfig.cpp +++ b/tests/auto/pkgconfig/tst_pkgconfig.cpp @@ -72,7 +72,7 @@ void TestPkgConfig::pkgConfig() Options options = qbs::Internal::PkgConfigJs::convertOptions( QProcessEnvironment::systemEnvironment(), optionsMap); - options.searchPaths.push_back(m_workingDataDir.toStdString()); + options.libDirs.push_back(m_workingDataDir.toStdString()); PkgConfig pkgConfig(std::move(options)); |