logos-chat/logos_chat.nimble

82 lines
2.6 KiB
Plaintext
Raw Normal View History

2025-07-04 22:17:31 -07:00
# Package
2025-09-26 15:45:03 +02:00
version = "0.1.0"
author = "Logos.co"
description = "LogosChat is a decentralized permissionless messaging protocol."
2025-09-26 15:45:03 +02:00
license = "MIT"
srcDir = "src"
bin = @["logos_chat"]
2025-07-22 06:40:08 -07:00
2025-07-04 22:17:31 -07:00
# Dependencies
2025-09-26 17:04:32 +02:00
requires "nim >= 2.2.4",
"protobuf_serialization",
"secp256k1",
"blake2",
"chronicles",
"libp2p",
"confutils",
"eth",
"regex",
"web3",
"libchat",
"waku",
"ffi"
2025-09-26 15:45:03 +02:00
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
var extra_params = params
for i in 2 ..< paramCount():
extra_params &= " " & paramStr(i)
exec "nim " & lang & " --out:build/" & name & " --mm:refc " & extra_params & " " &
srcDir & name & ".nim"
proc buildLibrary(name: string, srcDir = "library/", params = "", lang = "c") =
## Build a shared library (.so on Linux, .dylib on macOS, .dll on Windows)
if not dirExists "build":
mkDir "build"
# Determine library extension based on OS
let libExt = when defined(macosx): "dylib"
elif defined(windows): "dll"
else: "so"
var extra_params = params
for i in 2 ..< paramCount():
extra_params &= " " & paramStr(i)
exec "nim " & lang & " --app:lib --out:build/lib" & name & "." & libExt &
" --mm:refc --nimMainPrefix:lib" & name & " " & extra_params & " " &
srcDir & "lib" & name & ".nim"
proc test(name: string, params = "-d:chronicles_log_level=DEBUG", lang = "c") =
buildBinary name, "tests/", params
exec "build/" & name
task tests, "Build & run tests":
test "all_tests", "-d:chronicles_log_level=ERROR -d:chronosStrictException"
test "smoke_test", "-d:chronicles_log_level=ERROR"
2025-09-26 15:45:03 +02:00
task waku_example, "Build Waku based simple example":
let name = "waku_example"
buildBinary name, "examples/", " -d:chronicles_log_level='TRACE' "
2025-09-26 11:22:45 -07:00
2025-09-26 13:03:36 -07:00
task tui, "Build Waku based simple example":
let name = "tui"
2025-09-26 18:40:57 -07:00
buildBinary name, "examples/", " -d:chronicles_enabled=on -d:chronicles_log_level='INFO' -d:chronicles_sinks=textlines[file]"
task bot_echo, "Build the EchoBot example":
let name = "bot_echo"
buildBinary name, "examples/", "-d:chronicles_log_level='INFO' -d:chronicles_disabled_topics='waku node' "
2025-10-09 18:46:36 -07:00
task pingpong, "Build the Pingpong example":
let name = "pingpong"
2026-02-17 16:37:18 -08:00
buildBinary name, "examples/", "-d:chronicles_log_level='INFO' -d:chronicles_disabled_topics='waku node' "
task liblogoschat, "Build the Logos-Chat shared library (C bindings)":
buildLibrary "logoschat", "library/",
"-d:chronicles_log_level='INFO' -d:chronicles_enabled=on --path:src --path:vendor/nim-ffi"