2018-04-25 10:52:00 +00:00
|
|
|
packageName = "stint"
|
2022-01-31 22:30:45 +00:00
|
|
|
version = "2.0.0"
|
2018-02-15 12:11:01 +00:00
|
|
|
author = "Status Research & Development GmbH"
|
2018-04-25 10:52:00 +00:00
|
|
|
description = "Efficient stack-based multiprecision int in Nim"
|
2018-03-02 10:48:08 +00:00
|
|
|
license = "Apache License 2.0 or MIT"
|
2018-05-08 13:51:55 +00:00
|
|
|
skipDirs = @["tests", "benchmarks"]
|
2018-02-15 12:11:01 +00:00
|
|
|
### Dependencies
|
|
|
|
|
2018-06-10 11:11:24 +00:00
|
|
|
# TODO test only requirements don't work: https://github.com/nim-lang/nimble/issues/482
|
2023-06-09 08:46:21 +00:00
|
|
|
requires "nim >= 1.6.12",
|
2019-07-07 09:50:53 +00:00
|
|
|
"stew"
|
2018-02-15 14:01:08 +00:00
|
|
|
|
2023-09-25 14:49:04 +00:00
|
|
|
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"]
|
2022-01-25 22:12:52 +00:00
|
|
|
|
2023-09-25 14:49:04 +00:00
|
|
|
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
|
2023-04-14 00:41:31 +00:00
|
|
|
if (NimMajor, NimMinor) > (1, 6):
|
2023-09-25 14:49:04 +00:00
|
|
|
build args & " --mm:refc -r", path
|
|
|
|
|
|
|
|
proc test(path: string) =
|
|
|
|
for config in ["", "-d:stintNoIntrinsics"]:
|
|
|
|
for mode in ["-d:debug", "-d:release"]:
|
|
|
|
run(config & " " & mode, path)
|
2018-04-24 17:07:22 +00:00
|
|
|
|
2022-01-25 22:12:52 +00:00
|
|
|
task test_internal, "Run tests for internal procs":
|
2023-09-25 14:49:04 +00:00
|
|
|
test "tests/internal"
|
2022-01-25 22:12:52 +00:00
|
|
|
|
|
|
|
task test_public_api, "Run all tests - prod implementation (StUint[64] = uint64":
|
2023-09-25 14:49:04 +00:00
|
|
|
test "tests/all_tests"
|
2022-01-12 02:20:04 +00:00
|
|
|
|
2022-01-31 22:30:45 +00:00
|
|
|
task test, "Run all tests":
|
2023-09-25 14:49:04 +00:00
|
|
|
test "tests/internal"
|
|
|
|
test "tests/all_tests"
|
|
|
|
|
|
|
|
# Smoke-test wasm32 compiles
|
|
|
|
build "--cpu:wasm32 -c", "tests/all_tests"
|