-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathstint.nimble
More file actions
68 lines (52 loc) · 2.19 KB
/
stint.nimble
File metadata and controls
68 lines (52 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
mode = ScriptMode.Verbose
packageName = "stint"
version = "0.8.2"
author = "Status Research & Development GmbH"
description = "Efficient stack-based multiprecision int in Nim"
license = "Apache License 2.0 or MIT"
skipDirs = @["tests", "benchmarks"]
### Dependencies
# TODO test only requirements don't work: https://github.com/nim-lang/nimble/issues/482
requires "nim >= 1.6.12",
"stew >= 0.2.0",
"intops >= 1.0.7",
"unittest2 >= 0.2.3"
let nimc = getEnv("NIMC", "nim") # Which nim compiler to use
let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js)
let flags = getEnv("NIMFLAGS", "") # Extra flags for the compiler
let verbose = getEnv("V", "") notin ["", "0"]
from os import quoteShell
let cfg =
" --styleCheck:usages --styleCheck:error" &
(if verbose: "" else: " --verbosity:0 --hints:off") &
" --skipParentCfg --skipUserCfg --outdir:build " &
quoteShell("--nimcache:build/nimcache/$projectName")
proc build(args, path: string) =
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
proc run(args, path: string) =
build args & " -r", path
if (NimMajor, NimMinor) > (1, 6):
build args & " --mm:refc -r", path
proc test(path: string) =
for config in ["", "-d:stintNoIntrinsics"]:
for mode in ["-d:debug", "-d:release"]:
# Compile-time tests are done separately to speed up full testing
run(config & " " & mode & " -d:unittest2Static=false", path)
task test_internal, "Run tests for internal procs":
test "tests/internal"
task test_public_api, "Run all tests - prod implementation (StUint[64] = uint64":
test "tests/all_tests"
task test, "Run all tests":
test "tests/internal"
test "tests/all_tests"
# Run compile-time tests on both 32 and 64 bits
if lang == "c":
build "--cpu:amd64 -c -d:unittest2Static", "tests/all_tests"
build "--cpu:wasm32 -c -d:unittest2Static", "tests/all_tests"
task book, "Generate book":
exec "mdbook build book -d docs"
task apidocs, "Generate API docs":
exec "nimble doc --outdir:docs/apidocs --project --index:on --git.url:https://github.com/status-im/nim-stint stint.nim"
task docs, "Generate docs":
exec "nimble book"
exec "nimble apidocs"