Skip to content

Commit

Permalink
fix check -subsystem:windows
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Jul 5, 2016
1 parent 014f21c commit 33d0208
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions xmake/tools/link.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ function init(shellname)
_g.mapflags =
{
-- strip
["-s"] = ""
, ["-S"] = ""
["-s"] = ""
, ["-S"] = ""

-- others
, ["-ftrapv"] = ""
, ["-fsanitize=address"] = ""
, ["-ftrapv"] = ""
, ["-fsanitize=address"] = ""
}
end

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 33d0208

Please sign in to comment.