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.
32 lines
1.2 KiB
32 lines
1.2 KiB
4 years ago
|
package("optix")
|
||
|
|
||
|
set_homepage("https://developer.nvidia.com/optix")
|
||
|
set_description("NVIDIA OPTIX™ RAY TRACING ENGINE")
|
||
|
|
||
|
on_fetch(function (package, opt)
|
||
|
if opt.system then
|
||
|
import("lib.detect.find_path")
|
||
|
|
||
|
local paths = {"$(env OptiX_ROOT)"}
|
||
|
if package:is_plat("windows") then
|
||
|
for _, dir in ipairs(os.dirs("$(env PROGRAMDATA)/NVIDIA Corporation/OptiX SDK *.*.*")) do
|
||
|
table.insert(paths, dir)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local inc = find_path("optix.h", paths, {suffixes = "include"})
|
||
|
if inc then
|
||
|
local result = {includedirs = {inc}}
|
||
|
local content = io.readfile(path.join(inc, "optix.h"))
|
||
|
local version_str = content:match("OPTIX_VERSION (%d+)\n")
|
||
|
if version_str then
|
||
|
local version_num = tonumber(version_str)
|
||
|
local version = format("%s.%s.%s", math.floor(version_num/10000), math.floor(version_num%10000/100), version_num%100)
|
||
|
result.version = version
|
||
|
end
|
||
|
|
||
|
return result
|
||
|
end
|
||
|
end
|
||
|
end)
|