diff options
| author | ruki <[email protected]> | 2017-04-12 14:30:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-04-12 14:30:18 +0800 |
| commit | d3604af304e6acd9ea32167750373eb94bfa6df0 (patch) | |
| tree | cd05b0d187a684ff33b462b584560c61df05c308 /xmake/tools/gcc.lua | |
| parent | 1c4b2c9caea676c34d7f0c05b2ea66b8deca9b20 (diff) | |
fix check android compiler error
Diffstat (limited to 'xmake/tools/gcc.lua')
| -rw-r--r-- | xmake/tools/gcc.lua | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/xmake/tools/gcc.lua b/xmake/tools/gcc.lua index 06156ffff..b29904b56 100644 --- a/xmake/tools/gcc.lua +++ b/xmake/tools/gcc.lua @@ -250,7 +250,7 @@ function nf_rpathdir(dir) _g._RPATH = try { function () - check(flag) + check(flag, true) return true end } @@ -399,20 +399,26 @@ function compile(sourcefiles, objectfile, incdepfile, flags) end -- check the given flags -function check(flags) +function check(flags, trylink) -- make an stub source file local binaryfile = os.tmpfile() .. ".b" + local objectfile = os.tmpfile() .. ".o" local sourcefile = os.tmpfile() .. ".c" .. ifelse(_g.kind == "cxx", "pp", "") -- make stub code io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}") -- check it, need check compflags and linkflags - os.run("%s %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), binaryfile, sourcefile) + if trylink then + os.run("%s %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), binaryfile, sourcefile) + else + os.run("%s -c %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), binaryfile, sourcefile) + end -- remove files - os.rm(binaryfile) - os.rm(sourcefile) + os.tryrm(binaryfile) + os.tryrm(objectfile) + os.tryrm(sourcefile) end |
