summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-01-09 16:16:36 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2023-02-16 16:18:48 +0000
commitd8523b5b2568a14fc9dc5fb4de09895c6ca02a01 (patch)
tree731d2a6f815edb9aff79cb477a2a3f2be5c8b41e
parente3522f42773cfbb9a980e859c906457b3571fa1f (diff)
downloadqbs-d8523b5b2568a14fc9dc5fb4de09895c6ca02a01.tar.gz
Protobuf: Let users provide extra grpc libs for linking
... and make use of that in the CI. Change-Id: I7e246e265a311ba24ebd6cde808445039d4c3e93 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
-rw-r--r--.github/workflows/main.yml1
-rw-r--r--share/qbs/modules/protobuf/cpp/protobufcpp.qbs5
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp7
3 files changed, 12 insertions, 1 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a71186ef6..7adf33c80 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -617,6 +617,7 @@ jobs:
QTEST_FUNCTION_TIMEOUT: 9000000
QBS_AUTOTEST_PROFILE: 'qt'
QBS_TEST_SOURCE_ROOT: 'tests'
+ QBS_EXTRA_GRPC_LIBS: 'absl_synchronization,gpr'
strategy:
fail-fast: false
matrix:
diff --git a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
index f377c63cf..9d333d327 100644
--- a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
+++ b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
@@ -12,6 +12,7 @@ ProtobufBase {
property bool useGrpc: false
property bool _linkLibraries: true
+ property stringList _extraGrpcLibs: []
readonly property bool _hasModules: protobuflib.present && (!useGrpc || grpcpp.present)
property string grpcIncludePath: grpcIncludeProbe.found ? grpcIncludeProbe.path : undefined
@@ -69,8 +70,10 @@ ProtobufBase {
result.push(_libraryName)
if (qbs.targetOS.contains("unix"))
result.push("pthread");
- if (useGrpc)
+ if (useGrpc) {
+ result = result.concat(_extraGrpcLibs);
result.push("grpc++");
+ }
return result;
}
cpp.includePaths: {
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 26f29ed0e..7d743c584 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -8526,6 +8526,13 @@ void TestBlackbox::grpc()
rmDirR(relativeBuildDir());
QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile});
+ if (QTest::currentDataTag() == QLatin1String("cpp")) {
+ if (const QString extraLibs = qEnvironmentVariable("QBS_EXTRA_GRPC_LIBS");
+ !extraLibs.isEmpty()) {
+ resolveParams.arguments << (QLatin1String("modules.protobuf.cpp._extraGrpcLibs:")
+ + extraLibs);
+ }
+ }
resolveParams.arguments << arguments;
QCOMPARE(runQbs(resolveParams), 0);
const bool withGrpc = m_qbsStdout.contains("has grpc: true");