summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-12-08 23:08:41 +0800
committerruki <[email protected]>2021-12-08 23:08:41 +0800
commit42c73afaf38ab2645944c8bccd4e24aedba62d7e (patch)
tree9ea696f7fc3f7735b1c504d6fb25e212506d24eb
parentdedcd548ec31ad936128b272c705f8f30fb01eb2 (diff)
improve ifort toolchain
-rw-r--r--xmake/modules/detect/sdks/find_ifortenv.lua12
-rw-r--r--xmake/toolchains/ifort/check.lua5
-rw-r--r--xmake/toolchains/ifort/load.lua1
3 files changed, 11 insertions, 7 deletions
diff --git a/xmake/modules/detect/sdks/find_ifortenv.lua b/xmake/modules/detect/sdks/find_ifortenv.lua
index f45bda0d5..3aca40524 100644
--- a/xmake/modules/detect/sdks/find_ifortenv.lua
+++ b/xmake/modules/detect/sdks/find_ifortenv.lua
@@ -124,10 +124,14 @@ function _find_intel_on_linux(opt)
return {sdkdir = sdkdir, bindir = bindir, libdir = path.join(sdkdir, "lib")}
end
- if is_host("linux") then
- local arch = os.arch() == "x86_64" and "intel64" or "ia32"
- local host = is_host("macosx") and "macos" or "linux"
- local paths = {"~/intel/oneapi/compiler/latest/" .. host .. "/bin/" .. arch}
+ -- find it from oneapi sdk directory
+ local oneapi_rootdirs = {"~/intel/oneapi/compiler", "/opt/intel/oneapi/compiler"}
+ local arch = os.arch() == "x86_64" and "intel64" or "ia32"
+ paths = {}
+ for _, rootdir in ipairs(oneapi_rootdirs) do
+ table.insert(paths, path.join(rootdir, "*", is_host("macosx") and "mac" or "linux", "bin", arch))
+ end
+ if #paths > 0 then
local ifort = find_file("ifort", paths)
if ifort then
local bindir = path.directory(ifort)
diff --git a/xmake/toolchains/ifort/check.lua b/xmake/toolchains/ifort/check.lua
index cb37666b7..285f5c86c 100644
--- a/xmake/toolchains/ifort/check.lua
+++ b/xmake/toolchains/ifort/check.lua
@@ -43,7 +43,7 @@ function _check_intel_on_windows(toolchain)
if tool then
cprint("checking for Intel Fortran Compiler (%s) ... ${color.success}${text.success}", toolchain:arch())
toolchain:config_set("varsall", ifortvarsall)
- toolchain:config_save()
+ toolchain:configs_save()
return true
end
end
@@ -63,7 +63,8 @@ function _check_intel_on_linux(toolchain)
if tool then
cprint("checking for Intel Fortran Compiler (%s) ... ${color.success}${text.success}", toolchain:arch())
toolchain:config_set("ifortenv", ifortenv)
- toolchain:config_save()
+ toolchain:config_set("bindir", ifortenv.bindir)
+ toolchain:configs_save()
return true
end
return true
diff --git a/xmake/toolchains/ifort/load.lua b/xmake/toolchains/ifort/load.lua
index 2cb212a57..1d8eb870f 100644
--- a/xmake/toolchains/ifort/load.lua
+++ b/xmake/toolchains/ifort/load.lua
@@ -87,7 +87,6 @@ function _load_intel_on_linux(toolchain)
end
-- get ifort environments
- local ifortenv = toolchain:config("ifortenv")
if ifortenv then
local ldname = is_host("macosx") and "DYLD_LIBRARY_PATH" or "LD_LIBRARY_PATH"
toolchain:add("runenvs", ldname, ifortenv.libdir)