diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2022-08-28 14:19:18 +0300 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2022-08-29 22:37:02 +0000 |
commit | 3a2ff079c3f38c5aff7249e1c55a2cdc6a50e2e8 (patch) | |
tree | 58bd76e038403a888797558b4deebb1a28aeaef1 | |
parent | 115bf3d75ebfa8f25834488505a0adaa20129edd (diff) | |
download | qbs-3a2ff079c3f38c5aff7249e1c55a2cdc6a50e2e8.tar.gz |
qbspkgconfig: fix sysroot
And also use exporterd .pc file and sysroot in the test.
Change-Id: I54bda75f57bdf36fcb054de9aaf71c313b8626e3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
4 files changed, 22 insertions, 16 deletions
diff --git a/share/qbs/module-providers/qbspkgconfig.qbs b/share/qbs/module-providers/qbspkgconfig.qbs index 2af3c42e4..bc2c6be46 100644 --- a/share/qbs/module-providers/qbspkgconfig.qbs +++ b/share/qbs/module-providers/qbspkgconfig.qbs @@ -52,11 +52,7 @@ ModuleProvider { property stringList extraPaths property stringList libDirs property bool staticMode: false - property path sysroot: { - if (qbs.targetOS.contains("macos")) - return ""; - return qbs.sysroot; - } + property path sysroot: qbs.sysroot property bool mergeDependencies: true relativeSearchPaths: { @@ -148,6 +144,8 @@ ModuleProvider { var options = {}; options.libDirs = libDirs; options.sysroot = sysroot; + if (options.sysroot) + options.allowSystemLibraryPaths = true; options.staticMode = staticMode; options.mergeDependencies = mergeDependencies; options.extraPaths = extraPaths; diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc deleted file mode 100644 index 077a05893..000000000 --- a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc +++ /dev/null @@ -1,6 +0,0 @@ -Name: libA -Description: just a test -Version: 0.0.1 - -Cflags: -DTHE_MAGIC_DEFINE -I/usr/local/include -Libs: -L/usr/local/lib -llibA diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs index 9d482415b..b473083c6 100644 --- a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs +++ b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs @@ -6,6 +6,8 @@ Project { DynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle" } + Depends { name: "Exporter.pkgconfig" } + Exporter.pkgconfig.versionEntry: "1.0" name: "libA" bundle.isBundle: project.isBundle bundle.publicHeaders: ["libA.h"] @@ -16,7 +18,7 @@ Project { result.push("MYLIB_FRAMEWORK"); return result; } - qbs.installPrefix: "" + qbs.installPrefix: "/usr" install: true installImportLib: true installDir: "lib" @@ -25,5 +27,16 @@ Project { qbs.install: !project.isBundle qbs.installDir: FileInfo.joinPaths("include", product.name) } + Group { + fileTagsFilter: ["Exporter.pkgconfig.pc"] + qbs.install: !project.isBundle + qbs.installDir: FileInfo.joinPaths("share", "pkgconfig") + } + Export { + Depends { name: "cpp" } + cpp.defines: ["THE_MAGIC_DEFINE"] + cpp.includePaths: [FileInfo.joinPaths(exportingProduct.qbs.installPrefix, "include")] + cpp.libraryPaths: [FileInfo.joinPaths(exportingProduct.qbs.installPrefix, "lib")] + } } } diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 20d85d543..fde8c61f4 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -6226,9 +6226,9 @@ void TestBlackbox::qbsModuleProvidersCompatibility_data() void TestBlackbox::qbspkgconfigModuleProvider() { QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider/libs"); + rmDirR(relativeBuildDir()); const auto commonParams = QbsRunParameters(QStringLiteral("install"), { - QStringLiteral("qbs.installPrefix:/usr/local"), QStringLiteral("--install-root"), QStringLiteral("install-root") }); @@ -6237,11 +6237,12 @@ void TestBlackbox::qbspkgconfigModuleProvider() QCOMPARE(runQbs(dynamicParams), 0); QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider"); + rmDirR(relativeBuildDir()); + + const auto sysroot = testDataDir + "/qbspkgconfig-module-provider/libs/install-root"; QbsRunParameters params; - params.arguments - << "moduleProviders.qbspkgconfig.libDirs:libdir" - << "moduleProviders.qbspkgconfig.sysroot:" + QDir::currentPath() + "/libs/install-root"; + params.arguments << "moduleProviders.qbspkgconfig.sysroot:" + sysroot; QCOMPARE(runQbs(params), 0); } |