llcppsymg:gendylib path test

llcppsymg:headerpath test
This commit is contained in:
luoliwoshang
2024-09-25 11:56:43 +08:00
parent a83f7a822e
commit ffa823f748
7 changed files with 294 additions and 53 deletions

View File

@@ -0,0 +1,23 @@
package header
import (
"fmt"
"path/filepath"
"strings"
)
func GenHeaderFilePath(cflags string, files []string) ([]string, error) {
fmt.Printf("get filepath from config cflags%s & include:%v\n", cflags, files)
prefixPath := strings.TrimPrefix(cflags, "-I")
var includePaths []string
for _, file := range files {
if file == "" {
continue
}
includePaths = append(includePaths, filepath.Join(prefixPath, "/"+file))
}
if len(includePaths) == 0 {
return nil, fmt.Errorf("no valid header files")
}
return includePaths, nil
}