summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox
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/core/sandbox
parent460030d64886772601749b874f06fe536f1d3fd5 (diff)
fix install directory and modify compiler and linker interfaces
Diffstat (limited to 'xmake/core/sandbox')
-rw-r--r--xmake/core/sandbox/modules/import/core/tool/compiler.lua16
-rw-r--r--xmake/core/sandbox/modules/import/core/tool/linker.lua16
2 files changed, 32 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/import/core/tool/compiler.lua b/xmake/core/sandbox/modules/import/core/tool/compiler.lua
index bf231f7b4..71059ad16 100644
--- a/xmake/core/sandbox/modules/import/core/tool/compiler.lua
+++ b/xmake/core/sandbox/modules/import/core/tool/compiler.lua
@@ -41,5 +41,21 @@ function sandbox_core_tool_compiler.compcmd(sourcefile, objectfile, target)
return instance:compcmd(sourcefile, objectfile, target)
end
+-- compile source file
+function sandbox_core_tool_compiler.compile(sourcefile, objectfile, target, multitasking)
+
+ -- get the compiler instance
+ local instance, errors = compiler.load(compiler.kind_of_file(sourcefile))
+ if not instance then
+ raise(errors)
+ end
+
+ -- compile it
+ local ok, errors = instance:compile(sourcefile, objectfile, target, multitasking)
+ if not ok then
+ raise(errors)
+ end
+end
+
-- return module
return sandbox_core_tool_compiler
diff --git a/xmake/core/sandbox/modules/import/core/tool/linker.lua b/xmake/core/sandbox/modules/import/core/tool/linker.lua
index 9f42a04e7..5f9a32f96 100644
--- a/xmake/core/sandbox/modules/import/core/tool/linker.lua
+++ b/xmake/core/sandbox/modules/import/core/tool/linker.lua
@@ -41,5 +41,21 @@ function sandbox_core_tool_linker.linkcmd(objectfiles, targetfile, target)
return instance:linkcmd(objectfiles, targetfile, target)
end
+-- link target file
+function sandbox_core_tool_linker.link(objectfiles, targetfile, target)
+
+ -- get the linker instance
+ local instance, errors = linker.load(target:get("kind"))
+ if not instance then
+ raise(errors)
+ end
+
+ -- link it
+ local ok, errors = instance:link(objectfiles, targetfile, target)
+ if not ok then
+ raise(errors)
+ end
+end
+
-- return module
return sandbox_core_tool_linker