Skip to content

Commit

Permalink
add curl configs
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing committed Sep 17, 2024
1 parent 6b231d7 commit 569aaa4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/l/llama.cpp/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package("llama.cpp")

add_versions("3775", "405bae9d550cb3fbf36d6583377b951a346b548f5850987238fe024a16f45cad")

add_configs("curl", {description = "llama: use libcurl to download model from an URL", default = false, type = "boolean"})
add_configs("openmp", {description = "ggml: use OpenMP", default = false, type = "boolean"})
add_configs("cuda", {description = "ggml: use CUDA", default = false, type = "boolean"})
add_configs("vulkan", {description = "ggml: use Vulkan", default = false, type = "boolean"})
Expand All @@ -31,13 +32,27 @@ package("llama.cpp")
assert(ndkver and tonumber(ndkver) > 22, "package(llama.cpp) require ndkver > 22")
assert(ndk_sdkver and tonumber(ndk_sdkver) >= 24, "package(llama.cpp) require ndk api >= 24")
end)

on_check("windows", function (package)
if package:is_arch("arm.*") then
local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
if vs_toolset then
local vs_toolset_ver = import("core.base.semver").new(vs_toolset)
local minor = vs_toolset_ver:minor()
assert(minor and minor >= 30, "package(llama.cpp/arm64) require vs_toolset >= 14.3")
end
end
end)
end

on_load(function (package)
if package:config("shared") then
package:add("defines", "GGML_SHARED", "LLAMA_SHARED")
end

if package:config("curl") then
package:add("deps", "libcurl")
end
if package:config("openmp") then
package:add("deps", "openmp")
end
Expand Down Expand Up @@ -76,6 +91,7 @@ package("llama.cpp")
table.insert(configs, "-DGGML_LTO=" .. (package:config("lto") and "ON" or "OFF"))
table.insert(configs, "-DGGML_SANITIZE_ADDRESS=" .. (package:config("asan") and "ON" or "OFF"))

table.insert(configs, "-DLLAMA_CURL=" .. (package:config("curl") and "ON" or "OFF"))
table.insert(configs, "-DGGML_OPENMP=" .. (package:config("openmp") and "ON" or "OFF"))
table.insert(configs, "-DGGML_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
table.insert(configs, "-DGGML_VULKAN=" .. (package:config("vulkan") and "ON" or "OFF"))
Expand Down

0 comments on commit 569aaa4

Please sign in to comment.