summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform/windows/tools/cl.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-12 12:30:56 +0800
committerruki <[email protected]>2015-06-12 12:30:56 +0800
commit99b9eb72c8db9854311fc0b5a79e07f8cae85242 (patch)
tree837868dffc057d9a987ac4dc0592d98b015563c2 /xmake/scripts/platform/windows/tools/cl.lua
parent1678ef146c122b8a38a4485262f43b816230aa0f (diff)
modify platform and probe toolchains
Diffstat (limited to 'xmake/scripts/platform/windows/tools/cl.lua')
-rw-r--r--xmake/scripts/platform/windows/tools/cl.lua56
1 files changed, 9 insertions, 47 deletions
diff --git a/xmake/scripts/platform/windows/tools/cl.lua b/xmake/scripts/platform/windows/tools/cl.lua
index 879264e68..5ede4a0b0 100644
--- a/xmake/scripts/platform/windows/tools/cl.lua
+++ b/xmake/scripts/platform/windows/tools/cl.lua
@@ -27,43 +27,7 @@ local cl = cl or {}
local utils = require("base/utils")
local string = require("base/string")
local config = require("base/config")
-
--- enter the given environment
-function cl._enter(name)
-
- -- check
- assert(name)
-
- -- get the pathes for the vs environment
- local old = nil
- local new = config.get("__vsenv_" .. name)
- if new then
-
- -- get the current pathes
- old = os.getenv(name) or ""
-
- -- append the current pathes
- new = new .. ";" .. old
-
- -- update the pathes for the environment
- os.setenv(name, new)
- end
-
- -- return the previous environment
- return old;
-end
-
--- leave the given environment
-function cl._leave(name, old)
-
- -- check
- assert(name)
-
- -- restore the previous environment
- if old then
- os.setenv(name, old)
- end
-end
+local platform = require("platform/platform")
-- init the compiler
function cl.init(self, name)
@@ -146,20 +110,18 @@ end
-- the main function
function cl.main(self, cmd)
- -- enter the vs environment
- local pathes = cl._enter("path")
- local libs = cl._enter("lib")
- local includes = cl._enter("include")
- local libpathes = cl._enter("libpath")
+ -- the windows module
+ local windows = platform.module()
+ assert(windows)
+
+ -- enter envirnoment
+ windows.enter()
-- execute it
local ok = os.execute(cmd)
- -- leave the vs environment
- cl._leave("path", pathes)
- cl._leave("lib", libs)
- cl._leave("include", includes)
- cl._leave("libpath", libpathes)
+ -- leave envirnoment
+ windows.leave()
-- ok?
return utils.ifelse(ok == 0, true, false)