diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-05-15 13:54:16 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-05-22 09:10:58 +0000 |
commit | 7ac55bda5519ad2ef3f220f4f0f778dd9592abc5 (patch) | |
tree | a78e13e7b702fbd4e4b631bbb9542e3fb5a986af /tests/auto/blackbox/testdata/whole-archive | |
parent | 1dd00091f99e62d8c10677de98e753fe332565a9 (diff) |
Introduce dependency parameter cpp.linkWholeArchive
Maps to --whole-archive, -force_load and /WHOLEARCHIVE on the toolchain
level.
[ChangeLog][Parameters] When pulling in static library products, the new
Depends parameter cpp.linkWholeArchive can now be specified to force all
the library's objects into the target binary.
Task-number: QBS-701
Change-Id: Ic6482092f39f9ecb1ffb8e37d3031a94dc830be8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata/whole-archive')
11 files changed, 116 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/whole-archive/dynamiclib.cpp b/tests/auto/blackbox/testdata/whole-archive/dynamiclib.cpp new file mode 100644 index 000000000..60fd0a148 --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/dynamiclib.cpp @@ -0,0 +1,9 @@ +void usedFunc(); + +#if defined(_WIN32) || defined(WIN32) +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +EXPORT void f() { usedFunc(); } diff --git a/tests/auto/blackbox/testdata/whole-archive/main1.cpp b/tests/auto/blackbox/testdata/whole-archive/main1.cpp new file mode 100644 index 000000000..cb127164b --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/main1.cpp @@ -0,0 +1,6 @@ +void unusedFunc1(); + +int main() +{ + unusedFunc1(); +} diff --git a/tests/auto/blackbox/testdata/whole-archive/main2.cpp b/tests/auto/blackbox/testdata/whole-archive/main2.cpp new file mode 100644 index 000000000..54aab2ec9 --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/main2.cpp @@ -0,0 +1,6 @@ +void unusedFunc2(); + +int main() +{ + unusedFunc2(); +} diff --git a/tests/auto/blackbox/testdata/whole-archive/main3.cpp b/tests/auto/blackbox/testdata/whole-archive/main3.cpp new file mode 100644 index 000000000..69f9f356e --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/main3.cpp @@ -0,0 +1,6 @@ +void unusedFunc3(); + +int main() +{ + unusedFunc3(); +} diff --git a/tests/auto/blackbox/testdata/whole-archive/main4.cpp b/tests/auto/blackbox/testdata/whole-archive/main4.cpp new file mode 100644 index 000000000..f4469d23f --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/main4.cpp @@ -0,0 +1,6 @@ +void unusedFunc4(); + +int main() +{ + unusedFunc4(); +} diff --git a/tests/auto/blackbox/testdata/whole-archive/unused1.cpp b/tests/auto/blackbox/testdata/whole-archive/unused1.cpp new file mode 100644 index 000000000..0ef9de728 --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/unused1.cpp @@ -0,0 +1 @@ +void unusedFunc1() { } diff --git a/tests/auto/blackbox/testdata/whole-archive/unused2.cpp b/tests/auto/blackbox/testdata/whole-archive/unused2.cpp new file mode 100644 index 000000000..054a4874a --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/unused2.cpp @@ -0,0 +1 @@ +void unusedFunc2() { } diff --git a/tests/auto/blackbox/testdata/whole-archive/unused3.cpp b/tests/auto/blackbox/testdata/whole-archive/unused3.cpp new file mode 100644 index 000000000..939cd6e11 --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/unused3.cpp @@ -0,0 +1 @@ +void unusedFunc3() { } diff --git a/tests/auto/blackbox/testdata/whole-archive/unused4.cpp b/tests/auto/blackbox/testdata/whole-archive/unused4.cpp new file mode 100644 index 000000000..53b5229a7 --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/unused4.cpp @@ -0,0 +1 @@ +void unusedFunc4() { } diff --git a/tests/auto/blackbox/testdata/whole-archive/used.cpp b/tests/auto/blackbox/testdata/whole-archive/used.cpp new file mode 100644 index 000000000..fe7afff2f --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/used.cpp @@ -0,0 +1 @@ +void usedFunc() { } diff --git a/tests/auto/blackbox/testdata/whole-archive/whole-archive.qbs b/tests/auto/blackbox/testdata/whole-archive/whole-archive.qbs new file mode 100644 index 000000000..26a6ef217 --- /dev/null +++ b/tests/auto/blackbox/testdata/whole-archive/whole-archive.qbs @@ -0,0 +1,78 @@ +import qbs + +Project { + Product { + name: "nmPathRetriever" + type: ["custom"] + Depends { name: "cpp" } + Rule { + multiplex: true + Artifact { + filePath: "dummy.txt" + fileTags: ["custom"] + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.silent = true; + cmd.sourceCode = function() { + console.warn("---" + product.cpp.nmPath + "---"); + } + return [cmd]; + } + } + } + + StaticLibrary { + name: "staticlib 1" + Depends { name: "cpp" } + files: ["unused1.cpp", "used.cpp"] + } + StaticLibrary { + name: "staticlib2" + Depends { name: "cpp" } + files: ["unused2.cpp"] + } + StaticLibrary { + name: "staticlib3" + Depends { name: "cpp" } + files: ["unused3.cpp"] + } + StaticLibrary { + name: "staticlib4" + Depends { name: "cpp" } + files: ["unused4.cpp"] + } + + DynamicLibrary { + name: "dynamiclib" + property string linkWholeArchive + Depends { name: "cpp" } + Depends { name: "staticlib 1"; cpp.linkWholeArchive: product.linkWholeArchive } + Depends { name: "staticlib2"; cpp.linkWholeArchive: product.linkWholeArchive } + Depends { name: "staticlib3" } + Depends { name: "staticlib4"; cpp.linkWholeArchive: product.linkWholeArchive } + files: ["dynamiclib.cpp"] + } + + CppApplication { + name: "app1" + Depends { name: "dynamiclib" } + files: ["main1.cpp"] + } + + CppApplication { + name: "app2" + Depends { name: "dynamiclib" } + files: ["main2.cpp"] + } + CppApplication { + name: "app3" + Depends { name: "dynamiclib" } + files: ["main3.cpp"] + } + CppApplication { + name: "app4" + Depends { name: "dynamiclib" } + files: ["main4.cpp"] + } +} |