Skip to content

Commit 2322a63

Browse files
committed
improve to find icx
1 parent 31dae58 commit 2322a63

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

xmake/modules/detect/sdks/find_icxenv.lua

+8-21
Original file line numberDiff line numberDiff line change
@@ -95,35 +95,22 @@ end
9595

9696
-- find intel llvm c/c++ envirnoment on windows
9797
function _find_intel_on_windows(opt)
98-
99-
-- init options
10098
opt = opt or {}
10199

102100
-- find icxvars_bat.bat
103-
local paths = {"$(env ICPP_COMPILER20)"}
104-
local icxvars_bat = find_file("bin/icxvars.bat", paths)
105-
-- look for setvars.bat which is new in 2021
106-
if not icxvars_bat then
107-
-- find setvars.bat in intel oneapi toolkits rootdir
108-
paths = {"$(env ONEAPI_ROOT)"}
109-
icxvars_bat = find_file("setvars.bat", paths)
110-
end
101+
local paths = {"$(env ONEAPI_ROOT)"}
102+
local icxvars_bat = find_file("setvars.bat", paths)
111103
if not icxvars_bat then
112-
-- find setvars.bat using ICPP_COMPILER.*
113-
paths = {
114-
"$(env ICPP_COMPILER21)",
115-
"$(env ICPP_COMPILER22)",
116-
"$(env ICPP_COMPILER23)"
117-
}
118-
icxvars_bat = find_file("../../../setvars.bat", paths)
104+
paths = {}
105+
local keys = winos.registry_keys("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Intel\\DPCPPSuites\\**\\DPC++")
106+
for _, key in ipairs(keys) do
107+
table.insert(paths, format("$(reg %s;ProductDir)", key))
108+
end
109+
icxvars_bat = find_file("../../setvars.bat", paths)
119110
end
120111
if icxvars_bat then
121-
122-
-- load icxvars_bat
123112
local icxvars_x86 = _load_icxvars(icxvars_bat, "ia32", opt)
124113
local icxvars_x64 = _load_icxvars(icxvars_bat, "intel64", opt)
125-
126-
-- save results
127114
return {icxvars_bat = icxvars_bat, icxvars = {x86 = icxvars_x86, x64 = icxvars_x64}}
128115
end
129116
end

0 commit comments

Comments
 (0)