2026-05-11 23:28:17 +02:00
|
|
|
version = "0.1.0"
|
2026-05-16 01:08:42 +02:00
|
|
|
packageName = "timer"
|
2026-05-11 23:28:17 +02:00
|
|
|
author = "Institute of Free Technology"
|
|
|
|
|
description = "Example Nim timer library using nim-ffi"
|
|
|
|
|
license = "MIT or Apache License 2.0"
|
|
|
|
|
|
2026-06-26 10:54:21 -03:00
|
|
|
requires "nim >= 2.2.6"
|
2026-05-11 23:28:17 +02:00
|
|
|
requires "chronos"
|
|
|
|
|
requires "chronicles"
|
|
|
|
|
requires "taskpools"
|
2026-05-21 16:33:38 +02:00
|
|
|
requires "https://github.com/logos-messaging/nim-ffi >= 0.2.0"
|
2026-05-11 23:28:17 +02:00
|
|
|
|
|
|
|
|
const nimFlags = "--mm:orc -d:chronicles_log_level=WARN"
|
|
|
|
|
|
2026-07-10 17:13:06 -03:00
|
|
|
proc genBindingsCmd(langs: string): string =
|
|
|
|
|
## One `nim c` that emits `langs` (comma-separated) from timer.nim, each into
|
|
|
|
|
## `<lang>_bindings/`. `--compileOnly` is enough — the files are written during
|
|
|
|
|
## macro expansion, nothing is linked.
|
|
|
|
|
"nim c " & nimFlags & " -d:ffiGenBindings -d:targetLang=" & langs &
|
|
|
|
|
" --compileOnly timer.nim"
|
|
|
|
|
|
2026-05-16 01:08:42 +02:00
|
|
|
task build, "Compile the timer library":
|
2026-06-10 16:30:30 -03:00
|
|
|
exec "nim c " & nimFlags & " --app:lib --noMain --nimMainPrefix:libmy_timer timer.nim"
|
2026-05-11 23:28:17 +02:00
|
|
|
|
2026-07-10 17:13:06 -03:00
|
|
|
task genbindings, "Generate Rust, C++ and C bindings for the timer example":
|
|
|
|
|
exec genBindingsCmd("rust,cpp,c")
|
|
|
|
|
|
2026-05-16 01:08:42 +02:00
|
|
|
task genbindings_rust, "Generate Rust bindings for the timer example":
|
2026-07-10 17:13:06 -03:00
|
|
|
exec genBindingsCmd("rust")
|
2026-05-11 23:28:17 +02:00
|
|
|
|
2026-05-16 01:08:42 +02:00
|
|
|
task genbindings_cpp, "Generate C++ bindings for the timer example":
|
2026-07-10 17:13:06 -03:00
|
|
|
exec genBindingsCmd("cpp")
|
2026-07-01 12:00:47 -03:00
|
|
|
|
|
|
|
|
task genbindings_c, "Generate C bindings for the timer example":
|
2026-07-10 17:13:06 -03:00
|
|
|
exec genBindingsCmd("c")
|