qbs build: Add litehtml support

Change-Id: Ia78ab35a5e844d5b2a1ee18752445c887228981f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2019-12-18 14:13:55 +01:00
parent 94d5aa8b98
commit c2501dc938
3 changed files with 289 additions and 62 deletions

View File

@@ -1,76 +1,96 @@
import qbs 1.0
QtcPlugin {
Project {
name: "Help"
Depends { name: "Qt"; submodules: ["help", "network", "sql"]; }
Depends { name: "Qt.printsupport" }
Depends { name: "Qt.webenginewidgets"; required: false }
references: "qlitehtml"
Depends { name: "Aggregation" }
Depends { name: "Utils" }
QtcPlugin {
name: "Help"
Depends { name: "Core" }
Depends { name: "ProjectExplorer" }
Depends { name: "Qt"; submodules: ["help", "network", "sql"]; }
Depends { name: "Qt.printsupport" }
Depends { name: "Qt.webenginewidgets"; required: false }
Depends { name: "app_version_header" }
Depends { name: "Aggregation" }
Depends { name: "Utils" }
cpp.defines: {
var defines = base.concat(["QT_CLUCENE_SUPPORT"]);
if (Qt.webenginewidgets.present)
defines.push("QTC_WEBENGINE_HELPVIEWER");
return defines;
}
Depends { name: "Core" }
Depends { name: "ProjectExplorer" }
// We include headers from src/shared/help, and their sources include headers from here...
cpp.includePaths: base.concat([sharedSources.prefix, path])
Depends { name: "app_version_header" }
Group {
name: "Sources"
files: [
"docsettingspage.cpp", "docsettingspage.h", "docsettingspage.ui",
"filtersettingspage.cpp", "filtersettingspage.h", "filtersettingspage.ui",
"generalsettingspage.cpp", "generalsettingspage.h", "generalsettingspage.ui",
"help.qrc",
"helpconstants.h",
"helpfindsupport.cpp", "helpfindsupport.h",
"helpindexfilter.cpp", "helpindexfilter.h",
"helpmanager.cpp", "helpmanager.h",
"helpmode.cpp", "helpmode.h",
"helpplugin.cpp", "helpplugin.h",
"helpviewer.cpp", "helpviewer.h",
"helpwidget.cpp", "helpwidget.h",
"localhelpmanager.cpp", "localhelpmanager.h",
"openpagesmanager.cpp", "openpagesmanager.h",
"openpagesswitcher.cpp", "openpagesswitcher.h",
"openpageswidget.cpp", "openpageswidget.h",
"searchtaskhandler.cpp", "searchtaskhandler.h",
"searchwidget.cpp", "searchwidget.h",
"textbrowserhelpviewer.cpp", "textbrowserhelpviewer.h",
"xbelsupport.cpp", "xbelsupport.h",
]
}
Depends { name: "qlitehtml"; required: false }
Group {
name: "WebEngine Sources"
condition: Qt.webenginewidgets.present
files: [
"webenginehelpviewer.cpp", "webenginehelpviewer.h"
]
}
cpp.defines: {
var defines = base.concat(["QT_CLUCENE_SUPPORT"]);
if (Qt.webenginewidgets.present)
defines.push("QTC_WEBENGINE_HELPVIEWER");
if (qlitehtml.present)
defines.push("QTC_LITEHTML_HELPVIEWER")
return defines;
}
Group {
id: sharedSources
name: "Shared Sources"
prefix: project.sharedSourcesDir + "/help/"
files: [
"bookmarkdialog.ui",
"bookmarkmanager.cpp", "bookmarkmanager.h",
"contentwindow.cpp", "contentwindow.h",
"filternamedialog.cpp", "filternamedialog.h", "filternamedialog.ui",
"helpicons.h",
"indexwindow.cpp", "indexwindow.h",
"topicchooser.cpp", "topicchooser.h", "topicchooser.ui",
]
// We include headers from src/shared/help, and their sources include headers from here...
cpp.includePaths: base.concat([sharedSources.prefix, path])
Group {
name: "Sources"
files: [
"docsettingspage.cpp", "docsettingspage.h", "docsettingspage.ui",
"filtersettingspage.cpp", "filtersettingspage.h", "filtersettingspage.ui",
"generalsettingspage.cpp", "generalsettingspage.h", "generalsettingspage.ui",
"help.qrc",
"helpconstants.h",
"helpfindsupport.cpp", "helpfindsupport.h",
"helpindexfilter.cpp", "helpindexfilter.h",
"helpmanager.cpp", "helpmanager.h",
"helpmode.cpp", "helpmode.h",
"helpplugin.cpp", "helpplugin.h",
"helpviewer.cpp", "helpviewer.h",
"helpwidget.cpp", "helpwidget.h",
"localhelpmanager.cpp", "localhelpmanager.h",
"openpagesmanager.cpp", "openpagesmanager.h",
"openpagesswitcher.cpp", "openpagesswitcher.h",
"openpageswidget.cpp", "openpageswidget.h",
"searchtaskhandler.cpp", "searchtaskhandler.h",
"searchwidget.cpp", "searchwidget.h",
"textbrowserhelpviewer.cpp", "textbrowserhelpviewer.h",
"xbelsupport.cpp", "xbelsupport.h",
]
}
Group {
name: "WebEngine Sources"
condition: Qt.webenginewidgets.present
files: [
"webenginehelpviewer.cpp", "webenginehelpviewer.h"
]
}
Group {
name: "litehtml-specific sources"
condition: qlitehtml.present
cpp.warningLevel: "none"
files: [
"litehtmlhelpviewer.cpp",
"litehtmlhelpviewer.h",
]
}
Group {
id: sharedSources
name: "Shared Sources"
prefix: project.sharedSourcesDir + "/help/"
files: [
"bookmarkdialog.ui",
"bookmarkmanager.cpp", "bookmarkmanager.h",
"contentwindow.cpp", "contentwindow.h",
"filternamedialog.cpp", "filternamedialog.h", "filternamedialog.ui",
"helpicons.h",
"indexwindow.cpp", "indexwindow.h",
"topicchooser.cpp", "topicchooser.h", "topicchooser.ui",
]
}
}
}

View File

@@ -0,0 +1,205 @@
import qbs.File
import qbs.FileInfo
Product {
type: buildLib ? ["staticlibrary"] : undefined
Depends { name: "cpp" }
Depends { name: "qtc" }
property bool useExternalLib: qtc.litehtmlInstallDir
property bool buildLib: !useExternalLib && File.exists(path + "/litehtml/CMakeLists.txt")
condition: useExternalLib || buildLib
property string gumboSrcDir: path + "/litehtml/src/gumbo"
property string gumboHeaderDir: gumboSrcDir + "/include/gumbo"
property string litehtmlHeaderDir: path + "/litehtml/include/litehtml"
property string mainHeaderDir: litehtmlHeaderDir + '/..'
property stringList sharedDefines: qbs.targetOS.contains("windows") ? ["LITEHTML_UTF8"] : []
cpp.defines: sharedDefines
cpp.includePaths: {
var paths = [gumboHeaderDir, gumboHeaderDir + '/..', litehtmlHeaderDir, mainHeaderDir];
if (qbs.targetOS.contains("windows"))
paths.push(gumboSrcDir + "/visualc/include");
return paths;
}
cpp.optimization: "fast"
cpp.warningLevel: "none"
Export {
Depends { name: "cpp" }
Group {
name: "litehtml/Qt glue"
cpp.warningLevel: "none"
files: [
"container_qpainter.cpp",
"container_qpainter.h",
"qlitehtmlwidget.cpp",
"qlitehtmlwidget.h",
]
}
Properties {
condition: product.useExternalLib
cpp.dynamicLibraries: ["litehtml", "gumbo"]
cpp.includePaths: [
FileInfo.joinPaths(qtc.litehtmlInstallDir, "include"),
FileInfo.joinPaths(qtc.litehtmlInstallDir, "include", "litehtml"),
]
cpp.libraryPaths: FileInfo.joinPaths(qtc.litehtmlInstallDir, "lib")
}
Properties {
condition: product.buildLib
cpp.defines: product.sharedDefines
cpp.includePaths: [product.mainHeaderDir, path]
}
}
Group {
condition: buildLib
name: "gumbo sources"
prefix: gumboSrcDir + '/'
files: [
"attribute.c",
"char_ref.c",
"error.c",
"parser.c",
"string_buffer.c",
"string_piece.c",
"tag.c",
"tokenizer.c",
"utf8.c",
"util.c",
"vector.c",
]
}
Group {
condition: buildLib
name: "gumbo headers"
prefix: gumboHeaderDir + '/'
files: [
"../gumbo.h",
"attribute.h",
"char_ref.h",
"error.h",
"insertion_mode.h",
"parser.h",
"string_buffer.h",
"string_piece.h",
"tag_enum.h",
"tag_gperf.h",
"tag_sizes.h",
"tag_strings.h",
"token_type.h",
"tokenizer.h",
"tokenizer_states.h",
"utf8.h",
"util.h",
"vector.h",
]
Group {
name: "gumbo Windows headers"
condition: qbs.targetOS.contains("windows")
files: "../visualc/include/strings.h"
}
}
Group {
condition: buildLib
name: "litehtml sources"
prefix: "litehtml/src/"
files: [
"background.cpp",
"box.cpp",
"context.cpp",
"css_length.cpp",
"css_selector.cpp",
"document.cpp",
"el_anchor.cpp",
"el_base.cpp",
"el_before_after.cpp",
"el_body.cpp",
"el_break.cpp",
"el_cdata.cpp",
"el_comment.cpp",
"el_div.cpp",
"element.cpp",
"el_font.cpp",
"el_image.cpp",
"el_link.cpp",
"el_para.cpp",
"el_script.cpp",
"el_space.cpp",
"el_style.cpp",
"el_table.cpp",
"el_td.cpp",
"el_text.cpp",
"el_title.cpp",
"el_tr.cpp",
"html.cpp",
"html_tag.cpp",
"iterators.cpp",
"media_query.cpp",
"style.cpp",
"stylesheet.cpp",
"table.cpp",
"utf8_strings.cpp",
"web_color.cpp",
]
}
Group {
condition: buildLib
name: "litehtml headers"
prefix: litehtmlHeaderDir + '/'
files: [
"../litehtml.h",
"attributes.h",
"background.h",
"borders.h",
"box.h",
"context.h",
"css_length.h",
"css_margins.h",
"css_offsets.h",
"css_position.h",
"css_selector.h",
"document.h",
"el_anchor.h",
"el_base.h",
"el_before_after.h",
"el_body.h",
"el_break.h",
"el_cdata.h",
"el_comment.h",
"el_div.h",
"el_font.h",
"el_image.h",
"el_link.h",
"el_para.h",
"el_script.h",
"el_space.h",
"el_style.h",
"el_table.h",
"el_td.h",
"el_text.h",
"el_title.h",
"el_tr.h",
"element.h",
"html.h",
"html_tag.h",
"iterators.h",
"media_query.h",
"os_types.h",
"style.h",
"stylesheet.h",
"table.h",
"types.h",
"utf8_strings.h",
"web_color.h",
]
}
}