summaryrefslogtreecommitdiff
path: root/xmake/toolchains
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-07 00:53:57 +0800
committerruki <[email protected]>2020-10-07 00:53:57 +0800
commited9243b5b503c00057b10efb7cf6ee82eb9c35c5 (patch)
tree200070c6ba5b56b06c71bf4f6f47f66a577e1c60 /xmake/toolchains
parentacc4c79235d585c6c3f05aaf3d2c6e11adb076ff (diff)
support icl for windows
Diffstat (limited to 'xmake/toolchains')
-rw-r--r--xmake/toolchains/icc/check.lua28
-rw-r--r--xmake/toolchains/icc/load.lua26
2 files changed, 54 insertions, 0 deletions
diff --git a/xmake/toolchains/icc/check.lua b/xmake/toolchains/icc/check.lua
index a5254f20f..4cbc9f5d2 100644
--- a/xmake/toolchains/icc/check.lua
+++ b/xmake/toolchains/icc/check.lua
@@ -26,6 +26,34 @@ import("lib.detect.find_tool")
-- check intel on windows
function _check_intel_on_windows(toolchain)
+
+ -- have been checked?
+ if config.get("__iclvarsall") then
+ return true
+ end
+
+ -- find intel
+ local intel = find_intel()
+ if intel and intel.iclvars then
+ local iclvarsall = intel.iclvars
+ local iclenv = iclvarsall[toolchain:arch()]
+ if iclenv and iclenv.PATH and iclenv.INCLUDE and iclenv.LIB then
+
+ -- save iclvars
+ config.set("__iclvarsall", iclvarsall)
+
+ -- check compiler
+ local program = nil
+ local tool = find_tool("icl.exe", {force = true, envs = iclenv, version = true})
+ if tool then
+ program = tool.program
+ end
+ if program then
+ cprint("checking for Intel C/C++ Compiler (%s) ... ${color.success}${text.success}", toolchain:arch())
+ return true
+ end
+ end
+ end
end
-- check intel on linux
diff --git a/xmake/toolchains/icc/load.lua b/xmake/toolchains/icc/load.lua
index 1265ac731..c854b7b91 100644
--- a/xmake/toolchains/icc/load.lua
+++ b/xmake/toolchains/icc/load.lua
@@ -22,6 +22,26 @@
import("core.base.option")
import("core.project.config")
+-- add the given icl environment
+function _add_iclenv(toolchain, name)
+
+ -- get iclvarsall
+ local iclvarsall = config.get("__iclvarsall")
+ if not iclvarsall then
+ return
+ end
+
+ -- get icl environment for the current arch
+ local arch = toolchain:arch()
+ local iclenv = iclvarsall[arch] or {}
+
+ -- get the paths for the icl environment
+ local env = iclenv[name]
+ if env then
+ toolchain:add("runenvs", name:upper(), path.splitenv(env))
+ end
+end
+
-- load intel on windows
function _load_intel_on_windows(toolchain)
@@ -49,6 +69,12 @@ function _load_intel_on_windows(toolchain)
toolchain:set("toolset", "strip", "strip")
toolchain:set("toolset", "as", "icc")
end
+
+ -- add icl environments
+ _add_iclenv(toolchain, "PATH")
+ _add_iclenv(toolchain, "LIB")
+ _add_iclenv(toolchain, "INCLUDE")
+ _add_iclenv(toolchain, "LIBPATH")
end
-- load intel on linux