Add tests for conan, recurse implies preprocess

This commit is contained in:
Ganesh Viswanathan 2020-06-14 15:16:21 -05:00
commit c63d82bf77
5 changed files with 77 additions and 10 deletions

46
tests/libssh2.nim Normal file
View file

@ -0,0 +1,46 @@
import nimterop/[build, cimport]
const
outdir = getProjectCacheDir("libssh2")
getHeader(
header = "libssh2.h",
conanuri = "libssh2/$1",
outdir = outdir
)
cOverride:
type
stat = object
stat64 = object
SOCKET = object
when not libssh2Static:
cImport(libssh2Path, recurse = true, dynlib = "libssh2LPath", flags = "-f:ast2 -c -E_ -F_")
when not defined(Windows):
proc zlibVersion(): cstring {.importc, dynlib: libssh2LPath.}
else:
cImport(libssh2Path, recurse = true, flags = "-f:ast2 -c -E_ -F_")
when not defined(Windows):
proc zlibVersion(): cstring {.importc.}
{.passL: "-lpthread".}
assert libssh2_init(0) == 0
let
session = libssh2_session_init_ex(nil, nil, nil, nil)
if session == nil:
quit(1)
libssh2_session_set_blocking(session, 0.cint)
echo "zlib version = " & (block:
when not defined(Windows):
$zlibVersion()
else:
""
)