diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2020-03-17 20:13:36 +0100 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2020-03-20 17:47:29 +0000 |
commit | ee0b4e1fed81e63685f4b6deb30e4893b9193820 (patch) | |
tree | de64366c0ae7d0badb3c57bf91ce11ff5a15c71b | |
parent | 211ff09d350855d467a27b52f8a62930c1477996 (diff) |
Convenience items can now install separated debug info
This patchset adds the 'installDebugInformation' and
'debugInformationInstallDir' properties to the NativeBinary item and
adds Group items that install debug info to the Library and Application
items.
Also, update How-To about installing debug symbols
More documentation (for the Library and the NativeBinary items) will be
added in a separate patchset
Change-Id: I32687b99871fe40a8e26db09aa118a89ae73f922
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | doc/howtos.qdoc | 32 | ||||
-rw-r--r-- | share/qbs/imports/qbs/base/Application.qbs | 8 | ||||
-rw-r--r-- | share/qbs/imports/qbs/base/Library.qbs | 14 | ||||
-rw-r--r-- | share/qbs/imports/qbs/base/NativeBinary.qbs | 3 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/install-locations/install-locations.qbs | 6 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 37 |
6 files changed, 91 insertions, 9 deletions
diff --git a/doc/howtos.qdoc b/doc/howtos.qdoc index 61da7af53..696c444cb 100644 --- a/doc/howtos.qdoc +++ b/doc/howtos.qdoc @@ -151,15 +151,31 @@ } \endcode - If the \l{cpp::separateDebugInformation}{cpp.separateDebugInformation} property is set to - \c true, \QBS will create debugging symbols with the corresponding file tags + Now, you can install your \l{Application}{application}, \l{DynamicLibrary}{dynamic library} + or \l{LoadableModule}{loadable module} among with its debugging symbols as follows: + \code + CppApplication { + // ... + install: true + installDir: "bin" + installDebugInformation: true + debugInformationInstallDir: "bin" + } + \endcode + + If you are not using \l{List of Convenience Items}{convenience items}, + you can install debug symbols manually using the \l{Group} item. If the + \l{cpp::separateDebugInformation}{cpp.separateDebugInformation} property is set to \c true, + \QBS will create debugging symbols with the corresponding file tags \c "debuginfo_app" (for an application), \c "debuginfo_dll" (for a dynamic library), or \c "debuginfo_loadablemodule" (for a macOS plugin). - Now, you can install your application and its debugging symbols as follows: \code - CppApplication { - // ... + Product { + type: "application" + Depends { name: "cpp" } + cpp.debugInformation: qbs.buildVariant !== "release" + cpp.separateDebugInformation: true Group { fileTagsFilter: cpp.separateDebugInformation ? ["debuginfo_app"] : [] qbs.install: true @@ -171,7 +187,8 @@ If you're building a shared library, you need to use the \c "debuginfo_dll" tag instead: \code - DynamicLibrary { + Product { + type: "dynamic_library" // ... Group { fileTagsFilter: cpp.separateDebugInformation ? ["debuginfo_dll"] : [] @@ -185,7 +202,8 @@ If you're building a macOS plugin, you need to use the \c "debuginfo_loadablemodule" tag instead: \code - LoadableModule { + Product { + type: "loadablemodule" // ... Group { fileTagsFilter: cpp.separateDebugInformation ? ["debuginfo_loadablemodule"] : [] diff --git a/share/qbs/imports/qbs/base/Application.qbs b/share/qbs/imports/qbs/base/Application.qbs index 694cfb83b..63ffc6283 100644 --- a/share/qbs/imports/qbs/base/Application.qbs +++ b/share/qbs/imports/qbs/base/Application.qbs @@ -66,4 +66,12 @@ NativeBinary { qbs.installDir: installDir qbs.installSourceBase: isBundle ? destinationDirectory : outer } + + Group { + condition: installDebugInformation + fileTagsFilter: ["debuginfo_app"] + qbs.install: true + qbs.installDir: debugInformationInstallDir + qbs.installSourceBase: destinationDirectory + } } diff --git a/share/qbs/imports/qbs/base/Library.qbs b/share/qbs/imports/qbs/base/Library.qbs index 2a5183606..62e5f9d30 100644 --- a/share/qbs/imports/qbs/base/Library.qbs +++ b/share/qbs/imports/qbs/base/Library.qbs @@ -73,4 +73,18 @@ NativeBinary { qbs.install: true qbs.installDir: importLibInstallDir } + + Group { + condition: installDebugInformation + fileTagsFilter: { + if (isDynamicLibrary) + return ["debuginfo_dll"]; + else if (isLoadableModule) + return ["debuginfo_loadablemodule"]; + return []; + } + qbs.install: true + qbs.installDir: debugInformationInstallDir + qbs.installSourceBase: destinationDirectory + } } diff --git a/share/qbs/imports/qbs/base/NativeBinary.qbs b/share/qbs/imports/qbs/base/NativeBinary.qbs index 3597f348f..0928e96bb 100644 --- a/share/qbs/imports/qbs/base/NativeBinary.qbs +++ b/share/qbs/imports/qbs/base/NativeBinary.qbs @@ -36,6 +36,9 @@ Product { property bool install: false property string installDir + property bool installDebugInformation: false + property string debugInformationInstallDir: installDir + Depends { name: "bundle"; condition: isForDarwin } aggregate: { diff --git a/tests/auto/blackbox/testdata/install-locations/install-locations.qbs b/tests/auto/blackbox/testdata/install-locations/install-locations.qbs index 044ecf710..4ad37c498 100644 --- a/tests/auto/blackbox/testdata/install-locations/install-locations.qbs +++ b/tests/auto/blackbox/testdata/install-locations/install-locations.qbs @@ -10,7 +10,9 @@ Project { CppApplication { name: "theapp" install: true + installDebugInformation: true files: "main.cpp" + cpp.separateDebugInformation: true Group { fileTagsFilter: "application" fileTags: "some-tag" @@ -20,13 +22,17 @@ Project { name: "thelib" install: true installImportLib: true + installDebugInformation: true Depends { name: "cpp" } + cpp.separateDebugInformation: true files: "thelib.cpp" } LoadableModule { name: "theplugin" install: true + installDebugInformation: true Depends { name: "cpp" } + cpp.separateDebugInformation: true files: "theplugin.cpp" } } diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 2738d0c6d..97e2c1943 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -4002,10 +4002,15 @@ void TestBlackbox::installLocations_data() QTest::addColumn<QString>("dllDir"); QTest::addColumn<QString>("libDir"); QTest::addColumn<QString>("pluginDir"); + QTest::addColumn<QString>("dsymDir"); QTest::newRow("explicit values") - << QString("bindir") << QString("dlldir") << QString("libdir") << QString("pluginDir"); + << QString("bindir") + << QString("dlldir") + << QString("libdir") + << QString("pluginDir") + << QString("dsymDir"); QTest::newRow("default values") - << QString() << QString() << QString() << QString(); + << QString() << QString() << QString() << QString() << QString(); } void TestBlackbox::installLocations() @@ -4015,6 +4020,7 @@ void TestBlackbox::installLocations() QFETCH(QString, dllDir); QFETCH(QString, libDir); QFETCH(QString, pluginDir); + QFETCH(QString, dsymDir); QbsRunParameters params("resolve"); if (!binDir.isEmpty()) params.arguments.push_back("products.theapp.installDir:" + binDir); @@ -4024,6 +4030,11 @@ void TestBlackbox::installLocations() params.arguments.push_back("products.thelib.importLibInstallDir:" + libDir); if (!pluginDir.isEmpty()) params.arguments.push_back("products.theplugin.installDir:" + pluginDir); + if (!dsymDir.isEmpty()) { + params.arguments.push_back("products.theapp.debugInformationInstallDir:" + dsymDir); + params.arguments.push_back("products.thelib.debugInformationInstallDir:" + dsymDir); + params.arguments.push_back("products.theplugin.debugInformationInstallDir:" + dsymDir); + } QCOMPARE(runQbs(params), 0); const bool isWindows = m_qbsStdout.contains("is windows"); const bool isMac = m_qbsStdout.contains("is mac"); @@ -4048,16 +4059,31 @@ void TestBlackbox::installLocations() dllDir.isEmpty() ? (isMac ? "/Library/Frameworks" : isWindows ? "/bin" : "/lib") : dllDir, isMac ? "thelib.framework" : "" }; + const BinaryInfo dllDsym = { + isWindows ? "thelib.pdb" : isMac ? "thelib.framework.dSYM" : "libthelib.so.debug", + dsymDir.isEmpty() ? dll.installDir : dsymDir, + {} + }; const BinaryInfo plugin = { isWindows ? "theplugin.dll" : isMac ? "theplugin" : "libtheplugin.so", pluginDir.isEmpty() ? dll.installDir : pluginDir, isMac ? "theplugin.bundle/Contents/MacOS" : "" }; + const BinaryInfo pluginDsym = { + isWindows ? "theplugin.pdb" : isMac ? "theplugin.bundle.dSYM" : "libtheplugin.so.debug", + dsymDir.isEmpty() ? plugin.installDir : dsymDir, + {} + }; const BinaryInfo app = { isWindows ? "theapp.exe" : "theapp", binDir.isEmpty() ? (isMac ? "/Applications" : "/bin") : binDir, isMac ? "theapp.app/Contents/MacOS" : "" }; + const BinaryInfo appDsym = { + isWindows ? "theapp.pdb" : isMac ? "theapp.app.dSYM" : "theapp.debug", + dsymDir.isEmpty() ? app.installDir : dsymDir, + {} + }; const QString installRoot = QDir::currentPath() + "/default/install-root"; const QString installPrefix = isWindows ? QString() : "/usr/local"; @@ -4077,6 +4103,13 @@ void TestBlackbox::installLocations() } const QString pluginFilePath = plugin.absolutePath(fullInstallPrefix); QVERIFY2(QFile::exists(pluginFilePath), qPrintable(pluginFilePath)); + + const QString appDsymFilePath = appDsym.absolutePath(fullInstallPrefix); + QVERIFY2(QFileInfo(appDsymFilePath).exists(), qPrintable(appDsymFilePath)); + const QString dllDsymFilePath = dllDsym.absolutePath(fullInstallPrefix); + QVERIFY2(QFileInfo(dllDsymFilePath).exists(), qPrintable(dllDsymFilePath)); + const QString pluginDsymFilePath = pluginDsym.absolutePath(fullInstallPrefix); + QVERIFY2(QFile::exists(pluginDsymFilePath), qPrintable(pluginDsymFilePath)); } void TestBlackbox::inputsFromDependencies() |