Add getheader test

This commit is contained in:
Ganesh Viswanathan 2019-08-23 16:16:00 -05:00
commit ba2bd6e40a
4 changed files with 99 additions and 12 deletions

41
tests/lzma.nim Normal file
View file

@ -0,0 +1,41 @@
import os, strutils
import nimterop/[build, cimport]
const
baseDir = currentSourcePath.parentDir()/"build/liblzma"
static:
cDebug()
getHeader(
"lzma.h",
giturl = "https://github.com/xz-mirror/xz",
dlurl = "https://github.com/xz-mirror/xz/archive/$1.zip",
outdir = baseDir,
conFlags = "--disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo"
)
cPlugin:
import strutils
proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
sym.name = sym.name.strip(chars = {'_'})
cOverride:
type
lzma_internal = object
lzma_index = object
lzma_index_hash = object
lzma_options_lzma = object
lzma_stream_flags = object
lzma_block = object
lzma_index_iter = object
when not defined(lzmaStatic):
cImport(lzmaPath, recurse = true, dynlib = "lzmaLPath")
else:
cImport(lzmaPath, recurse = true)
echo "liblzma version = " & $lzma_version_string()