From da8b3f237a17d463919ef9e0586656747e54f359 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 11 May 2021 11:38:27 +0200 Subject: [PATCH] qbs build: Prefer KSyntaxHighlighting from system Note that the system package will only be found with qbs >= 1.20. Change-Id: I361b774d6b35fdbd0386144d4e9812f02f7841e5 Reviewed-by: Christian Stenger --- qbs/modules/qtc/qtc.qbs | 2 ++ .../syntax-highlighting.qbs | 25 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index a16957c0ee3..8a242902426 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -68,6 +68,8 @@ Module { property bool enableUbSanitizer: false property bool enableThreadSanitizer: false + property bool preferSystemSyntaxHighlighting: true + property bool make_dev_package: false // Will be replaced when creating modules from products diff --git a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs index 2261d97d697..e3c7682e3f5 100644 --- a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs +++ b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs @@ -4,9 +4,27 @@ import qbs.FileInfo import qbs.Environment Project { - QtcLibrary { + Product { name: "KSyntaxHighlighting" + Export { + Depends { name: "qtc" } + Depends { + name: "Qt.KSyntaxHighlighting" + condition: qtc.preferSystemSyntaxHighlighting + required: false + } + Depends { + name: "KSyntaxHighlighting_bundled" + required: !qtc.preferSystemSyntaxHighlighting + } + } + } + + QtcLibrary { + name: "KSyntaxHighlighting_bundled" + condition: !qtc.preferSystemSyntaxHighlighting || !Qt.KSyntaxHighlighting.present + cpp.defines: base.concat("KSYNTAXHIGHLIGHTING_LIBRARY") cpp.includePaths: [ product.sourceDirectory + "/src/lib/", @@ -16,6 +34,11 @@ Project { Depends { name: "Qt.gui" } Depends { name: "Qt.network" } + Depends { + name: "Qt.KSyntaxHighlighting" + condition: qtc.preferSystemSyntaxHighlighting + required: false + } Group { name: "lib"