aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKai Dohmen <kdohmen@lumino.de>2020-12-09 13:39:04 +0100
committerKai Dohmen <psykai1993@googlemail.com>2020-12-12 09:12:08 +0000
commit1bd9601c65449a961e2a9c442fec144089d80696 (patch)
treedea6dde5f4813c2a2c5192f7456430a7ad01b9a1 /share
parent647ad9092207f0d317c3f3ac70fd8810d7929462 (diff)
Probe for release and debug version of protobuf libraries
When cpp protobuf or nanopb gets compiled as debug build the library gets the suffix "d". The library probe will search for the release name and the debug name. If no library could be found let the user set the library name. Change-Id: I6574986e527fe4484935e58ccf45c86feee230e5 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'share')
-rw-r--r--share/qbs/modules/protobuf/cpp/protobufcpp.qbs16
-rw-r--r--share/qbs/modules/protobuf/nanopb/nanopb.qbs18
2 files changed, 30 insertions, 4 deletions
diff --git a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
index 9f2dbc7af..47d1a60c1 100644
--- a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
+++ b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
@@ -15,6 +15,13 @@ ProtobufBase {
property string grpcIncludePath: grpcIncludeProbe.path
property string grpcLibraryPath: grpcLibraryProbe.path
+ readonly property string _libraryName: {
+ var libraryName = FileInfo.baseName(libraryProbe.fileName);
+ if (libraryName.startsWith("lib"))
+ libraryName = libraryName.substring(3);
+ return libraryName;
+ }
+
Depends { name: "cpp" }
property path grpcPluginPath: grpcPluginProbe.filePath
@@ -34,7 +41,9 @@ ProtobufBase {
return result;
}
cpp.dynamicLibraries: {
- var result = ["protobuf"];
+ var result = [];
+ if (_libraryName)
+ result.push(_libraryName)
if (qbs.targetOS.contains("unix"))
result.push("pthread");
if (useGrpc)
@@ -89,7 +98,10 @@ ProtobufBase {
Probes.LibraryProbe {
id: libraryProbe
- names: "protobuf"
+ names: [
+ "protobuf",
+ "protobufd",
+ ]
}
Probes.IncludeProbe {
diff --git a/share/qbs/modules/protobuf/nanopb/nanopb.qbs b/share/qbs/modules/protobuf/nanopb/nanopb.qbs
index 02754b8c4..36bdc9254 100644
--- a/share/qbs/modules/protobuf/nanopb/nanopb.qbs
+++ b/share/qbs/modules/protobuf/nanopb/nanopb.qbs
@@ -12,6 +12,12 @@ ProtobufBase {
property string pluginPath: pluginProbe.path
property string _plugin: "protoc-gen-nanopb=" +
FileInfo.joinPaths(pluginPath, "protoc-gen-nanopb")
+ readonly property string _libraryName: {
+ var libraryName = FileInfo.baseName(libraryProbe.fileName);
+ if (libraryName.startsWith("lib"))
+ libraryName = libraryName.substring(3);
+ return libraryName;
+ }
Depends { name: "cpp" }
@@ -21,7 +27,12 @@ ProtobufBase {
result.push(libraryPath);
return result;
}
- cpp.dynamicLibraries: "protobuf-nanopb"
+ cpp.dynamicLibraries: {
+ var result = [];
+ if (_libraryName)
+ result.push(_libraryName);
+ return result;
+ }
cpp.includePaths: {
var result = [outputDir];
if (includePath)
@@ -62,7 +73,10 @@ ProtobufBase {
Probes.LibraryProbe {
id: libraryProbe
- names: "protobuf-nanopb"
+ names: [
+ "protobuf-nanopb",
+ "protobuf-nanopbd",
+ ]
}
Probes.BinaryProbe {