From 34e6171e3f8dcf3dace4dc72a7658f5c7a2d9890 Mon Sep 17 00:00:00 2001 From: Christopher Arndt Date: Sun, 9 Oct 2022 09:13:05 +0200 Subject: [PATCH] feat: improve jack library path detection --- jacket.nim | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/jacket.nim b/jacket.nim index 159e5d1..2bdb028 100644 --- a/jacket.nim +++ b/jacket.nim @@ -1,27 +1,22 @@ # jacket.nim -# Possible names/install locations of libjack, according to +# Possible names/install locations of libjack, according to: # https://github.com/x42/weakjack/blob/master/weak_libjack.c#L108 -# -# MacOS: -# * /usr/local/lib/libjack.dylib -# * /opt/homebrew/lib/libjack.dylib -# * /opt/local/lib/libjack.dylib -# Win: -# * libjack64.dll -# * libjack.dll -# Unix: -# * libjack.so.0 proc getJackLibName: string = when system.hostOS == "windows": - result = "libjack.dll" + when sizeof(int) == 4: + result = "libjack.dll" + else: + result = "libjack64.dll" elif system.hostOS == "macosx": - result = "libjack.dylib" + result = "(|/usr/local/lib/|/opt/homebrew/lib/|/opt/local/lib/)libjack.dylib" else: result = "libjack.so.0" {.push dynlib: getJackLibName().} +# ------------------------------ Constants -------------------------------- + const JACK_MAX_FRAMES* = (4294967295'i64) JACK_LOAD_INIT_LIMIT* = 1024 @@ -43,7 +38,6 @@ type PortT = distinct object PortTPtr* = ptr PortT - type JackOptions* {.size: sizeof(cint) pure.} = enum NullOption = 0x00, @@ -455,6 +449,8 @@ proc setInfoFunction*(infoCallback: JackInfoCallback) {.importc: "jack_set_info_ {.pop.} +# --------------------------- Helper functions ---------------------------- + proc getJackStatusErrorString*(status: cint): string = # Get JACK error status as string. if status == Success.ord: