genbindings/main: support parsing a single header instead of a directory

This commit is contained in:
mappu 2024-10-20 17:55:29 +13:00
parent 5afa94f2cc
commit 20f6d7878b

View File

@ -130,7 +130,11 @@ func generate(packageName string, srcDirs []string, clangBin string, cflags []st
var includeFiles []string
for _, srcDir := range srcDirs {
includeFiles = append(includeFiles, findHeadersInDir(srcDir)...)
if strings.HasSuffix(srcDir, `.h`) {
includeFiles = append(includeFiles, srcDir) // single .h
} else {
includeFiles = append(includeFiles, findHeadersInDir(srcDir)...)
}
}
log.Printf("Found %d header files to process.", len(includeFiles))