Multiple getHeader, linkLibs name fix

This commit is contained in:
Ganesh Viswanathan 2020-08-02 22:20:04 -05:00
commit 11814811e3
3 changed files with 16 additions and 9 deletions

View file

@ -366,6 +366,7 @@ macro getHeader*(
staticStr = name & "Static"
verStr = name & "SetVer"
getPath = name & "GetPath"
# Ident nodes of the -d:xxx to check in when statements
nameStd = newIdentNode(stdStr)
@ -375,6 +376,7 @@ macro getHeader*(
nameJBB = newIdentNode(jbbStr)
nameStatic = newIdentNode(staticStr)
nameGetPath = newIdentNode(getPath)
# Consts to generate
path = newIdentNode(name & "Path")
@ -421,7 +423,7 @@ macro getHeader*(
`nameStatic`* = when defined(`nameStatic`): true else: `staticVal` == 1
# Search for header in outdir (after retrieving code) depending on -d:xxx mode
proc getPath(header, giturl, dlurl, conanuri, conanFlags, jbburi, jbbFlags,
proc `nameGetPath`(header, giturl, dlurl, conanuri, conanFlags, jbburi, jbbFlags,
outdir, version: string, shared: bool): string =
when `nameGit`:
getGitPath(header, giturl, outdir, version)
@ -461,7 +463,7 @@ macro getHeader*(
when useStd:
stdPath
else:
getPath(`header`, `giturl`, `dlurl`, `conanuri`, `conanFlags`, `jbburi`, `jbbFlags`,
`nameGetPath`(`header`, `giturl`, `dlurl`, `conanuri`, `conanFlags`, `jbburi`, `jbbFlags`,
`outdir`, `version`, not `nameStatic`)
# Run preBuild hook before building library if not Std, Conan or JBB
@ -497,7 +499,7 @@ macro getHeader*(
if prePath.len != 0:
prePath
else:
getPath(`header`, `giturl`, `dlurl`, `conanuri`, `conanFlags`, `jbburi`, `jbbFlags`,
`nameGetPath`(`header`, `giturl`, `dlurl`, `conanuri`, `conanFlags`, `jbburi`, `jbbFlags`,
`outdir`, `version`, not `nameStatic`)
static:

View file

@ -481,14 +481,19 @@ proc linkLibs*(names: openArray[string], staticLink = true): string =
var
stat = if staticLink: "--static" else: ""
resSet: OrderedSet[string]
cmd = &"pkg-config --libs --silence-errors {stat}"
resSet.init()
for name in names:
let
cmd = &"pkg-config --libs --silence-errors {stat} lib{name}"
(libs, _) = execAction(cmd, die = false)
for lib in libs.split(" "):
resSet.incl lib
for n in ["lib" & name, name]:
# Try libname and name - e.g. MagickWand doesn't have lib
let
cmd = &"{cmd} {n}"
(libs, _) = execAction(cmd, die = false)
if libs.len != 0:
for lib in libs.split(" "):
resSet.incl lib
break
if staticLink:
resSet.incl "--static"

View file

@ -633,7 +633,7 @@ iterator newIdentDefs(gState: State, name: string, node: TSNode, offset: SomeInt
yield result
else:
for i in start+1 ..< node.len:
if node[i].getName() == "bitfield_clause":
if node[i].getName() in ["bitfield_clause", "comment"]:
continue
yield gState.newIdentDef(name, node, tname, tinfo, tident, start, i, offset, exported)