* 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
This commit is contained in:
parent
70deda95b7
commit
839c4007f6
15 changed files with 173 additions and 108 deletions
|
|
@ -5,13 +5,17 @@ author = "genotrance"
|
|||
description = "C/C++ interop for Nim"
|
||||
license = "MIT"
|
||||
|
||||
bin = @["toast"]
|
||||
# this gives Warning: Binary 'nimterop/toast' was already installed from source directory
|
||||
# when running `nimble install --verbose -y`
|
||||
bin = @["nimterop/toast"]
|
||||
installDirs = @["nimterop"]
|
||||
installFiles = @["config.nims"]
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires "nim >= 0.19.2", "regex >= 0.10.0", "cligen >= 0.9.17"
|
||||
|
||||
import strformat
|
||||
|
||||
proc execCmd(cmd: string) =
|
||||
echo "execCmd:" & cmd
|
||||
exec cmd
|
||||
|
|
@ -20,26 +24,34 @@ proc tsoloud() =
|
|||
execCmd "nim c -r tests/tsoloud.nim"
|
||||
execCmd "nim cpp -r tests/tsoloud.nim"
|
||||
|
||||
proc testall() =
|
||||
proc buildToast(options: string) =
|
||||
execCmd(&"nim c {options} nimterop/toast.nim")
|
||||
|
||||
task rebuildToast, "rebuild toast":
|
||||
# If need to manually rebuild (automatically built on 1st need)
|
||||
buildToast("-d:release")
|
||||
|
||||
proc testAll() =
|
||||
execCmd "nim c -r tests/tnimterop_c.nim"
|
||||
execCmd "nim cpp -r tests/tnimterop_c.nim"
|
||||
execCmd "nim cpp -r tests/tnimterop_cpp.nim"
|
||||
when defined(windows):
|
||||
|
||||
## platform specific tests
|
||||
when defined(Windows):
|
||||
execCmd "nim c -r tests/tmath.nim"
|
||||
execCmd "nim cpp -r tests/tmath.nim"
|
||||
when not defined(OSX):
|
||||
when defined(Windows):
|
||||
tsoloud()
|
||||
else:
|
||||
if not existsEnv("TRAVIS"):
|
||||
tsoloud()
|
||||
tsoloud()
|
||||
elif defined(osx):
|
||||
discard
|
||||
elif existsEnv("TRAVIS"):
|
||||
discard
|
||||
else:
|
||||
tsoloud()
|
||||
|
||||
task test, "Test":
|
||||
execCmd "nim c toast"
|
||||
testAll()
|
||||
|
||||
execCmd "nim c -d:release toast"
|
||||
testAll()
|
||||
for options in ["", "-d:release"]:
|
||||
buildToast(options)
|
||||
testAll()
|
||||
|
||||
task docs, "Generate docs":
|
||||
# Uses: pip install ghp-import
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue