Skip to content

Commit 90e0654

Browse files
libsquish: remove limit plat (#5014)
* libsquish: remove limit plat * port xmake * Update xmake.lua
1 parent 355509f commit 90e0654

File tree

2 files changed

+45
-12
lines changed

2 files changed

+45
-12
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
option("sse2", {default = false})
2+
option("openmp", {default = false})
3+
4+
if has_config("openmp") then
5+
add_requires("openmp")
6+
add_packages("openmp")
7+
add_defines("SQUISH_USE_OPENMP")
8+
end
9+
10+
if has_config("sse2") then
11+
add_vectorexts("sse2")
12+
add_defines("SQUISH_USE_SSE=2")
13+
end
14+
15+
add_rules("mode.debug", "mode.release")
16+
17+
set_languages("c++11")
18+
19+
target("squish")
20+
set_kind("$(kind)")
21+
add_files("*.cpp")
22+
add_headerfiles("squish.h")
23+
24+
if is_plat("windows") and is_kind("shared") then
25+
add_rules("utils.symbols.export_all", {export_classes = true})
26+
end

packages/l/libsquish/xmake.lua

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
package("libsquish")
2-
32
set_homepage("https://sourceforge.net/projects/libsquish/")
43
set_description("The libSquish library compresses images with the DXT standard (also known as S3TC).")
54
set_license("MIT")
65

76
add_urls("https://sourceforge.net/projects/libsquish/files/libsquish-$(version).tgz")
87
add_versions("1.15", "628796eeba608866183a61d080d46967c9dda6723bc0a3ec52324c85d2147269")
98

10-
add_configs("openmp", {description = "Enable OpenMP build.", default = false, type = "boolean"})
11-
if is_plat("windows") then
12-
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
13-
end
9+
add_configs("openmp", {description = "Build with OpenMP.", default = false, type = "boolean"})
10+
add_configs("sse2", {description = "Build with SSE2.", default = false, type = "boolean"})
11+
12+
on_load(function (package)
13+
if package:config("openmp") then
14+
package:add("deps", "openmp")
15+
package:add("defines", "SQUISH_USE_OPENMP")
16+
end
17+
18+
if package:config("sse2") then
19+
package:add("defines", "SQUISH_USE_SSE=2")
20+
end
21+
end)
1422

15-
add_deps("cmake")
16-
on_install("windows", "macosx", "linux", function (package)
17-
local configs = {}
18-
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
19-
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
20-
table.insert(configs, "-DBUILD_SQUISH_WITH_OPENMP=" .. (package:config("openmp") and "ON" or "OFF"))
21-
import("package.tools.cmake").install(package, configs)
23+
on_install(function (package)
24+
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
25+
import("package.tools.xmake").install(package, {
26+
openmp = package:config("openmp"),
27+
sse2 = package:config("sse2")
28+
})
2229
end)
2330

2431
on_test(function (package)

0 commit comments

Comments
 (0)