onedpl add fetch.lua (#4324)
* Update onedpl xmake.lua
* Create fetch.lua
* Update xmake.lua
rc1
* Update xmake.lua
/* MACROS DUE TO 3b9a1bb1af (diff-4c6821476cefc699b801f5fdbeda3341e3c64626dcf39a79621ea02031bdd50eL113)
*/
/* ALSO C.F. https://github.com/oneapi-src/oneDPL/issues/1602 */
/* AND THE USING OF _PSTL_... MACROS IS REMOVED FROM ONEDPL NOWADAYS*/
* Update xmake.lua
typo
* Update xmake.lua
* bad ci ; try again
ci on arch linux failed due to network error
* Update xmake.lua
* Refine config
* refine fetch.lua
remove unnecessary add_deps
* Update xmake.lua
* minor formatting refinement
pull/4334/head
parent
e9e06e9159
commit
b8fe8398a4
2 changed files with 67 additions and 1 deletions
@ -0,0 +1,44 @@ |
||||
import("lib.detect.find_path") |
||||
import("lib.detect.find_library") |
||||
|
||||
function _find_package(package, opt) |
||||
local paths = { |
||||
"$(env DPL_ROOT)", |
||||
"$(env ONEAPI_ROOT)/dpl/latest" |
||||
} |
||||
-- find library |
||||
local result = {links = {}, linkdirs = {}, includedirs = {}} |
||||
|
||||
-- find include |
||||
local includepath = find_path(path.join("oneapi", "dpl", "algorithm"), paths, {suffixes = "include"}) |
||||
if includepath then |
||||
table.insert(result.includedirs, includepath) |
||||
end |
||||
|
||||
if #result.includedirs > 0 then |
||||
local version_file = path.join(includepath, "oneapi", "dpl", "pstl", "onedpl_config.h") |
||||
if os.isfile(version_file) then |
||||
local content = io.readfile(version_file) |
||||
local major = content:match("ONEDPL_VERSION_MAJOR +(%d+)\n") |
||||
local minor = content:match("ONEDPL_VERSION_MINOR +(%d+)\n") |
||||
local patch = content:match("ONEDPL_VERSION_PATCH +(%d+)\n") |
||||
if patch then |
||||
result.version = format("%s.%s.%s", major, minor, patch) |
||||
else |
||||
result.version = format("%s.%s", major, minor) |
||||
end |
||||
end |
||||
|
||||
return result |
||||
end |
||||
end |
||||
|
||||
function main(package, opt) |
||||
if opt.system and package.find_package then |
||||
local result = _find_package(package, opt) |
||||
if not result then |
||||
result = package:find_package("onedpl", opt) |
||||
end |
||||
return result or false |
||||
end |
||||
end |
Loading…
Reference in new issue