diff options
| author | ruki <[email protected]> | 2015-06-11 16:58:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-11 16:58:01 +0800 |
| commit | 882430fde4f0066e9adbbb664b98612fa4cf3bc1 (patch) | |
| tree | f5eeeb2961d22bfd68a80d95404e07396791336e /xmake/scripts/platform/windows/tools | |
| parent | 76fd1ccaf43262df8fae3d9d3bfba1c2f0e04ca5 (diff) | |
add self for tools
Diffstat (limited to 'xmake/scripts/platform/windows/tools')
| -rw-r--r-- | xmake/scripts/platform/windows/tools/cl.lua | 23 | ||||
| -rw-r--r-- | xmake/scripts/platform/windows/tools/link.lua | 23 | ||||
| -rw-r--r-- | xmake/scripts/platform/windows/tools/nmake.lua | 12 |
3 files changed, 32 insertions, 26 deletions
diff --git a/xmake/scripts/platform/windows/tools/cl.lua b/xmake/scripts/platform/windows/tools/cl.lua index c8d96b81c..879264e68 100644 --- a/xmake/scripts/platform/windows/tools/cl.lua +++ b/xmake/scripts/platform/windows/tools/cl.lua @@ -66,16 +66,19 @@ function cl._leave(name, old) end -- init the compiler -function cl.init(name) +function cl.init(self, name) + + -- save name + self._NAME = name or "cl.exe" -- init cflags - cl.cflags = { "-nologo" } + self.cflags = { "-nologo" } -- init cxxflags - cl.cxxflags = { "-nologo" } + self.cxxflags = { "-nologo" } -- init flags map - cl.mapflags = + self.mapflags = { -- optimize ["-O0"] = "-Od" @@ -113,35 +116,35 @@ function cl.init(name) end -- make the compiler command -function cl.command_compile(srcfile, objfile, flags) +function cl.command_compile(self, srcfile, objfile, flags) -- make it - return string.format("cl.exe -c %s -Fo%s %s", flags, objfile, srcfile) + return string.format("%s -c %s -Fo%s %s", self._NAME, flags, objfile, srcfile) end -- make the define flag -function cl.flag_define(define) +function cl.flag_define(self, define) -- make it return "-D" .. define end -- make the undefine flag -function cl.flag_undefine(undefine) +function cl.flag_undefine(self, undefine) -- make it return "-U" .. undefine end -- make the includedir flag -function cl.flag_includedir(includedir) +function cl.flag_includedir(self, includedir) -- make it return "-I" .. includedir end -- the main function -function cl.main(cmd) +function cl.main(self, cmd) -- enter the vs environment local pathes = cl._enter("path") diff --git a/xmake/scripts/platform/windows/tools/link.lua b/xmake/scripts/platform/windows/tools/link.lua index 5d37a43e6..ad1086ba5 100644 --- a/xmake/scripts/platform/windows/tools/link.lua +++ b/xmake/scripts/platform/windows/tools/link.lua @@ -66,7 +66,10 @@ function link._leave(name, old) end -- init the compiler -function link.init(name) +function link.init(self, name) + + -- save name + self._NAME = name or "link.exe" -- the architecture local arch = config.get("arch") @@ -79,7 +82,7 @@ function link.init(name) end -- init ldflags - link.ldflags = { "-nologo" + self.ldflags = { "-nologo" , "-dynamicbase" , "-nxcompat" , "-manifest" @@ -87,13 +90,13 @@ function link.init(name) , flags_arch} -- init arflags - link.arflags = {"-lib", "-nologo", flags_arch} + self.arflags = {"-lib", "-nologo", flags_arch} -- init shflags - link.shflags = {"-dll", "-nologo", flags_arch} + self.shflags = {"-dll", "-nologo", flags_arch} -- init flags map - link.mapflags = + self.mapflags = { -- strip ["-s"] = "" @@ -108,28 +111,28 @@ function link.init(name) end -- make the linker command -function link.command_link(objfiles, targetfile, flags) +function link.command_link(self, objfiles, targetfile, flags) -- make it - return string.format("link.exe %s -out:%s %s", flags, targetfile, objfiles) + return string.format("%s %s -out:%s %s", self._NAME, flags, targetfile, objfiles) end -- make the link flag -function link.flag_link(link) +function link.flag_link(self, link) -- make it return link .. ".lib" end -- make the linkdir flag -function link.flag_linkdir(linkdir) +function link.flag_linkdir(self, linkdir) -- make it return "-libpath:" .. linkdir end -- the main function -function link.main(cmd) +function link.main(self, cmd) -- enter the vs environment local pathes = link._enter("path") diff --git a/xmake/scripts/platform/windows/tools/nmake.lua b/xmake/scripts/platform/windows/tools/nmake.lua index b7fc033c3..7d42dc706 100644 --- a/xmake/scripts/platform/windows/tools/nmake.lua +++ b/xmake/scripts/platform/windows/tools/nmake.lua @@ -68,18 +68,18 @@ function nmake._leave(name, old) end -- the init function -function nmake.init(name) +function nmake.init(self, name) -- save name - nmake._NAME = name or "nmake.exe" + self._NAME = name or "nmake.exe" -- is verbose? - nmake._VERBOSE = utils.ifelse(xmake._OPTIONS.verbose, "-v", "") + self._VERBOSE = utils.ifelse(xmake._OPTIONS.verbose, "-v", "") end -- the main function -function nmake.main(mkfile, target) +function nmake.main(self, mkfile, target) -- enter the vs environment local pathes = nmake._enter("path") @@ -90,9 +90,9 @@ function nmake.main(mkfile, target) -- make command local cmd = nil if mkfile and os.isfile(mkfile) then - cmd = string.format("%s /f %s %s VERBOSE=%s 2> %s", nmake._NAME, mkfile, target or "", nmake._VERBOSE, xmake._NULDEV) + cmd = string.format("%s /f %s %s VERBOSE=%s 2> %s", self._NAME, mkfile, target or "", self._VERBOSE, xmake._NULDEV) else - cmd = string.format("%s %s VERBOSE=%s 2> %s", nmake._NAME, target or "", nmake._VERBOSE, xmake._NULDEV) + cmd = string.format("%s %s VERBOSE=%s 2> %s", self._NAME, target or "", self._VERBOSE, xmake._NULDEV) end -- done |
