From e8066dd330d219737ecd32fd21ef5cd7c4c576b2 Mon Sep 17 00:00:00 2001 From: raphaelcotty Date: Sun, 9 Jan 2022 17:26:42 +0100 Subject: [PATCH] Linux crash (#9) * Qbs build: correct rpath for conan libraries Libraries managed with conan are now downloaded in dynamic. They are also installed in the build directory. This directory path is also added to all the applications rpaths. This ensure that the application loads the correct library. * Qbs build: correct rpath for conan libraries Libraries managed with conan are now downloaded in dynamic. They are also installed in the build directory. This directory path is also added to all the applications rpaths. This ensure that the application loads the correct library. --- .gitignore | 5 ----- Pdf4Qt.qbs | 39 ++++++++++++++++++++++++++++++--------- conanfile.txt | 13 +++++++++++++ qbs/imports/Pdf4QtApp.qbs | 3 +-- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 3ad52c1..cbfa738 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,2 @@ *.pro.user *.qbs.user -conan.lock -conanbuildinfo.qbs -conanbuildinfo.txt -conaninfo.txt -graph_info.json diff --git a/Pdf4Qt.qbs b/Pdf4Qt.qbs index d475fc8..c2ee907 100644 --- a/Pdf4Qt.qbs +++ b/Pdf4Qt.qbs @@ -1,9 +1,11 @@ import qbs +import qbs.FileInfo import qbs.Probes Project { name: "Pdf4Qt" qbsSearchPaths: ["qbs"] + property string conanLibDirectory: FileInfo.joinPaths(conan.generatedFilesPath, "lib") Probes.ConanfileProbe { id: conan @@ -14,21 +16,40 @@ Project { references: { var ref = ["Pdf4QtLib/Pdf4QtLib.qbs", "Pdf4QtViewer/Pdf4QtViewer.qbs", - "Pdf4QtViewerLite/Pdf4QtViewerLite.qbs", - "CodeGenerator/CodeGenerator.qbs", - "JBIG2_Viewer/JBIG2_Viewer.qbs", - "Pdf4QtDocPageOrganizer/Pdf4QtDocPageOrganizer.qbs", - "Pdf4QtDocDiff/Pdf4QtDocDiff.qbs", "Pdf4QtViewerPlugins/AudioBookPlugin/AudioBookPlugin.qbs", "Pdf4QtViewerPlugins/DimensionsPlugin/DimensionsPlugin.qbs", "Pdf4QtViewerPlugins/OutputPreviewPlugin/OutputPreviewPlugin.qbs", "Pdf4QtViewerPlugins/RedactPlugin/RedactPlugin.qbs", "Pdf4QtViewerPlugins/SoftProofingPlugin/SoftProofingPlugin.qbs", - "Pdf4QtViewerProfi/Pdf4QtViewerProfi.qbs", - "PdfExampleGenerator/PdfExampleGenerator.qbs", - "PdfTool/PdfTool.qbs", - "UnitTests/UnitTests.qbs"]; + ]; ref.push(conan.generatedFilesPath + "/conanbuildinfo.qbs"); return ref; } + SubProject { + filePath: "Pdf4QtViewerProfi/Pdf4QtViewerProfi.qbs" + } + SubProject { + filePath: "CodeGenerator/CodeGenerator.qbs" + } + SubProject { + filePath: "JBIG2_Viewer/JBIG2_Viewer.qbs" + } + SubProject { + filePath: "Pdf4QtDocPageOrganizer/Pdf4QtDocPageOrganizer.qbs" + } + SubProject { + filePath: "Pdf4QtViewerLite/Pdf4QtViewerLite.qbs" + } + SubProject { + filePath: "Pdf4QtDocDiff/Pdf4QtDocDiff.qbs" + } + SubProject { + filePath: "PdfExampleGenerator/PdfExampleGenerator.qbs" + } + SubProject { + filePath: "PdfTool/PdfTool.qbs" + } + SubProject { + filePath: "UnitTests/UnitTests.qbs" + } } diff --git a/conanfile.txt b/conanfile.txt index dc4f9ee..7696a00 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -4,8 +4,21 @@ freetype/2.11.0 libjpeg/9c openjpeg/2.4.0 lcms/2.12 +libpng/1.6.37 [generators] qbs [options] +openssl:shared=True +freetype:shared=True +libjpeg:shared=True +openjpeg:shared=True +lcms:shared=True +libpng:shared=True + +[imports] +bin, *.dll -> ./bin # Copies all dll files from packages bin folder to my "bin" folder +lib, *.dylib* -> ./lib # Copies all dylib files from packages lib folder to my "lib" folder +lib, *.so* -> ./lib # Copies all so files from packages lib folder to my "lib" folder + diff --git a/qbs/imports/Pdf4QtApp.qbs b/qbs/imports/Pdf4QtApp.qbs index d6c3d46..21cab5d 100644 --- a/qbs/imports/Pdf4QtApp.qbs +++ b/qbs/imports/Pdf4QtApp.qbs @@ -3,7 +3,7 @@ import qbs.FileInfo Pdf4QtProduct { Depends { name: "cpp" } type: "application" - cpp.rpaths: FileInfo.joinPaths(cpp.rpathOrigin, "..", "lib") + cpp.rpaths: [FileInfo.joinPaths(cpp.rpathOrigin, "..", "lib"), conanLibDirectory] Depends { name: "Pdf4QtLib" } Group { @@ -14,4 +14,3 @@ Pdf4QtProduct { } targetInstallDir: pdf4qtbuildconfig.appInstallDir } -