summaryrefslogtreecommitdiff
path: root/xmake/toolchains/icx/check.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-05-23 22:39:39 +0800
committerruki <[email protected]>2024-05-23 22:39:39 +0800
commite4a3ca8b3412581eaa9b6a7acb00d7d2b5a6b27a (patch)
tree0528a32c85f0fa02738c0073fc60075da4b3807a /xmake/toolchains/icx/check.lua
parentcfafccfa0bae60f83d27fdda1cb593da9aa0d309 (diff)
add icx for windows
Diffstat (limited to 'xmake/toolchains/icx/check.lua')
-rw-r--r--xmake/toolchains/icx/check.lua44
1 files changed, 40 insertions, 4 deletions
diff --git a/xmake/toolchains/icx/check.lua b/xmake/toolchains/icx/check.lua
index 4d627915b..d22889f14 100644
--- a/xmake/toolchains/icx/check.lua
+++ b/xmake/toolchains/icx/check.lua
@@ -24,17 +24,44 @@ import("core.project.config")
import("detect.sdks.find_icxenv")
import("lib.detect.find_tool")
--- main entry
-function main(toolchain)
+-- check intel on windows
+function _check_intel_on_windows(toolchain)
+
+ -- have been checked?
+ local varsall = toolchain:config("varsall")
+ if varsall then
+ return true
+ end
+
+ -- find intel llvm c/c++ compiler environment
+ local icxenv = find_icxenv()
+ if icxenv and icxenv.icxvars then
+ local icxvarsall = icxenv.icxvars
+ local icxenv = icxvarsall[toolchain:arch()]
+ if icxenv and icxenv.PATH and icxenv.INCLUDE and icxenv.LIB then
+ local tool = find_tool("icx.exe", {force = true, envs = icxenv, version = true})
+ if tool then
+ cprint("checking for Intel LLVM C/C++ Compiler (%s) ... ${color.success}${text.success}", toolchain:arch())
+ toolchain:config_set("varsall", icxvarsall)
+ toolchain:configs_save()
+ return true
+ end
+ end
+ end
+end
+
+-- check intel on linux
+function _check_intel_on_linux(toolchain)
local icxenv = toolchain:config("icxenv")
if icxenv then
return true
end
icxenv = find_icxenv()
if icxenv then
- local tool = find_tool("icx", {force = true, paths = icxenv.bindir})
+ local ldname = is_host("macosx") and "DYLD_LIBRARY_PATH" or "LD_LIBRARY_PATH"
+ local tool = find_tool("icx", {force = true, envs = {[ldname] = icxenv.libdir}, paths = icxenv.bindir})
if tool then
- cprint("checking for Intel LLVM C/C++ Compiler (%s) ... ${color.success}${text.success}", toolchain:arch())
+ cprint("checking for Intel C/C++ Compiler (%s) ... ${color.success}${text.success}", toolchain:arch())
toolchain:config_set("icxenv", icxenv)
toolchain:config_set("bindir", icxenv.bindir)
toolchain:configs_save()
@@ -44,3 +71,12 @@ function main(toolchain)
end
end
+-- main entry
+function main(toolchain)
+ if is_host("windows") then
+ return _check_intel_on_windows(toolchain)
+ else
+ return _check_intel_on_linux(toolchain)
+ end
+end
+