Skip to content

Commit

Permalink
Fix libwebp link order (#2336)
Browse files Browse the repository at this point in the history
* Fix libwebp link order

* Move sharpyuv
  • Loading branch information
calebkiage authored Jul 16, 2023
1 parent d61b539 commit ba5ed53
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/l/libwebp/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ package("libwebp")
add_configs("thread", {description = "Enable threading support.", default = true, type = "boolean"})

add_deps("cmake")
add_links("webp", "webpdecoder", "webpencoder", "webpdemux")

if is_plat("macosx") then
add_extsources("brew::webp")
Expand All @@ -39,7 +38,16 @@ package("libwebp")
end

on_load(function (package)
for _, l in ipairs({"webp", "webpdecoder", "webpencoder", "webpdemux"}) do
local links = {"webpdecoder", "webpencoder", "webpdemux"}
if package:config("libwebpmux") then
table.insert(links, "webpmux")
end
table.insert(links, "webp")
if package:config("sharpyuv") or package:version():ge("1.2.3") then
table.insert(links, "sharpyuv")
end

for _, l in ipairs(links) do
if package:version():ge("1.3") then
package:add("links", (package:is_plat("windows") and "lib" or "") .. l)
else
Expand All @@ -52,13 +60,6 @@ package("libwebp")
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local lib_prefix = (package:version():ge("1.3") and package:is_plat("windows")) and "lib" or ""
if package:config("sharpyuv") or package:version():ge("1.2.3") then
package:add("links", lib_prefix .. "sharpyuv")
end
if package:config("libwebpmux") then
package:add("links", lib_prefix .. "webpmux")
end

for name, enabled in pairs(package:configs()) do
if name == "thread" then
Expand Down

0 comments on commit ba5ed53

Please sign in to comment.