mirror of
https://github.com/logos-messaging/nim-chat-sdk.git
synced 2026-01-02 14:13:07 +00:00
fix_: pr comments
This commit is contained in:
parent
c3199624cf
commit
8d08ce34b9
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# Nim
|
||||
nimcache/
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Build artifacts
|
||||
*.o
|
||||
*.a
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
18
Makefile
18
Makefile
@ -20,35 +20,37 @@ help:
|
||||
@echo " help - Show this help message"
|
||||
|
||||
# Build Nim library
|
||||
build-nim: libchatsdk
|
||||
|
||||
libchatsdk:
|
||||
@echo "Building Nim library..."
|
||||
cd src && nim c --app:lib --opt:speed --mm:arc --out:../bindings/c-bindings/libchatsdk.so chat_sdk.nim
|
||||
cd chat_sdk && nim c --app:lib --opt:speed --mm:refc --out:../library/c-bindings/libchatsdk.so chat_sdk.nim
|
||||
|
||||
# Build C bindings
|
||||
build-c: build-nim
|
||||
build-c: libchatsdk
|
||||
@echo "C bindings ready (built with Nim)"
|
||||
|
||||
# Build Go bindings (just verify they compile)
|
||||
build-go: build-c
|
||||
@echo "Building Go bindings..."
|
||||
cd bindings/go-bindings && go build .
|
||||
cd library/go-bindings && go build .
|
||||
|
||||
# Run Go example
|
||||
run-go-example: build-go
|
||||
@echo "Running Go example..."
|
||||
cd examples/go-app && \
|
||||
LD_LIBRARY_PATH=../../bindings/c-bindings:$$LD_LIBRARY_PATH \
|
||||
LD_LIBRARY_PATH=../../library/c-bindings:$$LD_LIBRARY_PATH \
|
||||
go run main.go
|
||||
|
||||
# Clean all build artifacts
|
||||
clean:
|
||||
@echo "Cleaning build artifacts..."
|
||||
rm -f bindings/c-bindings/*.so bindings/c-bindings/*.a
|
||||
rm -rf src/nimcache bindings/c-bindings/nimcache
|
||||
cd bindings/go-bindings && go clean
|
||||
rm -f library/c-bindings/*.so library/c-bindings/*.a
|
||||
rm -rf chat_sdk/nimcache library/c-bindings/nimcache
|
||||
cd library/go-bindings && go clean
|
||||
cd examples/go-app && go clean
|
||||
|
||||
# Test the Nim library directly
|
||||
test-nim:
|
||||
@echo "Testing Nim library directly..."
|
||||
cd src && nim r chat_sdk.nim
|
||||
cd chat_sdk && nim r chat_sdk.nim
|
||||
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
module github.com/waku-org/nim-chat-sdk/bindings/go-bindings
|
||||
|
||||
go 1.24
|
||||
@ -12,7 +12,7 @@ srcDir = "src"
|
||||
requires "nim >= 2.0.0"
|
||||
|
||||
task buildSharedLib, "Build shared library for C bindings":
|
||||
exec "nim c --app:lib --out:../bindings/c-bindings/libchatsdk.so src/chat_sdk.nim"
|
||||
exec "nim c --app:lib --out:../library/c-bindings/libchatsdk.so chat_sdk/chat_sdk.nim"
|
||||
|
||||
task buildStaticLib, "Build static library for C bindings":
|
||||
exec "nim c --app:staticLib --out:../bindings/c-bindings/libchatsdk.a src/chat_sdk.nim"
|
||||
exec "nim c --app:staticLib --out:../library/c-bindings/libchatsdk.a chat_sdk/chat_sdk.nim"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module go-app
|
||||
|
||||
replace github.com/waku-org/nim-chat-sdk/bindings/go-bindings => ../../bindings/go-bindings
|
||||
replace github.com/waku-org/nim-chat-sdk/library/go-bindings => ../../library/go-bindings
|
||||
|
||||
require github.com/waku-org/nim-chat-sdk/bindings/go-bindings v0.0.0-00010101000000-000000000000
|
||||
require github.com/waku-org/nim-chat-sdk/library/go-bindings v0.0.0-00010101000000-000000000000
|
||||
|
||||
go 1.24
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
chatsdk "github.com/waku-org/nim-chat-sdk/bindings/go-bindings"
|
||||
chatsdk "github.com/waku-org/nim-chat-sdk/library/go-bindings"
|
||||
)
|
||||
|
||||
// SimpleStore implements the chatsdk.Store interface with in-memory storage
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -fPIC
|
||||
NIMFLAGS = --app:lib --threads:on --gc:orc
|
||||
NIMFLAGS = --app:lib
|
||||
|
||||
# Directories
|
||||
SRC_DIR = ../../src
|
||||
@ -20,10 +20,10 @@ shared: $(SHARED_LIB)
|
||||
static: $(STATIC_LIB)
|
||||
|
||||
$(SHARED_LIB): $(SRC_DIR)/chat_sdk.nim $(HEADER)
|
||||
cd $(SRC_DIR) && nim c $(NIMFLAGS) --out:../bindings/c-bindings/$(SHARED_LIB) chat_sdk.nim
|
||||
cd $(SRC_DIR) && nim c $(NIMFLAGS) --out:../library/c-bindings/$(SHARED_LIB) chat_sdk.nim
|
||||
|
||||
$(STATIC_LIB): $(SRC_DIR)/chat_sdk.nim $(HEADER)
|
||||
cd $(SRC_DIR) && nim c $(NIMFLAGS) --app:staticLib --out:../bindings/c-bindings/$(STATIC_LIB) chat_sdk.nim
|
||||
cd $(SRC_DIR) && nim c $(NIMFLAGS) --app:staticLib --out:../library/c-bindings/$(STATIC_LIB) chat_sdk.nim
|
||||
|
||||
clean:
|
||||
rm -f $(SHARED_LIB) $(STATIC_LIB) *.o *.so *.a
|
||||
3
library/go-bindings/go.mod
Normal file
3
library/go-bindings/go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module github.com/waku-org/nim-chat-sdk/library/go-bindings
|
||||
|
||||
go 1.24
|
||||
Loading…
x
Reference in New Issue
Block a user