diff options
| author | ruki <[email protected]> | 2022-10-08 00:32:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-10-08 00:32:24 +0800 |
| commit | 664ef028094a250e06521b4a3bdb2a3a5fb567e6 (patch) | |
| tree | 867a3ba5d901b01575574afa2649adf556352892 | |
| parent | d8260f9ef9224739a30d50a419ca8e86eb21976d (diff) | |
use self:is_plat for tools
| -rw-r--r-- | xmake/modules/core/tools/gfortran.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/ld.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/nim.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/core/tools/nvcc.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/core/tools/rustc.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/zig.lua | 2 |
6 files changed, 13 insertions, 13 deletions
diff --git a/xmake/modules/core/tools/gfortran.lua b/xmake/modules/core/tools/gfortran.lua index 9e2053656..46032fe8c 100644 --- a/xmake/modules/core/tools/gfortran.lua +++ b/xmake/modules/core/tools/gfortran.lua @@ -31,7 +31,7 @@ function init(self) self:set("fcshflags", "-shared") -- add -fPIC for shared - if not is_plat("windows", "mingw") then + if not self:is_plat("windows", "mingw") then self:add("fcshflags", "-fPIC") self:add("shared.fcflags", "-fPIC") end diff --git a/xmake/modules/core/tools/ld.lua b/xmake/modules/core/tools/ld.lua index 2b91c2634..e933a847c 100644 --- a/xmake/modules/core/tools/ld.lua +++ b/xmake/modules/core/tools/ld.lua @@ -31,7 +31,7 @@ function init(self) self:set("shflags", "-shared") -- add -fPIC for shared - if not is_plat("windows", "mingw") then + if not self:is_plat("windows", "mingw") then self:add("shflags", "-fPIC") self:add("shared.cxflags", "-fPIC") end @@ -43,7 +43,7 @@ function nf_strip(self, level, target) debug = "-S" , all = "-s" } - if target:is_plat("macosx", "iphoneos") then + if self:is_plat("macosx", "iphoneos") then maps.all = "-Wl,-x" maps.debug = "-Wl,-S" end diff --git a/xmake/modules/core/tools/nim.lua b/xmake/modules/core/tools/nim.lua index 5e73c3eb4..e663c7a55 100644 --- a/xmake/modules/core/tools/nim.lua +++ b/xmake/modules/core/tools/nim.lua @@ -90,7 +90,7 @@ end -- make the strip flag function nf_strip(self, level, target) - if target:is_plat("linux", "macosx", "bsd") then + if self:is_plat("linux", "macosx", "bsd") then if level == "debug" or level == "all" then return "--passL:-s" end @@ -104,7 +104,7 @@ end -- make the link flag function nf_link(self, lib, target) - if target:is_plat("windows") then + if self:is_plat("windows") then return "--passL:" .. lib .. ".lib" else return "--passL:-l" .. lib @@ -113,7 +113,7 @@ end -- make the linkdir flag function nf_linkdir(self, dir, target) - if target:is_plat("windows") then + if self:is_plat("windows") then return {"--passL:-libpath:" .. path.translate(dir)} else return {"--passL:-L" .. path.translate(dir)} @@ -135,7 +135,7 @@ function buildargv(self, sourcefiles, targetkind, targetfile, flags) table.insert(flags_extra, "--passC:-DPreMain=PreMain_" .. uniquekey) table.insert(flags_extra, "--passC:-DPreMainInner=PreMainInner_" .. uniquekey) end - if targetkind ~= "static" and is_plat("windows") then + if targetkind ~= "static" and self:is_plat("windows") then -- fix link flags for windows -- @see https://github.com/nim-lang/Nim/issues/19033 local flags_new = {} diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 823872b5e..33c687695 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -31,7 +31,7 @@ import("utils.progress") function init(self) -- init cuflags - if not is_plat("windows", "mingw") then + if not self:is_plat("windows", "mingw") then self:set("shared.cuflags", "-Xcompiler -fPIC") self:set("binary.cuflags", "-Xcompiler -fPIE") end @@ -59,7 +59,7 @@ function nf_symbol(self, level, target) local flags = nil if level == "debug" then flags = {"-g", "-lineinfo"} - if is_plat("windows") then + if self:is_plat("windows") then local host_flags = nil local symbolfile = nil if target and target.symbolfile then @@ -136,7 +136,7 @@ function nf_warning(self, level) -- for gcc/clang, or any gnu compatible compiler on *nix -- local host_warning = nil - if is_plat("windows") then + if self:is_plat("windows") then host_warning = cl_maps[level] else host_warning = gcc_clang_maps[level] @@ -269,7 +269,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags) end -- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc - if targetkind == "shared" and is_plat("mingw") then + if targetkind == "shared" and self:is_plat("mingw") then table.insert(flags_extra, "-Xlinker") table.insert(flags_extra, "-Wl,--out-implib," .. path.join(path.directory(targetfile), path.basename(targetfile) .. ".dll.a")) end diff --git a/xmake/modules/core/tools/rustc.lua b/xmake/modules/core/tools/rustc.lua index c16c6261c..c2bf8db5e 100644 --- a/xmake/modules/core/tools/rustc.lua +++ b/xmake/modules/core/tools/rustc.lua @@ -104,7 +104,7 @@ end function buildargv(self, sourcefiles, targetkind, targetfile, flags) -- add rpath for dylib (macho), e.g. -install_name @rpath/file.dylib local flags_extra = {} - if targetkind == "shared" and is_plat("macosx", "iphoneos", "watchos") then + if targetkind == "shared" and self:is_plat("macosx", "iphoneos", "watchos") then table.insert(flags_extra, "-C") table.insert(flags_extra, "link-arg=-Xlinker") table.insert(flags_extra, "-C") diff --git a/xmake/modules/core/tools/zig.lua b/xmake/modules/core/tools/zig.lua index 88cfd0936..c722c700b 100644 --- a/xmake/modules/core/tools/zig.lua +++ b/xmake/modules/core/tools/zig.lua @@ -89,7 +89,7 @@ end -- make the rpathdir flag function nf_rpathdir(self, dir) dir = path.translate(dir) - if is_plat("macosx") then + if self:is_plat("macosx") then return {"-rpath", (dir:gsub("%$ORIGIN", "@loader_path"))} else return {"-rpath", (dir:gsub("@[%w_]+", function (name) |
