feat: improve jack library path detection

This commit is contained in:
Christopher Arndt 2022-10-09 09:13:05 +02:00
parent 967c4ad161
commit 34e6171e3f
1 changed files with 10 additions and 14 deletions

View File

@ -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: