* Add conan support

* Windows Qbs port using conan

* Correct QT_INSTALL_DIRECTORY define

* Correct QT_INSTALL_DIRECTORY define, again
This commit is contained in:
raphaelcotty 2021-12-13 12:04:18 +01:00 committed by GitHub
parent f355fe545b
commit 75d40806ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 92 additions and 27 deletions

7
.gitignore vendored
View File

@ -1 +1,6 @@
*.pro.user *.pro.user
conan.lock
conanbuildinfo.qbs
conanbuildinfo.txt
conaninfo.txt
graph_info.json

View File

@ -1,24 +1,34 @@
import qbs import qbs
import qbs.Probes
Project { Project {
name: "Pdf4Qt" name: "Pdf4Qt"
qbsSearchPaths: ["qbs"] qbsSearchPaths: ["qbs"]
references: [
"Pdf4QtLib/Pdf4QtLib.qbs", Probes.ConanfileProbe {
"Pdf4QtViewer/Pdf4QtViewer.qbs", id: conan
"Pdf4QtViewerLite/Pdf4QtViewerLite.qbs", conanfilePath: project.sourceDirectory + "/conanfile.txt"
"CodeGenerator/CodeGenerator.qbs", generators: "qbs"
"JBIG2_Viewer/JBIG2_Viewer.qbs", }
"Pdf4QtDocPageOrganizer/Pdf4QtDocPageOrganizer.qbs",
"Pdf4QtDocDiff/Pdf4QtDocDiff.qbs", references: {
"Pdf4QtViewerPlugins/AudioBookPlugin/AudioBookPlugin.qbs", var ref = ["Pdf4QtLib/Pdf4QtLib.qbs",
"Pdf4QtViewerPlugins/DimensionsPlugin/DimensionsPlugin.qbs", "Pdf4QtViewer/Pdf4QtViewer.qbs",
"Pdf4QtViewerPlugins/OutputPreviewPlugin/OutputPreviewPlugin.qbs", "Pdf4QtViewerLite/Pdf4QtViewerLite.qbs",
"Pdf4QtViewerPlugins/RedactPlugin/RedactPlugin.qbs", "CodeGenerator/CodeGenerator.qbs",
"Pdf4QtViewerPlugins/SoftProofingPlugin/SoftProofingPlugin.qbs", "JBIG2_Viewer/JBIG2_Viewer.qbs",
"Pdf4QtViewerProfi/Pdf4QtViewerProfi.qbs", "Pdf4QtDocPageOrganizer/Pdf4QtDocPageOrganizer.qbs",
"PdfExampleGenerator/PdfExampleGenerator.qbs", "Pdf4QtDocDiff/Pdf4QtDocDiff.qbs",
"PdfTool/PdfTool.qbs", "Pdf4QtViewerPlugins/AudioBookPlugin/AudioBookPlugin.qbs",
"UnitTests/UnitTests.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;
}
} }

View File

@ -8,4 +8,5 @@ Pdf4QtApp {
] ]
cpp.includePaths: ["."] cpp.includePaths: ["."]
Depends { name: "Qt"; submodules: ["widgets"] } Depends { name: "Qt"; submodules: ["widgets"] }
Depends { name: "Qt.winextras"; condition: qbs.hostOS.contains("windows") }
} }

View File

