nimterop/tests/tsoloud.nim
Timothee Cour 839c4007f6 fix #62 (toast now addressed relatively); macros=>procs + other fixes (#70)
* fixes https://github.com/genotrance/nimterop/issues/62
*  toast is now automatically built on demand, and doesn't depend on PATH
- [ ] todo: need to track its deps properly to trigger rebuilding it; using same algo as shown here https://github.com/genotrance/nimterop/issues/69 but using nim deps instead of c deps
* many other fixes
  * trying to follow https://github.com/timotheecour/vitanim/wiki/Nim-best-practices
2019-01-29 23:06:26 -06:00

55 lines
1.1 KiB
Nim

import os, nimterop/[cimport, git, paths]
const
baseDir = nimteropBuildDir()/"soloud"
incl = baseDir/"include"
src = baseDir/"src"
static:
gitPull("https://github.com/jarikomppa/soloud", baseDir, "include/*\nsrc/*\n")
cDebug()
cDisableCaching()
cOverride:
type
Soloud* = pointer
AlignedFloatBuffer* = pointer
proc Soloud_destroy*(aSoloud: ptr Soloud) {.importc: "Soloud_destroy", header: cSearchPath(incl/"soloud_c.h").}
cSkipSymbol("WavStream_stop", "WavStream_setFilter")
cIncludeDir(incl)
when defined(Linux):
{.passL: "-lpthread".}
cDefine("WITH_OSS")
cCompile(src/"backend/oss/*.cpp")
when defined(Windows):
{.passC: "-msse".}
{.passL: "-lwinmm".}
cDefine("WITH_WINMM")
cCompile(src/"backend/winmm/*.cpp")
cCompile(src/"c_api/soloud_c.cpp")
cCompile(src/"core/*.cpp")
cCompile(src/"audiosource", "cpp")
cCompile(src/"audiosource", "c")
cCompile(src/"filter/*.cpp")
cImport(incl/"soloud_c.h")
var
s = Soloud_create()
echo s.Soloud_init()
s.Soloud_destroy()
when declared(WavStream_stop):
assert "WavStream_stop() not skipped"
when declared(WavStream_setFilter):
assert "WavStream_setFilter not skipped"