diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-04-20 12:20:30 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-04-21 07:11:29 +0000 |
commit | d50136199ba49ce1a87dffbce2353f8777d592b1 (patch) | |
tree | b966bfbe9765e31babba6195efbe8676df142b5b /tests | |
parent | d5542fa418045d5ff7b8a1af33761ee245407841 (diff) | |
download | qbs-d50136199ba49ce1a87dffbce2353f8777d592b1.tar.gz |
GCC: Do not mess with the list of external libraries
Consider the following:
There are external static libraries libA and libB, with libB having a
dependency on libA. Some module pulls in libA, another one pulls in libB
and libA.
The raw contents of cpp.staticLibraries for the product might
end up as ["libA","libB","libA"]. Before this patch, our library
collection code "simplified" this list to ["libA","libB"], which leads
to a linker error. Since we generally do not know about the dependencies
of external libraries, we should not touch these lists.
Change-Id: I4a94dfc8505ee9ece2562dc3aa3d66244ec7fdac
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/blackbox/testdata/external-libs/external-libs.qbs | 62 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/external-libs/lib1.cpp | 1 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/external-libs/lib2.cpp | 3 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/external-libs/main.cpp | 6 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 6 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
6 files changed, 79 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/external-libs/external-libs.qbs b/tests/auto/blackbox/testdata/external-libs/external-libs.qbs new file mode 100644 index 000000000..9a5bbdd6b --- /dev/null +++ b/tests/auto/blackbox/testdata/external-libs/external-libs.qbs @@ -0,0 +1,62 @@ +import qbs +import qbs.TextFile + +Project { + property string libDir: sourceDirectory + "/libs" + StaticLibrary { + name: "lib1" + destinationDirectory: project.libDir + Depends { name: "cpp" } + files: ["lib1.cpp"] + } + StaticLibrary { + name: "lib2" + destinationDirectory: project.libDir + Depends { name: "cpp" } + Depends { name: "lib1" } + files: ["lib2.cpp"] + } + // TODO: Remove once we have parameterized dependencies + Product { + name: "barrier" + type: ["blubb"] + Depends { name: "lib1" } + Depends { name: "lib2" } + Rule { + multiplex: true + inputsFromDependencies: ["staticlibrary"] + Artifact { + filePath: "dummy" + fileTags: ["blubb"] + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.silent = true; + cmd.sourceCode = function() { } + return [cmd]; + } + } + } + CppApplication { + Depends { name: "barrier" } + files: ["main.cpp"] + cpp.libraryPaths: [project.libDir] + cpp.staticLibraries: ["lib1", "lib2", "lib1"] + Rule { + inputsFromDependencies: ["blubb"] + Artifact { + filePath: "dummy.cpp" + fileTags: ["cpp"] + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.sourceCode = function() { + var f = new TextFile(output.filePath, TextFile.WriteOnly); + f.writeLine("void dummy() { }"); + f.close(); + }; + return [cmd]; + } + } + } +} diff --git a/tests/auto/blackbox/testdata/external-libs/lib1.cpp b/tests/auto/blackbox/testdata/external-libs/lib1.cpp new file mode 100644 index 000000000..bb69fa422 --- /dev/null +++ b/tests/auto/blackbox/testdata/external-libs/lib1.cpp @@ -0,0 +1 @@ +void func_lib1() { } diff --git a/tests/auto/blackbox/testdata/external-libs/lib2.cpp b/tests/auto/blackbox/testdata/external-libs/lib2.cpp new file mode 100644 index 000000000..e669a7f6c --- /dev/null +++ b/tests/auto/blackbox/testdata/external-libs/lib2.cpp @@ -0,0 +1,3 @@ +void func_lib1(); + +void func_lib2() { func_lib1(); } diff --git a/tests/auto/blackbox/testdata/external-libs/main.cpp b/tests/auto/blackbox/testdata/external-libs/main.cpp new file mode 100644 index 000000000..9a6eab23e --- /dev/null +++ b/tests/auto/blackbox/testdata/external-libs/main.cpp @@ -0,0 +1,6 @@ +void func_lib2(); + +int main() +{ + func_lib2(); +} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index fe405a502..444dcfd38 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -2791,6 +2791,12 @@ void TestBlackbox::exportToOutsideSearchPath() "dependencies for product 'theProduct'"), m_qbsStderr.constData()); } +void TestBlackbox::externalLibs() +{ + QDir::setCurrent(testDataDir + "/external-libs"); + QCOMPARE(runQbs(), 0); +} + void TestBlackbox::fileDependencies() { QDir::setCurrent(testDataDir + "/fileDependencies"); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index a11f87343..7a4a0cb67 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -83,6 +83,7 @@ private slots: void escapedLinkerFlags(); void exportRule(); void exportToOutsideSearchPath(); + void externalLibs(); void fileDependencies(); void frameworkStructure(); void generatedArtifactAsInputToDynamicRule(); |