Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of GFortran in MKL package #5258

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
31 changes: 23 additions & 8 deletions packages/m/mkl/fetch.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import("lib.detect.find_path")
import("lib.detect.find_library")

-- add_configs("runtime", {description = "Set MKL runtime for gcc/clang like compilers.", default = "default", type = "string", values = {"default", "custom"}})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused comments


function _find_package(package, opt)
local rdir = (package:is_arch("x64", "x86_64") and "intel64" or "ia32")
local suffix = (package:config("interface") == 32 and "lp64" or "ilp64")
Expand Down Expand Up @@ -45,14 +47,27 @@ function _find_package(package, opt)
table.join2(group, {"mkl_intel_thread", "mkl_core"})
end

if package:has_tool("cc", "gcc", "gxx") then
result.ldflags = "-Wl,--start-group "
for _, lib in ipairs(group) do
result.ldflags = result.ldflags .. "-l" .. lib .. " "
end
result.ldflags = result.ldflags .. "-Wl,--end-group"
else
table.join2(result.links, group)
for _, toolkind in ipairs({"ld", "fcld"}) do
-- if package:config("runtime") == "default" then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

if (package:has_tool(toolkind, "gcc", "gxx") or package:has_tool(toolkind, "gfortran")) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove () in if () then

local flags = {"-Wl,--start-group"}
for _, lib in ipairs(group) do
table.insert(flags, "-l" .. lib)
end
table.insert(flags, "-Wl,--end-group")
if package:has_tool(toolkind, "gcc", "gxx") then
result.ldflags = table.concat(flags, " ")
result.shflags = table.concat(flags, " ")
else
-- result.fcldflags = table.concat(flags, " ")
-- result.fcshflags = table.concat(flags, " ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

result.fcldflags = table.concat(flags, " ")
result.fcshflags = table.concat(flags, " ")
end
else
table.join2(result.links, group)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please simplify repeat table.concat, we need not call table.concat

            if package:has_tool(toolkind, "gfortran") then
                result.fcldflags = flags
                result.fcshflags = flags
            else
                result.ldflags = flags
                result.shflags = flags
            end

-- end
end

-- find include
Expand Down
Loading
Loading