mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
scintillaedit: add support
This commit is contained in:
parent
1ef63a1673
commit
82413f8967
@ -24,6 +24,7 @@ func InsertTypedefs() {
|
||||
// QFile doesn't see QFileDevice parent class enum
|
||||
KnownTypedefs["QFile::Permissions"] = lookupResultTypedef{"qt", CppTypedef{"QFile::Permissions", parseSingleTypeString("QFileDevice::Permissions")}}
|
||||
KnownTypedefs["QFileDevice::Permissions"] = lookupResultTypedef{"qt", CppTypedef{"QFile::Permissions", parseSingleTypeString("QFlags<QFileDevice::Permission>")}}
|
||||
|
||||
}
|
||||
|
||||
func AllowHeader(fullpath string) bool {
|
||||
@ -95,6 +96,10 @@ func AllowClass(className string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if strings.HasPrefix(className, `std::`) {
|
||||
return false // Scintilla bindings find some of these
|
||||
}
|
||||
|
||||
switch className {
|
||||
case
|
||||
"QTextStreamManipulator", // Only seems to contain garbage methods
|
||||
@ -135,7 +140,6 @@ func AllowMethod(mm CppMethod) error {
|
||||
}
|
||||
|
||||
return nil // OK, allow
|
||||
|
||||
}
|
||||
|
||||
func CheckComplexity(p CppParameter, isReturnType bool) error {
|
||||
@ -187,12 +191,16 @@ func CheckComplexity(p CppParameter, isReturnType bool) error {
|
||||
if strings.HasPrefix(p.ParameterType, "QUrlTwoFlags<") {
|
||||
return ErrTooComplex // e.g. qurl.h
|
||||
}
|
||||
if strings.HasPrefix(p.ParameterType, "FillResult<") {
|
||||
return ErrTooComplex // Scintilla
|
||||
}
|
||||
if strings.HasPrefix(p.ParameterType, "std::") {
|
||||
// std::initializer e.g. qcborarray.h
|
||||
// std::string QByteArray->toStdString(). There are QString overloads already
|
||||
// std::nullptr_t Qcborstreamwriter
|
||||
// std::chrono::nanoseconds QDeadlineTimer_RemainingTimeAsDuration
|
||||
// std::seed_seq QRandom
|
||||
// std::exception Scintilla
|
||||
return ErrTooComplex
|
||||
}
|
||||
if strings.Contains(p.ParameterType, `Iterator::value_type`) {
|
||||
@ -264,6 +272,7 @@ func CheckComplexity(p CppParameter, isReturnType bool) error {
|
||||
"QXmlStreamNamespaceDeclarations", // e.g. qxmlstream.h. As above
|
||||
"QXmlStreamNotationDeclarations", // e.g. qxmlstream.h. As above
|
||||
"QXmlStreamAttributes", // e.g. qxmlstream.h
|
||||
"LineLayout::ValidLevel", // ..
|
||||
"QtMsgType", // e.g. qdebug.h TODO Defined in qlogging.h, but omitted because it's predefined in qglobal.h, and our clangexec is too agressive
|
||||
"QTextStreamFunction", // e.g. qdebug.h
|
||||
"QFactoryInterface", // qfactoryinterface.h
|
||||
|
@ -110,6 +110,10 @@ func (p CppParameter) QtClassType() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if p.ParameterType == "Scintilla::Internal::Point" {
|
||||
return true
|
||||
}
|
||||
|
||||
if p.ParameterType == "QString" || p.ParameterType == "QByteArray" {
|
||||
return true
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ func importPathForQtPackage(packageName string) string {
|
||||
return BaseModule + "/qt"
|
||||
case "qscintilla":
|
||||
return BaseModule + "/qt-restricted-extras/" + packageName
|
||||
case "scintillaedit":
|
||||
return BaseModule + "/qt-extras/" + packageName
|
||||
default:
|
||||
return BaseModule + "/qt/" + packageName
|
||||
}
|
||||
@ -102,6 +104,7 @@ func pkgConfigCflags(packageName string) string {
|
||||
func main() {
|
||||
clang := flag.String("clang", "clang", "Custom path to clang")
|
||||
outDir := flag.String("outdir", "../../", "Output directory for generated gen_** files")
|
||||
extraLibsDir := flag.String("extralibs", "/usr/local/src/", "Base directory to find extra library checkouts")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
@ -140,6 +143,18 @@ func main() {
|
||||
filepath.Join(*outDir, "qt-restricted-extras/qscintilla"),
|
||||
ClangMatchSameHeaderDefinitionOnly,
|
||||
)
|
||||
|
||||
// Depends on QtCore/Gui/Widgets
|
||||
generate(
|
||||
"scintillaedit",
|
||||
[]string{
|
||||
filepath.Join(*extraLibsDir, "scintilla/qt/ScintillaEdit/ScintillaEdit.h"),
|
||||
},
|
||||
*clang,
|
||||
strings.Fields("--std=c++1z "+pkgConfigCflags("ScintillaEdit")),
|
||||
filepath.Join(*outDir, "qt-extras/scintillaedit"),
|
||||
(&clangMatchUnderPath{filepath.Join(*extraLibsDir, "scintilla")}).Match,
|
||||
)
|
||||
}
|
||||
|
||||
func generate(packageName string, srcDirs []string, clangBin string, cflags []string, outDir string, matcher ClangMatcher) {
|
||||
|
@ -11,6 +11,23 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||
pkg-config \
|
||||
build-essential && \
|
||||
apt-get clean
|
||||
|
||||
RUN mkdir -p /usr/local/src/scintilla && \
|
||||
git clone 'https://github.com/mirror/scintilla.git' /usr/local/src/scintilla && \
|
||||
git -C /usr/local/src/scintilla checkout rel-5-5-2
|
||||
|
||||
RUN \
|
||||
cd /usr/local/src/scintilla/qt/ScintillaEditBase && \
|
||||
qmake && \
|
||||
make && \
|
||||
cd /usr/local/src/scintilla/qt/ScintillaEdit && \
|
||||
python3 WidgetGen.py && \
|
||||
qmake && \
|
||||
make
|
||||
|
||||
RUN mkdir -p /usr/local/lib/pkgconfig
|
||||
|
||||
COPY pkg-config/QScintilla.pc.example /usr/local/lib/pkgconfig/QScintilla.pc
|
||||
COPY pkg-config/ScintillaEdit.pc.example /usr/local/lib/pkgconfig/ScintillaEdit.pc
|
||||
|
||||
ENV GOFLAGS=-buildvcs=false
|
||||
|
9
pkg-config/ScintillaEdit.pc.example
Normal file
9
pkg-config/ScintillaEdit.pc.example
Normal file
@ -0,0 +1,9 @@
|
||||
srcdir=/usr/local/src/scintilla/
|
||||
|
||||
Name: ScintillaEdit
|
||||
Description: Scintilla's own upstream Qt port
|
||||
URL: https://www.scintilla.org/
|
||||
Version: 5.5.2
|
||||
Requires: Qt5Widgets
|
||||
Libs: -L${srcdir}/bin -lScintillaEdit
|
||||
Cflags: -include stdint.h -I${srcdir}/qt/ScintillaEdit -I${srcdir}/qt/ScintillaEditBase -I${srcdir}/include -I${srcdir}/src
|
8
qt-extras/scintillaedit/cflags.go
Normal file
8
qt-extras/scintillaedit/cflags.go
Normal file
@ -0,0 +1,8 @@
|
||||
package scintillaedit
|
||||
|
||||
/*
|
||||
#cgo CFLAGS:
|
||||
#cgo CXXFLAGS: --std=c++1z
|
||||
#cgo pkg-config: ScintillaEdit
|
||||
*/
|
||||
import "C"
|
Loading…
Reference in New Issue
Block a user