parent
ecf7f2e3be
commit
b90a891b04
2 changed files with 80 additions and 0 deletions
@ -0,0 +1,37 @@ |
||||
option("opencl", {default = false}) |
||||
option("tools", {default = false}) |
||||
|
||||
add_rules("mode.debug", "mode.release") |
||||
|
||||
set_languages("c++11") |
||||
add_rules("utils.install.cmake_importfiles") |
||||
|
||||
if has_config("opencl") then |
||||
add_requires("opencl") |
||||
add_packages("opencl") |
||||
add_defines("BASISU_SUPPORT_OPENCL") |
||||
end |
||||
|
||||
add_requires("zstd") |
||||
add_packages("zstd") |
||||
add_defines("BASISD_SUPPORT_KTX2_ZSTD") |
||||
|
||||
target("basisu") |
||||
set_kind("$(kind)") |
||||
add_files("encoder/*.cpp", "transcoder/*.cpp") |
||||
add_headerfiles("(encoder/*.h)", "(transcoder/*.h)", "(transcoder/*.inc)", {prefixdir = "basisu"}) |
||||
|
||||
add_vectorexts("all") |
||||
|
||||
if is_plat("windows") and is_kind("shared") then |
||||
add_rules("utils.symbols.export_all", {export_classes = true}) |
||||
elseif is_plat("linux", "bsd") then |
||||
add_syslinks("m", "pthread") |
||||
end |
||||
|
||||
if has_config("tools") then |
||||
target("basisu_tool") |
||||
set_kind("binary") |
||||
add_files("basisu_tool.cpp") |
||||
add_deps("basisu") |
||||
end |
@ -0,0 +1,43 @@ |
||||
package("basisu") |
||||
set_homepage("https://github.com/BinomialLLC/basis_universal") |
||||
set_description("Basis Universal GPU Texture Codec") |
||||
set_license("Apache-2.0") |
||||
|
||||
add_urls("https://github.com/BinomialLLC/basis_universal/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/BinomialLLC/basis_universal.git") |
||||
|
||||
add_versions("1.16.4", "e5740fd623a2f8472c9700b9447a8725a6f27d65b0b47c3e3926a60db41b8a64") |
||||
|
||||
add_configs("opencl", {description = "Enable opencl", default = false, type = "boolean"}) |
||||
add_configs("tools", {description = "Build tools", default = false, type = "boolean"}) |
||||
|
||||
if is_plat("linux", "bsd") then |
||||
add_syslinks("m", "pthread") |
||||
end |
||||
|
||||
add_deps("zstd") |
||||
|
||||
on_load(function (package) |
||||
if package:config("opencl") then |
||||
package:add("deps", "opencl") |
||||
end |
||||
end) |
||||
|
||||
on_install(function (package) |
||||
io.replace("encoder/basisu_comp.cpp", "../zstd/zstd.h", "zstd.h", {plain = true}) |
||||
|
||||
local configs = { |
||||
opencl = package:config("opencl"), |
||||
tools = package:config("tools"), |
||||
} |
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
import("package.tools.xmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
void test() { |
||||
basist::basisu_transcoder_init(); |
||||
} |
||||
]]}, {configs = {languages = "c++11"}, includes = "basisu/transcoder/basisu_transcoder.h"})) |
||||
end) |
Loading…
Reference in new issue