chore(build): support build lua-tiktoken on Windows (#128)

Signed-off-by: Hanchin Hsieh <me@yuchanns.xyz>
This commit is contained in:
Hanchin Hsieh
2024-08-21 21:59:13 +08:00
committed by GitHub
parent 2e48d387a9
commit 83d067695e
3 changed files with 46 additions and 1 deletions

View File

@@ -7,6 +7,8 @@ H.get_os_name = function()
return "linux"
elseif os_name == "Darwin" then
return "macOS"
elseif os_name == "Windows_NT" then
return "windows"
else
error("Unsupported operating system: " .. os_name)
end
@@ -14,7 +16,7 @@ end
H.library_path = function()
local os_name = H.get_os_name()
local ext = os_name == "linux" and "so" or "dylib"
local ext = os_name == "linux" and "so" or (os_name == "macOS" and "dylib" or "dll")
local dirname = string.sub(debug.getinfo(1).source, 2, #"/tiktoken_lib.lua" * -1)
return dirname .. ("../build/?.%s"):format(ext)
end