Skip to content

Commit 9d6b24b

Browse files
authored
lodepng: add cpp config (#7311)
1 parent c8af5b6 commit 9d6b24b

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

packages/l/lodepng/xmake.lua

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
11
package("lodepng")
2-
32
set_homepage("https://lodev.org/lodepng/")
43
set_description("PNG encoder and decoder in C and C++.")
54
set_license("zlib")
65

76
add_urls("https://github.com/lvandeve/lodepng.git")
87

8+
add_versions("2025.05.06", "17d08dd26cac4d63f43af217ebd70318bfb8189c")
9+
10+
add_patches("2025.05.06", "https://patch-diff.githubusercontent.com/raw/lvandeve/lodepng/pull/182.diff", "ec7f2ab3f2515cef3e422a41d8fcc215295ba1d0d761f52f54f199a6aa584ba3")
11+
12+
add_configs("cpp", {description = "Enable C++ support.", default = true, type = "boolean"})
13+
914
on_install(function (package)
15+
local src = "lodepng.cpp"
16+
if not package:config("cpp") then
17+
src = "lodepng.c"
18+
os.mv("lodepng.cpp", "lodepng.c")
19+
end
1020
io.writefile("xmake.lua", [[
11-
add_rules("mode.debug", "mode.release")
21+
add_rules("mode.release", "mode.debug")
1222
target("lodepng")
1323
set_kind("$(kind)")
14-
add_files("lodepng.cpp")
24+
add_files("]] .. src .. [[")
1525
add_headerfiles("lodepng.h")
26+
if is_plat("windows") and is_kind("shared") then
27+
add_rules("utils.symbols.export_all")
28+
end
1629
]])
17-
local configs = {}
18-
if package:config("shared") then
19-
configs.kind = "shared"
20-
elseif not package:is_plat("windows", "mingw") and package:config("pic") ~= false then
21-
configs.cxflags = "-fPIC"
22-
end
23-
import("package.tools.xmake").install(package, configs)
30+
import("package.tools.xmake").install(package)
2431
end)
2532

2633
on_test(function (package)

0 commit comments

Comments
 (0)