@ -4,10 +4,10 @@ Pdf4QtLibrary {
name: "Pdf4QtLib" name: "Pdf4QtLib"
Depends { name: "Qt"; submodules: ["core", "gui", "widgets", "xml"] } Depends { name: "Qt"; submodules: ["core", "gui", "widgets", "xml"] }
Depends { name: "openssl" } Depends { name: "openssl" }
Depends { name: "freetype2" } Depends { name: "freetype" }
Depends { name: "libjpeg" } Depends { name: "libjpeg" }
Depends { name: "libopenjp2" } Depends { name: "openjpeg" }
Depends { name: "lcms2" } Depends { name: "lcms" }
Depends { Depends {
condition: qbs.toolchain.contains("gcc") condition: qbs.toolchain.contains("gcc")
name: "tbb" name: "tbb"
@ -16,6 +16,12 @@ Pdf4QtLibrary {
condition: qbs.hostOS.contains("linux") condition: qbs.hostOS.contains("linux")
name: "fontconfig" name: "fontconfig"
} }
Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: "PDF4QTLIB_LIBRARY"
cpp.cxxFlags: "/bigobj"
}
files: [ files: [
"sources/*.cpp", "sources/*.cpp",
"sources/*.h", "sources/*.h",
@ -27,10 +33,10 @@ Pdf4QtLibrary {
Depends { name: "Qt"; submodules: ["core", "gui", "widgets", "xml"] } Depends { name: "Qt"; submodules: ["core", "gui", "widgets", "xml"] }
cpp.includePaths: ["sources"] cpp.includePaths: ["sources"]
Depends { name: "openssl" } Depends { name: "openssl" }
Depends { name: "freetype2" } Depends { name: "freetype" }
Depends { name: "libjpeg" } Depends { name: "libjpeg" }
Depends { name: "libopenjp2" } Depends { name: "openjpeg" }
Depends { name: "lcms2" } Depends { name: "lcms" }
Depends { Depends {
condition: qbs.toolchain.contains("gcc") condition: qbs.toolchain.contains("gcc")
name: "tbb" name: "tbb"

View File

@ -1,3 +1,5 @@
import qbs.Utilities
Pdf4QtLibrary { Pdf4QtLibrary {
name: "Pdf4QtViewer" name: "Pdf4QtViewer"
files: [ files: [
@ -7,12 +9,22 @@ Pdf4QtLibrary {
"pdf4qtviewer.qrc", "pdf4qtviewer.qrc",
] ]
cpp.includePaths: ["."] cpp.includePaths: ["."]
cpp.defines: ['QT_INSTALL_DIRECTORY=""'] Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: ["PDF4QTVIEWER_LIBRARY", "QT_INSTALL_DIRECTORY=" + Utilities.cStringQuote(Qt.core.binPath)]
}
Properties {
condition: qbs.hostOS.contains("linux")
cpp.defines: ["QT_INSTALL_DIRECTORY=" + Utilities.cStringQuote(Qt.core.binPath)]
}
cpp.defines: base.concat(["QT_INSTALL_DIRECTORY=" + Utilities.cStringQuote(Qt.core.binPath)])
Depends { name: "Qt"; submodules: ["printsupport", "texttospeech", "network", "xml"] } Depends { name: "Qt"; submodules: ["printsupport", "texttospeech", "network", "xml"] }
Depends { name: "Qt.winextras"; condition: qbs.hostOS.contains("windows") }
Depends { name: "Pdf4QtLib" } Depends { name: "Pdf4QtLib" }
Export { Export {
Depends { name: "cpp" } Depends { name: "cpp" }
cpp.includePaths: ["."] cpp.includePaths: ["."]
Depends { name: "Pdf4QtLib" } Depends { name: "Pdf4QtLib" }
Depends { name: "Qt.winextras"; condition: qbs.hostOS.contains("windows") }
} }
} }

View File

@ -8,4 +8,8 @@ Pdf4QtPlugin {
"*.ui", "*.ui",
"icons.qrc", "icons.qrc",
] ]
Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: "AUDIOBOOKPLUGIN_LIBRARY"
}
} }

View File

@ -8,4 +8,8 @@ Pdf4QtPlugin {
"*.ui", "*.ui",
"icons.qrc", "icons.qrc",
] ]
Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: "DIMENTIONPLUGIN_LIBRARY"
}
} }

View File

@ -9,4 +9,8 @@ Pdf4QtPlugin {
"icons.qrc", "icons.qrc",
] ]
cpp.includePaths: ["."] cpp.includePaths: ["."]
Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: "OUTPUTPREVIEWPLUGIN_LIBRARY"
}
} }

View File

@ -9,4 +9,8 @@ Pdf4QtPlugin {
"icons.qrc", "icons.qrc",
] ]
cpp.includePaths: ["."] cpp.includePaths: ["."]
Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: "REDACTPLUGIN_LIBRARY"
}
} }

View File

@ -9,4 +9,8 @@ Pdf4QtPlugin {
"icons.qrc", "icons.qrc",
] ]
cpp.includePaths: ["."] cpp.includePaths: ["."]
Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: "SOFTPROOFINGPLUGIN_LIBRARY"
}
} }

11
conanfile.txt Normal file
View File

@ -0,0 +1,11 @@
[requires]
openssl/1.1.1l
freetype/2.11.0
libjpeg/9c
openjpeg/2.4.0
lcms/2.12
[generators]
qbs
[options]

View File

@ -2,7 +2,7 @@ Product {
Depends { name: "pdf4qtbuildconfig" } Depends { name: "pdf4qtbuildconfig" }
Depends { name: "cpp" } Depends { name: "cpp" }
Depends { name: "Qt.core" } Depends { name: "Qt.core" }
cpp.cxxLanguageVersion: "c++2a" cpp.cxxLanguageVersion: "c++20"
property bool install: true property bool install: true
property string targetInstallDir property string targetInstallDir
} }