Improve opencl (#2254)

* Improve opencl

* Add build type and restrict platforms

* Add long paths policy

* Use prebuilts binaries

* Update xmake.lua

---------

Co-authored-by: ruki <waruqi@gmail.com>
pull/2260/head
A2va 2 years ago committed by GitHub
parent a21a344962
commit 55b319d09d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      packages/o/opencl/xmake.lua

@ -3,8 +3,25 @@ package("opencl")
set_homepage("https://opencl.org/")
set_description("OpenCL is an open, royalty-free industry standard that makes much faster computations possible through parallel computing.")
if is_plat("windows") then
if is_arch("x86", "i386") then
set_urls("https://github.com/KhronosGroup/OpenCL-SDK/releases/download/$(version)/OpenCL-SDK-$(version)-Win-x86.zip")
add_versions("v2023.04.17", "ff6fa1b4e311a3f655eff4eda28008ec48dccd559ec3ed95ce6d9a584cd3b581")
elseif is_arch("x64") then
set_urls("https://github.com/KhronosGroup/OpenCL-SDK/releases/download/$(version)/OpenCL-SDK-$(version)-Win-x64.zip")
add_versions("v2023.04.17", "11844a1d69a71f82dc14ce66382c6b9fc8a4aee5840c21a786c5accb1d69bc0a")
end
else
set_urls("https://github.com/KhronosGroup/OpenCL-SDK.git")
add_versions("v2023.04.17", "ae7fcae82fe0b7bcc272e43fc324181b2d544eea")
end
add_configs("vendor", {description = "Set OpenCL Vendor.", default = nil, type = "string", values = {"nvidia", "intel", "amd"}})
if not is_plat("windows") then
add_deps("cmake")
end
on_fetch(function (package, opt)
if opt.system then
import("lib.detect.find_path")
@ -64,3 +81,15 @@ package("opencl")
end
end
end)
on_install("windows|x86", "windows|x64", function (package)
os.cp("lib", package:installdir())
os.cp("bin", package:installdir())
os.cp("include", package:installdir())
end)
on_install("linux", "macosx", "android", function (package)
local configs = {"-DOPENCL_SDK_BUILD_SAMPLES=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
import("package.tools.cmake").install(package, configs)
end)

Loading…
Cancel
Save