mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-05-17 15:49:27 +00:00
The whole point of a generic generator is decoupling — this couples every consumer of nim-ffi to one specific project's Nim build conventions. Plumb these through genBindings() parameters or a config block.
34 lines
1.4 KiB
Nim
34 lines
1.4 KiB
Nim
version = "0.1.0"
|
|
packageName = "nimtimer"
|
|
author = "Institute of Free Technology"
|
|
description = "Example Nim timer library using nim-ffi"
|
|
license = "MIT or Apache License 2.0"
|
|
|
|
requires "nim >= 2.2.4"
|
|
requires "chronos"
|
|
requires "chronicles"
|
|
requires "taskpools"
|
|
requires "https://github.com/logos-messaging/nim-ffi >= 0.1.3"
|
|
|
|
const nimFlags = "--mm:orc -d:chronicles_log_level=WARN"
|
|
# Flags baked into the generated build.rs / CMakeLists.txt -- see ffi.nimble.
|
|
const genBakedFlags = "--mm:orc -d:chronicles_log_level=WARN"
|
|
|
|
task build, "Compile the nimtimer library":
|
|
exec "nim c " & nimFlags &
|
|
" --app:lib --noMain --nimMainPrefix:libnimtimer nim_timer.nim"
|
|
|
|
task genbindings_rust, "Generate Rust bindings for the nimtimer example":
|
|
exec "nim c " & nimFlags & " --app:lib --noMain --nimMainPrefix:libnimtimer" &
|
|
" -d:ffiGenBindings -d:targetLang=rust" & " -d:ffiOutputDir=rust_bindings" &
|
|
" -d:ffiNimSrcRelPath=nim_timer.nim" &
|
|
" -d:ffiNimBuildFlags=\"" & genBakedFlags & "\"" &
|
|
" -o:/dev/null nim_timer.nim"
|
|
|
|
task genbindings_cpp, "Generate C++ bindings for the nimtimer example":
|
|
exec "nim c " & nimFlags & " --app:lib --noMain --nimMainPrefix:libnimtimer" &
|
|
" -d:ffiGenBindings -d:targetLang=cpp" & " -d:ffiOutputDir=cpp_bindings" &
|
|
" -d:ffiNimSrcRelPath=nim_timer.nim" &
|
|
" -d:ffiNimBuildFlags=\"" & genBakedFlags & "\"" &
|
|
" -o:/dev/null nim_timer.nim"
|