|
| 1 | +package("basisu") |
| 2 | + set_homepage("https://github.com/BinomialLLC/basis_universal") |
| 3 | + set_description("Basis Universal GPU Texture Codec") |
| 4 | + set_license("Apache-2.0") |
| 5 | + |
| 6 | + add_urls("https://github.com/BinomialLLC/basis_universal/archive/refs/tags/$(version).tar.gz", |
| 7 | + "https://github.com/BinomialLLC/basis_universal.git") |
| 8 | + |
| 9 | + add_versions("1.16.4", "e5740fd623a2f8472c9700b9447a8725a6f27d65b0b47c3e3926a60db41b8a64") |
| 10 | + |
| 11 | + add_configs("opencl", {description = "Enable opencl", default = false, type = "boolean"}) |
| 12 | + add_configs("tools", {description = "Build tools", default = false, type = "boolean"}) |
| 13 | + |
| 14 | + if is_plat("linux", "bsd") then |
| 15 | + add_syslinks("m", "pthread") |
| 16 | + end |
| 17 | + |
| 18 | + add_deps("zstd") |
| 19 | + |
| 20 | + on_load(function (package) |
| 21 | + if package:config("opencl") then |
| 22 | + package:add("deps", "opencl") |
| 23 | + end |
| 24 | + end) |
| 25 | + |
| 26 | + on_install(function (package) |
| 27 | + io.replace("encoder/basisu_comp.cpp", "../zstd/zstd.h", "zstd.h", {plain = true}) |
| 28 | + |
| 29 | + local configs = { |
| 30 | + opencl = package:config("opencl"), |
| 31 | + tools = package:config("tools"), |
| 32 | + } |
| 33 | + os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
| 34 | + import("package.tools.xmake").install(package, configs) |
| 35 | + end) |
| 36 | + |
| 37 | + on_test(function (package) |
| 38 | + assert(package:check_cxxsnippets({test = [[ |
| 39 | + void test() { |
| 40 | + basist::basisu_transcoder_init(); |
| 41 | + } |
| 42 | + ]]}, {configs = {languages = "c++11"}, includes = "basisu/transcoder/basisu_transcoder.h"})) |
| 43 | + end) |
0 commit comments