mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
qt/cbor: split cbor into separate package
This commit is contained in:
parent
b4b6204832
commit
9e33eb65b6
@ -58,7 +58,7 @@ func InsertTypedefs(qt6 bool) {
|
||||
|
||||
}
|
||||
|
||||
func AllowHeader(fullpath string) bool {
|
||||
func Widgets_AllowHeader(fullpath string) bool {
|
||||
fname := filepath.Base(fullpath)
|
||||
|
||||
if strings.HasSuffix(fname, `_impl.h`) {
|
||||
|
@ -2,10 +2,13 @@ package main
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
|
||||
AllowAllHeaders := func(string) bool { return true }
|
||||
|
||||
flushKnownTypes()
|
||||
InsertTypedefs(false)
|
||||
|
||||
@ -16,17 +19,47 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
"/usr/include/x86_64-linux-gnu/qt5/QtGui",
|
||||
"/usr/include/x86_64-linux-gnu/qt5/QtWidgets",
|
||||
},
|
||||
func(fullpath string) bool {
|
||||
// Block cbor and generate it separately
|
||||
fname := filepath.Base(fullpath)
|
||||
if strings.HasPrefix(fname, "qcbor") {
|
||||
return false
|
||||
}
|
||||
|
||||
return Widgets_AllowHeader(fullpath)
|
||||
},
|
||||
clangBin,
|
||||
pkgConfigCflags("Qt5Widgets"),
|
||||
outDir,
|
||||
ClangMatchSameHeaderDefinitionOnly,
|
||||
)
|
||||
|
||||
generate(
|
||||
"qt/cbor",
|
||||
[]string{
|
||||
"/usr/include/x86_64-linux-gnu/qt5/QtCore",
|
||||
},
|
||||
func(fullpath string) bool {
|
||||
// Only include the same json, xml, cbor files excluded above
|
||||
fname := filepath.Base(fullpath)
|
||||
if strings.HasPrefix(fname, "qcbor") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
clangBin,
|
||||
pkgConfigCflags("Qt5Core"),
|
||||
outDir,
|
||||
ClangMatchSameHeaderDefinitionOnly,
|
||||
)
|
||||
|
||||
generate(
|
||||
"qt/printsupport",
|
||||
[]string{
|
||||
"/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport",
|
||||
},
|
||||
AllowAllHeaders,
|
||||
clangBin,
|
||||
pkgConfigCflags("Qt5PrintSupport"),
|
||||
outDir,
|
||||
@ -39,6 +72,7 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
[]string{
|
||||
"/usr/include/x86_64-linux-gnu/qt5/Qsci",
|
||||
},
|
||||
AllowAllHeaders,
|
||||
clangBin,
|
||||
pkgConfigCflags("Qt5PrintSupport"),
|
||||
outDir,
|
||||
@ -51,6 +85,7 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
[]string{
|
||||
filepath.Join(extraLibsDir, "scintilla/qt/ScintillaEdit/ScintillaEdit.h"),
|
||||
},
|
||||
AllowAllHeaders,
|
||||
clangBin,
|
||||
"--std=c++1z "+pkgConfigCflags("ScintillaEdit"),
|
||||
outDir,
|
||||
@ -70,18 +105,48 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
"/usr/include/x86_64-linux-gnu/qt6/QtGui",
|
||||
"/usr/include/x86_64-linux-gnu/qt6/QtWidgets",
|
||||
},
|
||||
func(fullpath string) bool {
|
||||
// Block cbor and generate it separately
|
||||
fname := filepath.Base(fullpath)
|
||||
if strings.HasPrefix(fname, "qcbor") {
|
||||
return false
|
||||
}
|
||||
|
||||
return Widgets_AllowHeader(fullpath)
|
||||
},
|
||||
clangBin,
|
||||
"--std=c++17 "+pkgConfigCflags("Qt6Widgets"),
|
||||
outDir,
|
||||
ClangMatchSameHeaderDefinitionOnly,
|
||||
)
|
||||
|
||||
generate(
|
||||
"qt6/cbor",
|
||||
[]string{
|
||||
"/usr/include/x86_64-linux-gnu/qt5/QtCore",
|
||||
},
|
||||
func(fullpath string) bool {
|
||||
// Only include the same json, xml, cbor files excluded above
|
||||
fname := filepath.Base(fullpath)
|
||||
if strings.HasPrefix(fname, "qcbor") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
clangBin,
|
||||
pkgConfigCflags("Qt6Core"),
|
||||
outDir,
|
||||
ClangMatchSameHeaderDefinitionOnly,
|
||||
)
|
||||
|
||||
// Qt 6 QtPrintSupport
|
||||
generate(
|
||||
"qt6/printsupport",
|
||||
[]string{
|
||||
"/usr/include/x86_64-linux-gnu/qt6/QtPrintSupport",
|
||||
},
|
||||
AllowAllHeaders,
|
||||
clangBin,
|
||||
"--std=c++17 "+pkgConfigCflags("Qt6PrintSupport"),
|
||||
outDir,
|
||||
|
@ -28,7 +28,7 @@ func importPathForQtPackage(packageName string) string {
|
||||
return BaseModule + "/" + packageName
|
||||
}
|
||||
|
||||
func findHeadersInDir(srcDir string) []string {
|
||||
func findHeadersInDir(srcDir string, allowHeader func(string) bool) []string {
|
||||
content, err := os.ReadDir(srcDir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -44,7 +44,7 @@ func findHeadersInDir(srcDir string) []string {
|
||||
continue
|
||||
}
|
||||
fullPath := filepath.Join(srcDir, includeFile.Name())
|
||||
if !AllowHeader(fullPath) {
|
||||
if !allowHeader(fullPath) {
|
||||
continue
|
||||
}
|
||||
ret = append(ret, fullPath)
|
||||
@ -93,14 +93,14 @@ func pkgConfigCflags(packageName string) string {
|
||||
return string(stdout)
|
||||
}
|
||||
|
||||
func generate(packageName string, srcDirs []string, clangBin, cflagsCombined, outDir string, matcher ClangMatcher) {
|
||||
func generate(packageName string, srcDirs []string, allowHeaderFn func(string) bool, clangBin, cflagsCombined, outDir string, matcher ClangMatcher) {
|
||||
|
||||
var includeFiles []string
|
||||
for _, srcDir := range srcDirs {
|
||||
if strings.HasSuffix(srcDir, `.h`) {
|
||||
includeFiles = append(includeFiles, srcDir) // single .h
|
||||
} else {
|
||||
includeFiles = append(includeFiles, findHeadersInDir(srcDir)...)
|
||||
includeFiles = append(includeFiles, findHeadersInDir(srcDir, allowHeaderFn)...)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user