|
|
|
package("vulkan-loader")
|
|
|
|
|
|
|
|
set_homepage("https://github.com/KhronosGroup/Vulkan-Loader")
|
|
|
|
set_description("This project provides the Khronos official Vulkan ICD desktop loader for Windows, Linux, and MacOS.")
|
|
|
|
set_license("Apache-2.0")
|
|
|
|
|
|
|
|
add_urls("https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-$(version).tar.gz", {version = function (version) return version:gsub("%+", ".") end})
|
|
|
|
add_versions("1.2.162+0", "f8f5ec2485e7fdba3f58c1cde5a25145ece1c6a686c91ba4016b28c0af3f21dd")
|
|
|
|
add_versions("1.2.154+1", "889e45f7175d915dd0d702013b8021192e181d20f2ad4021c94006088f1edfe5")
|
|
|
|
|
|
|
|
add_deps("cmake", "ninja")
|
|
|
|
if is_plat("linux") then
|
|
|
|
add_deps("wayland", "libxrandr", "libxcb", "libxkbcommon")
|
|
|
|
end
|
|
|
|
|
|
|
|
on_load("windows", "linux", function (package)
|
|
|
|
local sdkver = package:version():split("%+")[1]
|
|
|
|
package:add("deps", "vulkan-headers " .. sdkver)
|
|
|
|
end)
|
|
|
|
|
|
|
|
on_install("windows", "linux", function (package)
|
|
|
|
import("package.tools.cmake")
|
|
|
|
local envs = cmake.buildenvs(package, {cmake_generator = "Ninja"})
|
|
|
|
if package:is_plat("linux") then
|
|
|
|
local includes = {}
|
|
|
|
local linkdirs = {}
|
|
|
|
for _, lib in ipairs({"wayland", "libxrandr", "libxcb", "libxkbcommon"}) do
|
|
|
|
local fetchinfo = package:dep(lib):fetch()
|
|
|
|
for _, dir in ipairs(fetchinfo.sysincludedirs or fetchinfo.includedirs) do
|
|
|
|
table.insert(includes, dir)
|
|
|
|
end
|
|
|
|
for _, dir in ipairs(fetchinfo.linkdirs) do
|
|
|
|
table.insert(linkdirs, dir)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
envs.C_INCLUDE_PATH = (envs.C_INCLUDE_PATH or "") .. path.envsep() .. path.joinenv(table.unique(includes))
|
|
|
|
envs.LD_LIBRARY_PATH = (envs.LD_LIBRARY_PATH or "") .. path.envsep() .. path.joinenv(table.unique(linkdirs))
|
|
|
|
end
|
|
|
|
|
|
|
|
local configs = {"-DBUILD_TESTS=OFF"}
|
|
|
|
local vulkan_headers = package:dep("vulkan-headers")
|
|
|
|
table.insert(configs, "-DVULKAN_HEADERS_INSTALL_DIR=" .. vulkan_headers:installdir())
|
|
|
|
cmake.install(package, configs, {cmake_generator = "Ninja", envs = envs})
|
|
|
|
end)
|
|
|
|
|
|
|
|
on_test(function (package)
|
|
|
|
assert(package:has_cfuncs("vkGetDeviceProcAddr", {includes = "vulkan/vulkan_core.h"}))
|
|
|
|
end)
|