summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-07-05 21:16:21 +0800
committerruki <[email protected]>2016-07-05 21:16:21 +0800
commit33d020825c90d656d1d1a504039e7d9781784e8b (patch)
treef30e39ae9932cd8de341e81c86cde85a65bb9ae5
parent014f21c729cdab110bcc0a712084c50162f08f39 (diff)
fix check -subsystem:windows
-rwxr-xr-xxmake/tools/link.lua16
1 files 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)