From 33d020825c90d656d1d1a504039e7d9781784e8b Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 5 Jul 2016 21:16:21 +0800 Subject: fix check -subsystem:windows --- xmake/tools/link.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xmake/tools/link.lua b/xmake/tools/link.lua index 15d377a55..ee3c23972 100755 --- a/xmake/tools/link.lua +++ b/xmake/tools/link.lua @@ -53,12 +53,12 @@ function init(shellname) _g.mapflags = { -- strip - ["-s"] = "" - , ["-S"] = "" + ["-s"] = "" + , ["-S"] = "" -- others - , ["-ftrapv"] = "" - , ["-fsanitize=address"] = "" + , ["-ftrapv"] = "" + , ["-fsanitize=address"] = "" } end @@ -114,7 +114,13 @@ function check(flags) local exefile = path.join(os.tmpdir(), "xmake.cl.exe") local objfile = path.join(os.tmpdir(), "xmake.cl.obj") local srcfile = path.join(os.tmpdir(), "xmake.cl.c") - io.write(srcfile, "int main(int argc, char** argv)\n{return 0;}") + + -- main entry + if flags and flags:lower():find("subsystem:windows") then + io.write(srcfile, "int WinMain(void* instance, void* previnst, char** argv, int argc)\n{return 0;}") + else + io.write(srcfile, "int main(int argc, char** argv)\n{return 0;}") + end -- check it os.run("cl -c -Fo%s %s", objfile, srcfile) -- cgit v1.3.1