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 special language linker flags for package #5644

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion xmake/core/tool/builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,17 @@ end

-- add flags from the target packages
function builder:_add_flags_from_targetpkgs(flags, target)
local kind = self:kind()
for _, flagkind in ipairs(self:_flagkinds()) do
local result = target:get_from(flagkind, "package::*")
-- attempt to add special lanugage flags from package first, e.g. gcldflags, dcarflags
-- @see https://github.com/xmake-io/xmake-repo/issues/5255
local result
if kind:endswith("ld") or kind:endswith("sh") then
result = target:get_from(kind .. "flags", "package::*")
end
if not result then
result = target:get_from(flagkind, "package::*")
end
if result then
for _, values in ipairs(table.wrap(result)) do
table.join2(flags, self:_mapflags(values, flagkind, target))
Expand Down
2 changes: 1 addition & 1 deletion xmake/core/tool/linker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function linker:_add_flags_from_linker(flags)
local toolkind = self:kind()
for _, flagkind in ipairs(self:_flagkinds()) do
-- attempt to add special lanugage flags first, e.g. gcldflags, dcarflags
table.join2(flags, self:get(toolkind .. 'flags') or self:get(flagkind))
table.join2(flags, self:get(toolkind .. "flags") or self:get(flagkind))
end
end

Expand Down
Loading