From 20f6d7878b6b8bf0ae2b1ad5450abed13b4c01c9 Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 20 Oct 2024 17:55:29 +1300 Subject: [PATCH] genbindings/main: support parsing a single header instead of a directory --- cmd/genbindings/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/genbindings/main.go b/cmd/genbindings/main.go index 80b4e223..f2abbd5c 100644 --- a/cmd/genbindings/main.go +++ b/cmd/genbindings/main.go @@ -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))