From 7ff290b7d1443f536a03e67c7cec2d125f8b6cb3 Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 20 Oct 2024 17:59:13 +1300 Subject: [PATCH] qscintilla: add support --- cmd/genbindings/exceptions.go | 11 +++++++++++ cmd/genbindings/main.go | 14 ++++++++++++++ docker/genbindings.Dockerfile | 14 +++++++++++++- pkg-config/QScintilla.pc.example | 9 +++++++++ qt-restricted-extras/qscintilla/cflags.go | 8 ++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 pkg-config/QScintilla.pc.example create mode 100644 qt-restricted-extras/qscintilla/cflags.go diff --git a/cmd/genbindings/exceptions.go b/cmd/genbindings/exceptions.go index edb5c03c..5b1ed189 100644 --- a/cmd/genbindings/exceptions.go +++ b/cmd/genbindings/exceptions.go @@ -69,6 +69,11 @@ func ImportHeaderForClass(className string) bool { return false } + if strings.HasPrefix(className, "Qsci") { + // QScintilla - does not produce imports + return false + } + switch className { case "QGraphicsEffectSource", // e.g. qgraphicseffect.h "QAbstractConcatenable", // qstringbuilder.h @@ -150,6 +155,12 @@ func CheckComplexity(p CppParameter, isReturnType bool) error { if err := CheckComplexity(t, isReturnType); err != nil { // e.g. QGradientStops is a QVector<> (OK) of QGradientStop (not OK) return err } + + // qsciscintilla.h QsciScintilla_Annotate4: no copy ctor for private type QsciStyledText + // Works fine normally, but not in a list + if t.ParameterType == "QsciStyledText" { + return ErrTooComplex + } } if strings.Contains(p.ParameterType, "(*)") { // Function pointer. diff --git a/cmd/genbindings/main.go b/cmd/genbindings/main.go index 3e332255..52150a55 100644 --- a/cmd/genbindings/main.go +++ b/cmd/genbindings/main.go @@ -23,6 +23,8 @@ func importPathForQtPackage(packageName string) string { switch packageName { case "qt": return BaseModule + "/qt" + case "qscintilla": + return BaseModule + "/qt-restricted-extras/" + packageName default: return BaseModule + "/qt/" + packageName } @@ -126,6 +128,18 @@ func main() { filepath.Join(*outDir, "qt/qprintsupport"), ClangMatchSameHeaderDefinitionOnly, ) + + // Depends on QtCore/Gui/Widgets, QPrintSupport + generate( + "qscintilla", + []string{ + "/usr/include/x86_64-linux-gnu/qt5/Qsci", + }, + *clang, + strings.Fields(pkgConfigCflags("Qt5PrintSupport")), + filepath.Join(*outDir, "qt-restricted-extras/qscintilla"), + ClangMatchSameHeaderDefinitionOnly, + ) } func generate(packageName string, srcDirs []string, clangBin string, cflags []string, outDir string, matcher ClangMatcher) { diff --git a/docker/genbindings.Dockerfile b/docker/genbindings.Dockerfile index 749a36e8..0589d25d 100644 --- a/docker/genbindings.Dockerfile +++ b/docker/genbindings.Dockerfile @@ -1,4 +1,16 @@ FROM debian:bookworm RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ - apt-get install -qyy golang-go qtbase5-dev clang + apt-get install --no-install-recommends -qyy \ + golang-go \ + qtbase5-dev \ + libqscintilla2-qt5-dev \ + clang \ + git \ + ca-certificates \ + pkg-config \ + build-essential && \ + apt-get clean +RUN mkdir -p /usr/local/lib/pkgconfig +COPY pkg-config/QScintilla.pc.example /usr/local/lib/pkgconfig/QScintilla.pc +ENV GOFLAGS=-buildvcs=false diff --git a/pkg-config/QScintilla.pc.example b/pkg-config/QScintilla.pc.example new file mode 100644 index 00000000..fc740710 --- /dev/null +++ b/pkg-config/QScintilla.pc.example @@ -0,0 +1,9 @@ +includedir=/usr/include/x86_64-linux-gnu/qt5/Qsci/ + +Name: QScintilla +Description: Qt5 port of the Scintilla source code editing widget +URL: http://www.riverbankcomputing.co.uk/software/qscintilla +Version: 2.13.3 +Requires: Qt5Widgets, Qt5PrintSupport +Libs: -lqscintilla2_qt5 +Cflags: -I${includedir} diff --git a/qt-restricted-extras/qscintilla/cflags.go b/qt-restricted-extras/qscintilla/cflags.go new file mode 100644 index 00000000..391f0d16 --- /dev/null +++ b/qt-restricted-extras/qscintilla/cflags.go @@ -0,0 +1,8 @@ +package qscintilla + +/* +#cgo CFLAGS: +#cgo CXXFLAGS: -std=c++17 +#cgo pkg-config: QScintilla +*/ +import "C"