mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-01-02 14:13:07 +00:00
add windows support
This commit is contained in:
parent
1b005ee9ab
commit
a457909569
18
Makefile
18
Makefile
@ -1,4 +1,4 @@
|
||||
.PHONY: libsds
|
||||
.PHONY: libsds deps
|
||||
|
||||
export BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
||||
LINK_PCRE := 0
|
||||
@ -34,7 +34,7 @@ update: | update-common
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
deps: | sds.nims
|
||||
deps: | deps-common sds.nims
|
||||
|
||||
# must be included after the default target
|
||||
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
||||
@ -52,11 +52,21 @@ endif
|
||||
|
||||
STATIC ?= 0
|
||||
|
||||
libsds: deps
|
||||
detected_OS ?= Linux
|
||||
ifeq ($(OS),Windows_NT)
|
||||
detected_OS := Windows
|
||||
else
|
||||
detected_OS := $(shell uname -s)
|
||||
endif
|
||||
|
||||
libsds: | deps
|
||||
rm -f build/libsds*
|
||||
ifeq ($(STATIC), 1)
|
||||
ifeq ($(STATIC),1)
|
||||
echo -e $(BUILD_MSG) "build/$@.a" && \
|
||||
$(ENV_SCRIPT) nim libsdsStatic $(NIM_PARAMS) sds.nims
|
||||
else ifeq ($(detected_OS),Windows)
|
||||
echo -e $(BUILD_MSG) "build/$@.dll" && \
|
||||
$(ENV_SCRIPT) nim libsdsDynamic $(NIM_PARAMS) sds.nims
|
||||
else
|
||||
echo -e $(BUILD_MSG) "build/$@.so" && \
|
||||
$(ENV_SCRIPT) nim libsdsDynamic $(NIM_PARAMS) sds.nims
|
||||
|
||||
42
scripts/build_windows.sh
Normal file
42
scripts/build_windows.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "- - - - - - - - - - Windows Setup Script - - - - - - - - - -"
|
||||
|
||||
success_count=0
|
||||
failure_count=0
|
||||
|
||||
# Function to execute a command and check its status
|
||||
execute_command() {
|
||||
echo "Executing: $1"
|
||||
if eval "$1"; then
|
||||
echo -e "✓ Command succeeded \n"
|
||||
((success_count++))
|
||||
else
|
||||
echo -e "✗ Command failed \n"
|
||||
((failure_count++))
|
||||
fi
|
||||
}
|
||||
|
||||
echo "1. -.-.-.-- Set PATH -.-.-.-"
|
||||
export PATH="/c/msys64/usr/bin:/c/msys64/mingw64/bin:/c/msys64/usr/lib:/c/msys64/mingw64/lib:$PATH"
|
||||
|
||||
echo "2. -.-.-.- Verify dependencies -.-.-.-"
|
||||
execute_command "which gcc g++ make cmake cargo upx rustc python"
|
||||
|
||||
echo "3. -.-.-.- Updating submodules -.-.-.-"
|
||||
execute_command "git submodule update --init --recursive"
|
||||
|
||||
echo "4. -.-.-.- Creating tmp directory -.-.-.-"
|
||||
execute_command "mkdir -p tmp"
|
||||
|
||||
echo "5. -.-.-.- Building Nim -.-.-.-"
|
||||
cd vendor/nimbus-build-system/vendor/Nim
|
||||
execute_command "./build_all.bat"
|
||||
cd ../../../..
|
||||
|
||||
echo "6. -.-.-.- Building libsds -.-.-.- "
|
||||
execute_command "make libsds STATIC=0 V=3 -j8"
|
||||
|
||||
echo "Windows setup completed successfully!"
|
||||
echo "✓ Successful commands: $success_count"
|
||||
echo "✗ Failed commands: $failure_count"
|
||||
20
sds.nimble
20
sds.nimble
@ -23,9 +23,15 @@ proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "static") =
|
||||
".a --threads:on --app:staticlib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds --skipParentCfg:on " &
|
||||
extra_params & " " & srcDir & name & ".nim"
|
||||
else:
|
||||
exec "nim c" & " --out:build/" & name &
|
||||
".so --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds --skipParentCfg:on " &
|
||||
extra_params & " " & srcDir & name & ".nim"
|
||||
let lib_name = (when defined(windows): toDll(name) else: name & ".so")
|
||||
when defined(windows):
|
||||
exec "nim c" & " --out:build/" & lib_name &
|
||||
" --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds --skipParentCfg:off " &
|
||||
extra_params & " " & srcDir & name & ".nim"
|
||||
else:
|
||||
exec "nim c" & " --out:build/" & lib_name &
|
||||
" --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds --skipParentCfg:on " &
|
||||
extra_params & " " & srcDir & name & ".nim"
|
||||
|
||||
# Tasks
|
||||
task test, "Run the test suite":
|
||||
@ -36,13 +42,7 @@ task libsdsDynamic, "Generate bindings":
|
||||
let name = "libsds"
|
||||
buildLibrary name,
|
||||
"library/",
|
||||
"""-d:chronicles_line_numbers \
|
||||
-d:chronicles_runtime_filtering=on \
|
||||
-d:chronicles_sinks="textlines,json" \
|
||||
-d:chronicles_default_output_device=Dynamic \
|
||||
--warning:Deprecated:off \
|
||||
--warning:UnusedImport:on \
|
||||
-d:chronicles_log_level=TRACE """,
|
||||
"""-d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE """,
|
||||
"dynamic"
|
||||
|
||||
### Mobile Android
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user