diff --git a/nimterop/build/getheader.nim b/nimterop/build/getheader.nim index 85a0331..4549894 100644 --- a/nimterop/build/getheader.nim +++ b/nimterop/build/getheader.nim @@ -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: diff --git a/nimterop/build/shell.nim b/nimterop/build/shell.nim index f07f70c..f0af561 100644 --- a/nimterop/build/shell.nim +++ b/nimterop/build/shell.nim @@ -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" diff --git a/nimterop/toastlib/ast2.nim b/nimterop/toastlib/ast2.nim index 7f2b4ad..bea6ff6 100644 --- a/nimterop/toastlib/ast2.nim +++ b/nimterop/toastlib/ast2.nim @@ -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)