summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-03-21 21:50:35 +0800
committerruki <[email protected]>2016-03-21 21:50:35 +0800
commitd1f010fc5582cdaabb2ed758b2aaf7ffa5a95a43 (patch)
treed71bacbac82886d60e67ea8747de864d69dacf0f /xmake/core/project/target.lua
parent308b4d3661fad938dae830ee357778f85918f963 (diff)
add tool module for sandbox
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua23
1 files changed, 22 insertions, 1 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 68dfefe3a..4fef8fbd6 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -30,6 +30,7 @@ local table = require("base/table")
local option = require("project/option")
local config = require("project/config")
local linker = require("platform/linker")
+local compiler = require("platform/compiler")
local platform = require("platform/platform")
-- get the filename from the given name and kind
@@ -62,9 +63,12 @@ function target.name(self)
return self._NAME
end
--- get the linker with the target kind
+-- get the linker
function target.linker(self)
+ -- check
+ assert(self)
+
-- init the linker from the given kind
local result = linker.init(self:get("kind"))
if not result then
@@ -76,6 +80,23 @@ function target.linker(self)
end
+-- get the compiler with the given source file
+function target.compiler(self, srcfile)
+
+ -- check
+ assert(self and srcfile)
+
+ -- init the linker from the given kind
+ local result, errors = compiler.init(srcfile)
+ if not result then
+ os.raise(errors)
+ end
+
+ -- ok?
+ return result
+
+end
+
-- get the options
function target.options(self)