diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2020-08-07 21:36:45 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2020-08-12 07:54:02 +0000 |
commit | 14f245ff71b4398dfe059644fc4594b38ae770da (patch) | |
tree | b7044ef1fa1c2f31bc0f2fca25863bcda59e2424 | |
parent | 5be07c2b1fbe6372d5c2d7b4d339d530fe209fb4 (diff) | |
download | qbs-14f245ff71b4398dfe059644fc4594b38ae770da.tar.gz |
Implement cpp.generateCompilerListingFiles for MSVC toolchain
We need to use the /Fa compiler option as described here:
* https://docs.microsoft.com/en-us/cpp/build/reference/fa-fa-listing-file?view=vs-2019
Change-Id: I81470bfbf84563a49bd5336e7204a07d5b2c910e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
6 files changed, 24 insertions, 7 deletions
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index e92359377..da9996b85 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -1845,9 +1845,7 @@ \qmlproperty bool cpp::generateCompilerListingFiles \since Qbs 1.15 - \baremetalproperty - - Whether to auto-generate a compiler listing files. + Whether to auto-generate compiler listing files. \defaultvalue \c{false} */ diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index 72ee08fe9..df1f5eb5b 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -245,6 +245,9 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli if (product.cpp.debugInformation && product.cpp.separateDebugInformation) args.push("/Fd" + product.targetName + ".cl" + product.cpp.debugInfoSuffix); + if (input.cpp.generateCompilerListingFiles) + args.push("/Fa" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath)); + var objectMap = outputs.obj || outputs.intermediate_obj var objOutput = objectMap ? objectMap[0] : undefined args.push('/Fo' + FileInfo.toWindowsSeparators(objOutput.filePath)) diff --git a/share/qbs/modules/cpp/windows-msvc-base.qbs b/share/qbs/modules/cpp/windows-msvc-base.qbs index 34132ac49..e88c3f15f 100644 --- a/share/qbs/modules/cpp/windows-msvc-base.qbs +++ b/share/qbs/modules/cpp/windows-msvc-base.qbs @@ -149,15 +149,23 @@ CppModule { auxiliaryInputs: ["hpp"] explicitlyDependsOn: ["c_pch", "cpp_pch"] - outputFileTags: ["obj", "intermediate_obj"] + outputFileTags: ["obj", "intermediate_obj", "lst"] outputArtifacts: { var tags = input.fileTags.contains("cpp_intermediate_object") ? ["intermediate_obj"] : ["obj"]; - return [{ + var artifacts = []; + artifacts.push({ fileTags: tags, filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".obj" - }]; + }); + if (input.cpp.generateCompilerListingFiles) { + artifacts.push({ + fileTags: ["lst"], + filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".lst" + }); + } + return artifacts; } prepare: { diff --git a/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/do-not-generate-compiler-listing.qbs b/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/do-not-generate-compiler-listing.qbs index 5ae0316c7..dc35ac2b8 100644 --- a/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/do-not-generate-compiler-listing.qbs +++ b/tests/auto/blackbox/testdata-baremetal/do-not-generate-compiler-listing/do-not-generate-compiler-listing.qbs @@ -2,6 +2,10 @@ import "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { condition: { + if (qbs.toolchainType === "msvc") + return true; + if (qbs.toolchainType === "clang-cl") + return true; if (qbs.toolchainType === "iar") return true; if (qbs.toolchainType === "keil") { diff --git a/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/generate-compiler-listing.qbs b/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/generate-compiler-listing.qbs index aebbfb664..ceb7d310e 100644 --- a/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/generate-compiler-listing.qbs +++ b/tests/auto/blackbox/testdata-baremetal/generate-compiler-listing/generate-compiler-listing.qbs @@ -2,6 +2,10 @@ import "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { condition: { + if (qbs.toolchainType === "msvc") + return true; + if (qbs.toolchainType === "clang-cl") + return true; if (qbs.toolchainType === "iar") return true; if (qbs.toolchainType === "keil") { diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp index 969de6299..91f05ae22 100644 --- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp +++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp @@ -37,7 +37,7 @@ static bool extractToolset(const QByteArray &output, QByteArray &toolchain, QByteArray &architecture) { - const QRegularExpression re("%%(\\w+)%%, %%(\\w+)%%"); + const QRegularExpression re("%%([\\w\\-]+)%%, %%(\\w+)%%"); QRegularExpressionMatchIterator it = re.globalMatch(output); if (!it.hasNext()) return false; |