summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-23 10:54:03 +0800
committerruki <[email protected]>2016-05-23 10:54:03 +0800
commita1a5a8b7bf0e8b5e809bb03c72c4e5e0784dd39e (patch)
tree164d896f539d17d9de7f243bd83fa7cb795e7bf8 /xmake
parentc8454a31c38bbf25b56d0dd4a9a7c8d71ca59419 (diff)
add merge object tests
Diffstat (limited to 'xmake')
-rwxr-xr-xxmake/actions/build/builder.lua26
-rw-r--r--xmake/core/project/target.lua1
2 files changed, 18 insertions, 9 deletions
diff --git a/xmake/actions/build/builder.lua b/xmake/actions/build/builder.lua
index e9880eead..9027b5737 100755
--- a/xmake/actions/build/builder.lua
+++ b/xmake/actions/build/builder.lua
@@ -32,14 +32,22 @@ import("core.project.cache")
import("core.platform.environment")
-- build the object for the *.[o|obj] source file
-function _build_object_for_object(target, srcfile, objfile)
+function _build_object_for_object(target, sourcefile, objectfile, percent)
- -- TODO
- raise("not implemented")
+ -- trace
+ print("[%02d%%]: inserting.$(mode) %s", percent, sourcefile)
+
+ -- trace verbose info
+ if option.get("verbose") then
+ print("cp %s %s", sourcefile, objectfile)
+ end
+
+ -- insert this object file
+ os.cp(sourcefile, objectfile)
end
-- build the object for the *.[a|lib] source file
-function _build_object_for_static(target, srcfile, objfile)
+function _build_object_for_static(target, sourcefile, objectfile, percent)
raise("not implemented")
-- TODO
@@ -64,12 +72,15 @@ function _build_object(target, index)
-- get the source file type
local filetype = path.extension(sourcefile):lower()
+ -- calculate percent
+ local percent = ((_g.targetindex + (index - 1) / #objectfiles) * 100 / _g.targetcount)
+
-- build the object for the *.o/obj source makefile
if filetype == ".o" or filetype == ".obj" then
- return _build_object_for_object(target, sourcefile, objectfile)
+ return _build_object_for_object(target, sourcefile, objectfile, percent)
-- build the object for the *.[a|lib] source file
elseif filetype == ".a" or filetype == ".lib" then
- return _build_object_for_static(target, sourcefile, objectfile)
+ return _build_object_for_static(target, sourcefile, objectfile, percent)
end
-- make command
@@ -79,9 +90,6 @@ function _build_object(target, index)
command = ccache:append(command, " ")
end
- -- calculate percent
- local percent = ((_g.targetindex + (index - 1) / #objectfiles) * 100 / _g.targetcount)
-
-- trace
print("[%02d%%]: %scompiling.$(mode) %s", percent, ifelse(ccache, "ccache ", ""), sourcefile)
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 547dbbb61..8a27e9ec1 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -26,6 +26,7 @@ local target = target or {}
-- load modules
local os = require("base/os")
local path = require("base/path")
+local utils = require("base/utils")
local table = require("base/table")
local option = require("project/option")
local config = require("project/config")