summaryrefslogtreecommitdiff
path: root/xmake/core/platform
diff options
context:
space:
mode:
authorruki <[email protected]>2016-03-16 10:41:57 +0800
committerruki <[email protected]>2016-03-16 10:41:57 +0800
commit566d33d6be83884239cce7df0655e60ec00bd836 (patch)
tree79409e657888768fe28fa2ad3af0a52cb7d355ee /xmake/core/platform
parent5862427be483f6747d88d3a79121e2a4f2a27670 (diff)
load project
Diffstat (limited to 'xmake/core/platform')
-rw-r--r--xmake/core/platform/compiler.lua6
-rw-r--r--xmake/core/platform/platforms/windows/prober.lua2
-rw-r--r--xmake/core/platform/tool.lua17
-rw-r--r--xmake/core/platform/tools/clang.lua2
-rw-r--r--xmake/core/platform/tools/g++.lua2
5 files changed, 17 insertions, 12 deletions
diff --git a/xmake/core/platform/compiler.lua b/xmake/core/platform/compiler.lua
index 04932dda2..96171003b 100644
--- a/xmake/core/platform/compiler.lua
+++ b/xmake/core/platform/compiler.lua
@@ -465,7 +465,7 @@ function compiler.check_include(opt, include, srcpath, objpath)
assert(opt and srcpath and objpath)
-- open the checking source file
- local srcfile = io.openmk(srcpath)
+ local srcfile = io.open(srcpath, "w")
if not srcfile then return end
-- make include
@@ -497,7 +497,7 @@ function compiler.check_function(opt, interface, srcpath, objpath)
assert(opt and interface)
-- open the checking source file
- local srcfile = io.openmk(srcpath)
+ local srcfile = io.open(srcpath, "w")
if not srcfile then return end
-- get the compiler
@@ -541,7 +541,7 @@ function compiler.check_typedef(opt, typedef, srcpath, objpath)
assert(opt and typedef)
-- open the checking source file
- local srcfile = io.openmk(srcpath)
+ local srcfile = io.open(srcpath, "w")
if not srcfile then return end
-- get the compiler
diff --git a/xmake/core/platform/platforms/windows/prober.lua b/xmake/core/platform/platforms/windows/prober.lua
index 5ed3c9c50..2c1726ac9 100644
--- a/xmake/core/platform/platforms/windows/prober.lua
+++ b/xmake/core/platform/platforms/windows/prober.lua
@@ -164,7 +164,7 @@ function prober._probe_vs_path(configs)
-- make the call(vcvarsall.bat) file
local callpath = tmpdir .. "\\call_vcvarsall.bat"
- local callfile = io.openmk(callpath)
+ local callfile = io.open(callpath, "w")
assert(callfile)
-- make call scripts
diff --git a/xmake/core/platform/tool.lua b/xmake/core/platform/tool.lua
index 36047f410..479d7a38e 100644
--- a/xmake/core/platform/tool.lua
+++ b/xmake/core/platform/tool.lua
@@ -157,19 +157,24 @@ function tool.load(name, root)
local script, errors = loadfile(toolpath)
if script then
- -- load tool
- local tool = script()
+ -- load tool
+ local ok, result = pcall(script)
+ if not ok then
+ utils.error(result)
+ utils.error("load %s failed!", toolpath)
+ assert(false)
+ end
-- init tool
- if tool and tool.init then
- tool:init(name)
+ if result and result.init then
+ result:init(name)
end
-- save tool to the cache
- tool._TOOLS[name] = tool
+ tool._TOOLS[name] = result
-- ok?
- return tool
+ return result
else
utils.error(errors)
utils.error("load %s failed!", toolpath)
diff --git a/xmake/core/platform/tools/clang.lua b/xmake/core/platform/tools/clang.lua
index c4c8586f5..8cff2dab5 100644
--- a/xmake/core/platform/tools/clang.lua
+++ b/xmake/core/platform/tools/clang.lua
@@ -21,7 +21,7 @@
--
-- load modules
-local gcc = require("tools/gcc")
+local gcc = require("platform/tools/gcc")
-- define module: clang
local clang = clang or {}
diff --git a/xmake/core/platform/tools/g++.lua b/xmake/core/platform/tools/g++.lua
index d61e511eb..82dc7f627 100644
--- a/xmake/core/platform/tools/g++.lua
+++ b/xmake/core/platform/tools/g++.lua
@@ -21,7 +21,7 @@
--
-- load modules
-local gcc = require("tools/gcc")
+local gcc = require("platform/tools/gcc")
-- define module: gxx
local gxx = gxx or {}