mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-01-05 23:53:08 +00:00
get arch from uname -m if ARCH env var is not set
This commit is contained in:
parent
ac31e5adf2
commit
e67639ee08
12
sds.nimble
12
sds.nimble
@ -40,6 +40,12 @@ proc buildLibrary(
|
|||||||
" --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds --skipParentCfg:on " &
|
" --threads:on --app:lib --opt:size --noMain --mm:refc --header --nimMainPrefix:libsds --skipParentCfg:on " &
|
||||||
extra_params & " " & srcDir & name & ".nim"
|
extra_params & " " & srcDir & name & ".nim"
|
||||||
|
|
||||||
|
proc getArch(): string =
|
||||||
|
let arch = getEnv("ARCH")
|
||||||
|
if arch != "": return $arch
|
||||||
|
let (archFromUname, _) = gorgeEx("uname -m")
|
||||||
|
return $archFromUname
|
||||||
|
|
||||||
# Tasks
|
# Tasks
|
||||||
task test, "Run the test suite":
|
task test, "Run the test suite":
|
||||||
exec "nim c -r tests/test_bloom.nim"
|
exec "nim c -r tests/test_bloom.nim"
|
||||||
@ -65,7 +71,7 @@ task libsdsDynamicMac, "Generate bindings":
|
|||||||
let outLibNameAndExt = "libsds.dylib"
|
let outLibNameAndExt = "libsds.dylib"
|
||||||
let name = "libsds"
|
let name = "libsds"
|
||||||
|
|
||||||
let arch = getEnv("ARCH")
|
let arch = getArch()
|
||||||
let sdkPath = staticExec("xcrun --show-sdk-path").strip()
|
let sdkPath = staticExec("xcrun --show-sdk-path").strip()
|
||||||
let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
||||||
else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
|
else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
|
||||||
@ -94,7 +100,7 @@ task libsdsStaticMac, "Generate bindings":
|
|||||||
let outLibNameAndExt = "libsds.a"
|
let outLibNameAndExt = "libsds.a"
|
||||||
let name = "libsds"
|
let name = "libsds"
|
||||||
|
|
||||||
let arch = getEnv("ARCH")
|
let arch = getArch()
|
||||||
let sdkPath = staticExec("xcrun --show-sdk-path").strip()
|
let sdkPath = staticExec("xcrun --show-sdk-path").strip()
|
||||||
let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
||||||
else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
|
else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
|
||||||
@ -147,7 +153,7 @@ task libsdsIOS, "Build the mobile bindings for iOS":
|
|||||||
|
|
||||||
### Mobile Android
|
### Mobile Android
|
||||||
proc buildMobileAndroid(srcDir = ".", params = "") =
|
proc buildMobileAndroid(srcDir = ".", params = "") =
|
||||||
let cpu = getEnv("CPU")
|
let cpu = getArch()
|
||||||
|
|
||||||
let outDir = "build/"
|
let outDir = "build/"
|
||||||
if not dirExists outDir:
|
if not dirExists outDir:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user