diff options
| author | ruki <[email protected]> | 2015-06-16 18:27:00 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-16 18:27:00 +0800 |
| commit | d549aaedf96e6d6eb77e9d588dc0a0269cd1ae71 (patch) | |
| tree | 51d971fe326561b62895743a38a1544af6df2dff /xmake/scripts/platform/windows | |
| parent | 608602d0de1056f856e0b6bfe33b3f5fbe641b63 (diff) | |
fix the command is too long for nmake
Diffstat (limited to 'xmake/scripts/platform/windows')
| -rw-r--r-- | xmake/scripts/platform/windows/prober.lua | 4 | ||||
| -rw-r--r-- | xmake/scripts/platform/windows/tools/cl.lua | 12 | ||||
| -rw-r--r-- | xmake/scripts/platform/windows/tools/link.lua | 20 | ||||
| -rw-r--r-- | xmake/scripts/platform/windows/tools/nmake.lua | 4 |
4 files changed, 30 insertions, 10 deletions
diff --git a/xmake/scripts/platform/windows/prober.lua b/xmake/scripts/platform/windows/prober.lua index 764669a27..f4aacf9d2 100644 --- a/xmake/scripts/platform/windows/prober.lua +++ b/xmake/scripts/platform/windows/prober.lua @@ -236,8 +236,8 @@ function prober._probe_toolchains(configs) if not prober._probe_toolpath(configs, "cc", "cl.exe", "the c compiler") then return false end if not prober._probe_toolpath(configs, "cxx", "cl.exe", "the c++ compiler") then return false end if not prober._probe_toolpath(configs, "ld", "link.exe", "the linker") then return false end - if not prober._probe_toolpath(configs, "ar", "link.exe", "the static library linker") then return false end - if not prober._probe_toolpath(configs, "sh", "link.exe", "the shared library linker") then return false end + if not prober._probe_toolpath(configs, "ar", "link.exe -lib", "the static library linker") then return false end + if not prober._probe_toolpath(configs, "sh", "link.exe -dll", "the shared library linker") then return false end if not prober._probe_toolpath(configs, "make", "nmake.exe", "the make") then return false end -- leave envirnoment diff --git a/xmake/scripts/platform/windows/tools/cl.lua b/xmake/scripts/platform/windows/tools/cl.lua index 0d94f7800..e6306fccb 100644 --- a/xmake/scripts/platform/windows/tools/cl.lua +++ b/xmake/scripts/platform/windows/tools/cl.lua @@ -55,6 +55,10 @@ function cl.init(self, name) , ["-fvisibility=.*"] = "" -- warnings + , ["-Wall"] = "-Wall" + , ["-W1"] = "-W1" + , ["-W2"] = "-W2" + , ["-W3"] = "-W3" , ["-Werror"] = "-WX" , ["%-Wno%-error=.*"] = "" @@ -80,10 +84,14 @@ function cl.init(self, name) end -- make the compiler command -function cl.command_compile(self, srcfile, objfile, flags) +function cl.command_compile(self, srcfile, objfile, flags, logfile) + + -- redirect + local redirect = "" + if logfile then redirect = string.format(" > %s 2>&1", logfile) end -- make it - return string.format("%s -c %s -Fo%s %s", self._NAME, flags, objfile, srcfile) + return string.format("%s -c %s -Fo%s %s%s", self._NAME, flags, objfile, srcfile, redirect) end -- make the define flag diff --git a/xmake/scripts/platform/windows/tools/link.lua b/xmake/scripts/platform/windows/tools/link.lua index 7eb56ffc9..06be1ac47 100644 --- a/xmake/scripts/platform/windows/tools/link.lua +++ b/xmake/scripts/platform/windows/tools/link.lua @@ -52,10 +52,10 @@ function link.init(self, name) , flags_arch} -- init arflags - self.arflags = {"-lib", "-nologo", flags_arch} + self.arflags = {"-nologo", flags_arch} -- init shflags - self.shflags = {"-dll", "-nologo", flags_arch} + self.shflags = {"-nologo", flags_arch} -- init flags map self.mapflags = @@ -73,10 +73,22 @@ function link.init(self, name) end -- make the linker command -function link.command_link(self, objfiles, targetfile, flags) +function link.command_link(self, objfiles, targetfile, flags, logfile) + + -- redirect + local redirect = "" + if logfile then redirect = string.format(" > %s 2>&1", logfile) end -- make it - return string.format("%s %s -out:%s %s", self._NAME, flags, targetfile, objfiles) + local cmd = string.format("%s %s -out:%s %s%s", self._NAME, flags, targetfile, objfiles, redirect) + + -- too long? + if #cmd > 256 then + cmd = string.format("%s%s @<<\n%s -out:%s %s\n<<", self._NAME, redirect, flags, targetfile, objfiles) + end + + -- ok? + return cmd end -- make the link flag diff --git a/xmake/scripts/platform/windows/tools/nmake.lua b/xmake/scripts/platform/windows/tools/nmake.lua index f84f9ee6f..0ba2e32e3 100644 --- a/xmake/scripts/platform/windows/tools/nmake.lua +++ b/xmake/scripts/platform/windows/tools/nmake.lua @@ -55,9 +55,9 @@ function nmake.main(self, 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", self._NAME, mkfile, target or "", self._VERBOSE, xmake._NULDEV) + cmd = string.format("%s /nologo /f %s %s VERBOSE=%s", self._NAME, mkfile, target or "", self._VERBOSE) else - cmd = string.format("%s %s VERBOSE=%s 2> %s", self._NAME, target or "", self._VERBOSE, xmake._NULDEV) + cmd = string.format("%s /nologo %s VERBOSE=%s", self._NAME, target or "", self._VERBOSE) end -- done |
