summaryrefslogtreecommitdiff
path: root/xmake/tools/cl.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-07-09 15:08:28 +0800
committerruki <[email protected]>2016-07-09 15:08:28 +0800
commit9feb387e4e4e6694b2c9ac3de4d517fb4c4ae44a (patch)
tree9581332e5365025b5663c3c48f223a9dfd6f415c /xmake/tools/cl.lua
parent460030d64886772601749b874f06fe536f1d3fd5 (diff)
fix install directory and modify compiler and linker interfaces
Diffstat (limited to 'xmake/tools/cl.lua')
-rwxr-xr-xxmake/tools/cl.lua30
1 files changed, 22 insertions, 8 deletions
diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua
index 70acc34e1..d9a145f8b 100755
--- a/xmake/tools/cl.lua
+++ b/xmake/tools/cl.lua
@@ -105,10 +105,24 @@ function includedir(dir)
end
-- make the complie command
-function compcmd(srcfile, objfile, flags)
+function compcmd(sourcefile, objectfile, flags)
-- make it
- return format("%s -c %s -Fo%s %s", _g.shellname, flags, objfile, srcfile)
+ return format("%s -c %s -Fo%s %s", _g.shellname, flags, objectfile, sourcefile)
+end
+
+-- complie the source file
+function compile(sourcefile, objectfile, flags, multitasking)
+
+ -- ensure the object directory
+ os.mkdir(path.directory(objectfile))
+
+ -- compile it
+ if multitasking then
+ os.corun(compcmd(sourcefile, objectfile, flags))
+ else
+ os.run(compcmd(sourcefile, objectfile, flags))
+ end
end
-- run command
@@ -122,15 +136,15 @@ end
function check(flags)
-- make an stub source file
- 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;}")
+ local objectfile = path.join(os.tmpdir(), "xmake.cl.obj")
+ local sourcefile = path.join(os.tmpdir(), "xmake.cl.c")
+ io.write(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
-- check it
- os.run("%s -c %s -Fo%s %s", _g.shellname, ifelse(flags, flags, ""), objfile, srcfile)
+ os.run("%s -c %s -Fo%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
-- remove files
- os.rm(objfile)
- os.rm(srcfile)
+ os.rm(objectfile)
+ os.rm(sourcefile)
end