package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.3 KiB

package("libxnvctrl")
set_homepage("https://www.nvidia.com/en-us/drivers/unix/")
set_description("NVIDIA driver control panel")
if is_plat("linux") then
add_extsources("apt::libxnvctrl-dev")
end
on_fetch("linux", function (package, opt)
if opt.system then
import("lib.detect.find_path")
import("lib.detect.find_library")
-- init search paths
3 years ago
local paths = {"/usr"}
-- find library
local result = {links = {}, linkdirs = {}, includedirs = {}}
local arch = package:is_arch("x86_64") and "x86_64" or "x86"
local archsuffix = arch .. "-linux-gnu"
local linkinfo = find_library("XNVCtrl", paths, {suffixes = {"lib", path.join("lib", archsuffix)}})
if linkinfo then
table.insert(result.linkdirs, linkinfo.linkdir)
table.insert(result.links, "XNVCtrl")
end
result.linkdirs = table.unique(result.linkdirs)
-- find headers
local path = find_path("NVCtrl/NVCtrl.h", paths, {suffixes = "include"})
if path then
table.insert(result.includedirs, path)
end
if #result.includedirs > 0 and #result.linkdirs > 0 then
return result
end
end
end)