diff options
| author | ruki <[email protected]> | 2022-10-08 00:31:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-10-08 00:31:45 +0800 |
| commit | d8260f9ef9224739a30d50a419ca8e86eb21976d (patch) | |
| tree | 3a0fb2a5d4a4c810eed72a5f9a10c8ba7831c20f | |
| parent | 0adcc75463e4b745199cf07fcdbd6d27ac39249e (diff) | |
improve gcc/clang
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/fpc.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 11 |
3 files changed, 9 insertions, 10 deletions
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index ef0a379da..08822e367 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -29,7 +29,7 @@ function init(self) _super.init(self) -- add cuflags - if not is_plat("windows", "mingw") then + if not self:is_plat("windows", "mingw") then self:add("shared.cuflags", "-fPIC") end @@ -135,7 +135,7 @@ function nf_symbol(self, level) local kind = self:kind() if kind == "ld" or kind == "sh" then -- clang/windows need add `-g` to linker to generate pdb symbol file - if self:plat() == "windows" and level == "debug" then + if self:is_plat("windows") and level == "debug" then return "-g" end else diff --git a/xmake/modules/core/tools/fpc.lua b/xmake/modules/core/tools/fpc.lua index 57af7a45b..a141238de 100644 --- a/xmake/modules/core/tools/fpc.lua +++ b/xmake/modules/core/tools/fpc.lua @@ -26,7 +26,7 @@ import("core.language.language") -- init it function init(self) - if not is_plat("windows", "mingw") then + if not self:is_plat("windows", "mingw") then self:add("shared.pcflags", "-Cg") end end @@ -58,7 +58,7 @@ end -- make the symbol flag function nf_symbol(self, level) if level == "debug" and self:kind() == "pc" then - if self:plat() == "windows" then + if self:is_plat("windows") then return {"-gw3", "-WN"} else return "-gw3" 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 |
