summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/gcc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-08 00:31:45 +0800
committerruki <[email protected]>2022-10-08 00:31:45 +0800
commitd8260f9ef9224739a30d50a419ca8e86eb21976d (patch)
tree3a0fb2a5d4a4c810eed72a5f9a10c8ba7831c20f /xmake/modules/core/tools/gcc.lua
parent0adcc75463e4b745199cf07fcdbd6d27ac39249e (diff)
improve gcc/clang
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
-rw-r--r--xmake/modules/core/tools/gcc.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 937348037..b7866c710 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -49,7 +49,7 @@ function init(self)
-- we need check it for clang/gcc with window target
-- @see https://github.com/xmake-io/xmake/issues/1392
--
- if not is_plat("windows", "mingw") and self:has_flags("-fPIC", "cxflags") then
+ if not self:is_plat("windows", "mingw") and self:has_flags("-fPIC", "cxflags") then
self:add("shflags", "-fPIC")
self:add("shared.cxflags", "-fPIC")
end
@@ -69,7 +69,7 @@ function init(self)
})
-- for macho target
- if is_plat("macosx") or is_plat("iphoneos") then
+ if self:is_plat("macosx", "iphoneos") then
self:add("mapflags", {
["-s"] = "-Wl,-x"
})
@@ -82,7 +82,7 @@ function nf_strip(self, level, target)
debug = "-Wl,-S"
, all = "-s"
}
- if target:is_plat("macosx", "iphoneos") then
+ if self:is_plat("macosx", "iphoneos") then
maps.all = "-Wl,-x"
end
return maps[level]
@@ -350,14 +350,13 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
-- add rpath for dylib (macho), e.g. -install_name @rpath/file.dylib
local flags_extra = {}
- local plat = self:plat()
- if targetkind == "shared" and (plat == "macosx" or plat == "iphoneos" or plat == "watchos") then
+ if targetkind == "shared" and self:is_plat("macosx", "iphoneos", "watchos") then
table.insert(flags_extra, "-install_name")
table.insert(flags_extra, "@rpath/" .. path.filename(targetfile))
end
-- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc
- if targetkind == "shared" and plat == "mingw" then
+ if targetkind == "shared" and self:is_plat("mingw") then
table.insert(flags_extra, "-Wl,--out-implib," .. path.join(path.directory(targetfile), path.basename(targetfile) .. ".dll.a"))
end