ast2 dynlib fix, add 1.2.0 testing

This commit is contained in:
Ganesh Viswanathan 2020-04-06 12:44:07 -05:00
commit e1c8ef2775
5 changed files with 15 additions and 3 deletions

View file

@ -13,6 +13,7 @@ language: c
env:
- BRANCH=0.20.2
- BRANCH=1.0.6
- BRANCH=1.2.0
- BRANCH=devel
cache:

View file

@ -49,8 +49,7 @@ task test, "Test":
execCmd "./nimterop/toast -pnk -E=_ -f:ast2 tests/include/toast.h"
execTest "tests/tpcre.nim"
#execTest "tests/tpcre.nim", "-d:FLAGS=\"-f:ast2\""
#execTest "tests/tpcre.nim", "-d:FLAGS=\"-f:ast2 -H\""
execTest "tests/tpcre.nim", "-d:FLAGS=\"-f:ast2\""
# Platform specific tests
when defined(Windows):

View file

@ -386,6 +386,9 @@ proc newXIdent(nimState: NimState, node: TSNode, kind = nskType, fname = "", pra
if nimState.includeHeader():
# Add header
nimState.addPragma(node, prident[1], nimState.impShort & "H")
elif nimState.gState.dynlib.nBl:
# Add dynlib
nimState.addPragma(node, prident[1], "dynlib", nimState.getIdent(nimState.gState.dynlib))
else:
# Only need impShort since no name change
prident = nimState.newPragmaExpr(node, ident, nimState.impShort)
@ -1457,6 +1460,10 @@ proc addProc(nimState: NimState, node, rnode: TSNode) =
# {.convention.}
nimState.addPragma(node, prident, nimState.gState.convention)
if nimState.gState.dynlib.nBl:
# {.dynlib.} for DLLs
nimState.addPragma(node, prident, "dynlib", nimState.getIdent(nimState.gState.dynlib))
procDef.add prident
procDef.add newNode(nkEmpty)
procDef.add newNode(nkEmpty)

View file

@ -100,6 +100,10 @@ proc main(
symOverride: symOverride
)
# Fail if both includeHeader and dynlib
doAssert not (includeHeader == true and dynlib.nBl),
"`includeHeader` and `dynlib` cannot be used simultaneously"
# Split some arguments with ,
gState.symOverride = gState.symOverride.getSplitComma()
gState.prefix = gState.prefix.getSplitComma()

View file

@ -43,7 +43,8 @@ cCompile(src/"audiosource", "cpp", exclude="ay/")
cCompile(src/"audiosource", "c")
cCompile(src/"filter/*.cpp")
cImport(incl/"soloud_c.h")
const FLAGS {.strdefine.} = ""
cImport(incl/"soloud_c.h", flags = FLAGS)
var
s = Soloud_create()