summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-05-08 22:46:38 +0800
committerruki <[email protected]>2018-05-08 10:39:52 +0800
commitc61545b0275b64c8b0294ce69e635e30475a2239 (patch)
tree0eba3c71f7065c5546f059e755f1ac869d4ac4fd
parent5a1eebb5b49e7476ceb773d9b846c0c61c9f99c8 (diff)
improve build dependence
-rw-r--r--tests/projects/c/static_library/src/interface.c2
-rw-r--r--tests/projects/c/static_library/src/interface.h3
-rw-r--r--tests/projects/c/static_library/src/test.c2
-rw-r--r--xmake/actions/build/builder.lua3
-rw-r--r--xmake/actions/build/kinds/binary.lua81
-rw-r--r--xmake/actions/build/kinds/object.lua92
-rw-r--r--xmake/actions/build/kinds/shared.lua84
-rw-r--r--xmake/actions/build/kinds/static.lua79
-rw-r--r--xmake/core/tool/compiler.lua2
-rw-r--r--xmake/modules/core/project/depend.lua94
-rw-r--r--xmake/modules/core/tools/cl.lua13
-rw-r--r--xmake/modules/core/tools/dmd.lua2
-rw-r--r--xmake/modules/core/tools/gcc.lua11
-rw-r--r--xmake/modules/core/tools/go.lua2
-rw-r--r--xmake/modules/core/tools/ml.lua6
-rw-r--r--xmake/modules/core/tools/nvcc.lua6
-rw-r--r--xmake/modules/core/tools/rc.lua6
-rw-r--r--xmake/modules/core/tools/rustc.lua2
-rw-r--r--xmake/modules/core/tools/swiftc.lua6
-rw-r--r--xmake/modules/core/tools/tcc.lua6
-rw-r--r--xmake/modules/core/tools/yasm.lua6
21 files changed, 202 insertions, 306 deletions
diff --git a/tests/projects/c/static_library/src/interface.c b/tests/projects/c/static_library/src/interface.c
index 598d07560..8ed513871 100644
--- a/tests/projects/c/static_library/src/interface.c
+++ b/tests/projects/c/static_library/src/interface.c
@@ -1,5 +1,5 @@
#include "interface.h"
-
+
int add(int a, int b)
{
return a + b;
diff --git a/tests/projects/c/static_library/src/interface.h b/tests/projects/c/static_library/src/interface.h
index 10ec0f856..915f44b87 100644
--- a/tests/projects/c/static_library/src/interface.h
+++ b/tests/projects/c/static_library/src/interface.h
@@ -4,5 +4,6 @@
* @param b the second argument
*
* @return the result
- */
+ */
int add(int a, int b);
+
diff --git a/tests/projects/c/static_library/src/test.c b/tests/projects/c/static_library/src/test.c
index 9505a2f75..d438027e8 100644
--- a/tests/projects/c/static_library/src/test.c
+++ b/tests/projects/c/static_library/src/test.c
@@ -1,6 +1,6 @@
#include "interface.h"
#include <stdio.h>
-
+
int main(int argc, char** argv)
{
printf("add(1, 2) = %d\n", add(1, 2));
diff --git a/xmake/actions/build/builder.lua b/xmake/actions/build/builder.lua
index e34067230..b8ad09fdc 100644
--- a/xmake/actions/build/builder.lua
+++ b/xmake/actions/build/builder.lua
@@ -178,9 +178,6 @@ function build(targetname, rebuild)
-- clear finished states
_g.finished = {}
- -- clear modified states
- _g.modified = {}
-
-- init target index
_g.targetindex = 0
diff --git a/xmake/actions/build/kinds/binary.lua b/xmake/actions/build/kinds/binary.lua
index 9967d3070..2408ef8a3 100644
--- a/xmake/actions/build/kinds/binary.lua
+++ b/xmake/actions/build/kinds/binary.lua
@@ -26,57 +26,9 @@
import("core.base.option")
import("core.tool.linker")
import("core.tool.compiler")
+import("core.project.depend")
import("object")
--- is modified?
-function _is_modified(target, depfile, buildinfo, program, linkflags)
-
- -- the target file not exists?
- if not os.isfile(target:targetfile()) then
- return true
- end
-
- -- this target and it's deps are not modified?
- local modified = buildinfo.rebuild or buildinfo.modified[target:name()]
- if modified then
- return true
- end
-
- -- deps modified?
- for _, depname in ipairs(target:get("deps")) do
- if buildinfo.modified[depname] then
- return true
- end
- end
-
- -- get dependent info
- local depinfo = {}
- if os.isfile(depfile) then
- depinfo = io.load(depfile) or {}
- end
-
- -- the program has been modified?
- if program ~= depinfo.program then
- return true
- end
-
- -- the flags has been modified?
- if os.args(linkflags) ~= os.args(depinfo.flags) then
- return true
- end
-
- -- the object files list has been modified?
- local objectfiles = target:objectfiles()
- if #(objectfiles or {}) ~= #(depinfo.objectfiles or {}) then
- return true
- end
- for idx, objectfile in ipairs(depinfo.objectfiles) do
- if objectfile ~= objectfiles[idx] then
- return true
- end
- end
-end
-
-- build target from sources
function _build_from_objects(target, buildinfo)
@@ -86,21 +38,21 @@ function _build_from_objects(target, buildinfo)
-- load linker instance
local linker_instance = linker.load(target:targetkind(), target:sourcekinds(), {target = target})
- -- get program
- local program = linker_instance:program()
-
-- get link flags
local linkflags = linker_instance:linkflags({target = target})
- -- this target and it's deps are not modified?
- local depfile = target:dependfile()
- local modified = _is_modified(target, depfile, buildinfo, program, linkflags)
- if not modified then
- return
+ -- load dependent info
+ local dependinfo = {}
+ local dependfile = target:dependfile()
+ if not buildinfo.rebuild then
+ dependinfo = depend.load(dependfile) or {}
end
- -- clear the previous dependent info first
- io.save(depfile, {})
+ -- need build this target?
+ local depvalues = {linker_instance:program(), linkflags}
+ if not buildinfo.rebuild and not depend.is_changed(dependinfo, {lastmtime = os.mtime(target:targetfile()), values = depvalues}) then
+ return
+ end
-- expand object files with *.o/obj
local objectfiles = {}
@@ -140,8 +92,15 @@ function _build_from_objects(target, buildinfo)
-- link it
assert(linker_instance:link(objectfiles, targetfile, {linkflags = linkflags}))
- -- save program and flags to the dependent file
- io.save(depfile, {program = program, flags = linkflags, objectfiles = target:objectfiles()})
+ -- update files and values to the dependent file
+ dependinfo.values = depvalues
+ dependinfo.files = target:objectfiles()
+ for _, dep in pairs(target:deps()) do
+ if dep:targetkind() == "static" then
+ table.insert(dependinfo.files, dep:targetfile())
+ end
+ end
+ depend.save(dependinfo, dependfile)
end
-- build target from sources
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index 592f78a9c..9734363eb 100644
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -28,60 +28,11 @@ import("core.tool.compiler")
import("core.tool.extractor")
import("core.project.rule")
import("core.project.config")
+import("core.project.depend")
import("core.project.project")
import("core.language.language")
import("detect.tools.find_ccache")
--- is modified?
-function _is_modified(target, sourcefile, objectfile, depinfo, buildinfo, program, compflags)
-
- -- rebuild?
- if buildinfo.rebuild then
- return true
- end
-
- -- get the dependent files
- local depfiles = table.join(depinfo.sources or {}, depinfo.includes or {})
-
- -- check the dependent files are modified?
- local modified = false
- local objectmtime = nil
- _g.depfile_results = _g.depfile_results or {}
- for _, depfile in ipairs(depfiles) do
-
- -- optimization: this depfile has been not checked?
- local status = _g.depfile_results[depfile]
- if status == nil then
-
- -- optimization: only uses the mtime of first object file
- objectmtime = objectmtime or os.mtime(objectfile)
-
- -- source and header files have been modified?
- if os.mtime(depfile) > objectmtime then
-
- -- mark this depfile as modified
- _g.depfile_results[depfile] = true
- return true
- end
-
- -- mark this depfile as not modified
- _g.depfile_results[depfile] = false
-
- -- has been checked and modified?
- elseif status then
- return true
- end
- end
-
- -- the program has been modified?
- if program ~= depinfo.program then
- return true
- end
-
- -- the flags has been modified?
- return os.args(compflags) ~= os.args(depinfo.flags)
-end
-
-- build the object from the *.[o|obj] source file
function _build_from_object(target, sourcefile, objectfile, percent)
@@ -152,30 +103,24 @@ function _build_object(target, buildinfo, index, sourcebatch, ccache)
return _build_from_static(target, sourcefile, objectfile, percent)
end
- -- get dependent info
- local depinfo = {}
- if not buildinfo.rebuild and os.isfile(dependfile) then
- depinfo = io.load(dependfile) or {}
+ -- load dependent info
+ local dependinfo = {}
+ if not buildinfo.rebuild then
+ dependinfo = depend.load(dependfile) or {}
end
-- load compiler instance
local compiler_instance = compiler.load(sourcekind, {target = target})
- -- get compiler program
- local program = compiler_instance:program()
-
-- get compile flags
local compflags = compiler_instance:compflags({target = target, sourcefile = sourcefile})
- -- is modified?
- local modified = _is_modified(target, sourcefile, objectfile, depinfo, buildinfo, program, compflags)
- if not modified then
+ -- need build this object?
+ local depvalues = {compiler_instance:program(), compflags}
+ if not buildinfo.rebuild and not depend.is_changed(dependinfo, {lastmtime = os.mtime(objectfile), values = depvalues}) then
return
end
- -- mark this target as modified
- buildinfo.modified[target:name()] = true
-
-- is verbose?
local verbose = option.get("verbose")
@@ -195,19 +140,13 @@ function _build_object(target, buildinfo, index, sourcebatch, ccache)
io.flush()
-- complie it
- assert(compiler_instance:compile(sourcefile, objectfile, {depinfo = depinfo, compflags = compflags}))
-
- -- save sources to the dependent info
- depinfo.sources = table.join(sourcefile, target:pcheaderfile("cxx") or {}, target:pcheaderfile("c"))
-
- -- save program to the dependent info
- depinfo.program = program
+ dependinfo.files = {}
+ assert(compiler_instance:compile(sourcefile, objectfile, {dependinfo = dependinfo, compflags = compflags}))
- -- save flags to the dependent info
- depinfo.flags = compflags
-
- -- save the dependent info
- io.save(dependfile, depinfo)
+ -- update files and values to the dependent file
+ dependinfo.values = depvalues
+ table.join2(dependinfo.files, sourcefile, target:pcheaderfile("cxx") or {}, target:pcheaderfile("c"))
+ depend.save(dependinfo, dependfile)
end
-- build each objects from the given source batch
@@ -259,9 +198,6 @@ function _build_single_object(target, buildinfo, sourcekind, sourcebatch, jobs,
print(compiler.compcmd(sourcefiles, objectfiles, {target = target, sourcekind = sourcekind}))
end
- -- mark this target as modified
- buildinfo.modified[target:name()] = true
-
-- complie them
compiler.compile(sourcefiles, objectfiles, {dependfiles = dependfiles, target = target, sourcekind = sourcekind})
diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua
index 0ec1ac3a5..043e3dc36 100644
--- a/xmake/actions/build/kinds/shared.lua
+++ b/xmake/actions/build/kinds/shared.lua
@@ -26,57 +26,9 @@
import("core.base.option")
import("core.tool.linker")
import("core.tool.compiler")
+import("core.project.depend")
import("object")
--- is modified?
-function _is_modified(target, depfile, buildinfo, program, linkflags)
-
- -- the target file not exists?
- if not os.isfile(target:targetfile()) then
- return true
- end
-
- -- this target and it's deps are not modified?
- local modified = buildinfo.rebuild or buildinfo.modified[target:name()]
- if modified then
- return true
- end
-
- -- deps modified?
- for _, depname in ipairs(target:get("deps")) do
- if buildinfo.modified[depname] then
- return true
- end
- end
-
- -- get dependent info
- local depinfo = {}
- if os.isfile(depfile) then
- depinfo = io.load(depfile) or {}
- end
-
- -- the program has been modified?
- if program ~= depinfo.program then
- return true
- end
-
- -- the flags has been modified?
- if os.args(linkflags) ~= os.args(depinfo.flags) then
- return true
- end
-
- -- the object files list has been modified?
- local objectfiles = target:objectfiles()
- if #(objectfiles or {}) ~= #(depinfo.objectfiles or {}) then
- return true
- end
- for idx, objectfile in ipairs(depinfo.objectfiles) do
- if objectfile ~= objectfiles[idx] then
- return true
- end
- end
-end
-
-- build target from objects
function _build_from_objects(target, buildinfo)
@@ -86,24 +38,21 @@ function _build_from_objects(target, buildinfo)
-- load linker instance
local linker_instance = linker.load(target:targetkind(), target:sourcekinds(), {target = target})
- -- get program
- local program = linker_instance:program()
-
-- get link flags
local linkflags = linker_instance:linkflags({target = target})
- -- this target and it's deps are not modified?
- local depfile = target:dependfile()
- local modified = _is_modified(target, depfile, buildinfo, program, linkflags)
- if not modified then
- return
+ -- load dependent info
+ local dependinfo = {}
+ local dependfile = target:dependfile()
+ if not buildinfo.rebuild then
+ dependinfo = depend.load(dependfile) or {}
end
- -- mark this target as modified
- buildinfo.modified[target:name()] = true
-
- -- clear the previous dependent info first
- io.save(depfile, {})
+ -- need build this target?
+ local depvalues = {linker_instance:program(), linkflags}
+ if not buildinfo.rebuild and not depend.is_changed(dependinfo, {lastmtime = os.mtime(target:targetfile()), values = depvalues}) then
+ return
+ end
-- make headers
local srcheaders, dstheaders = target:headerfiles()
@@ -156,8 +105,15 @@ function _build_from_objects(target, buildinfo)
-- link it
assert(linker_instance:link(objectfiles, targetfile, {linkflags = linkflags}))
- -- save program and flags to the dependent file
- io.save(depfile, {program = program, flags = linkflags, objectfiles = target:objectfiles()})
+ -- update files and values to the dependent file
+ dependinfo.values = depvalues
+ dependinfo.files = target:objectfiles()
+ for _, dep in pairs(target:deps()) do
+ if dep:targetkind() == "static" then
+ table.insert(dependinfo.files, dep:targetfile())
+ end
+ end
+ depend.save(dependinfo, dependfile)
end
-- build target from sources
diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua
index f2251a81d..8606606d6 100644
--- a/xmake/actions/build/kinds/static.lua
+++ b/xmake/actions/build/kinds/static.lua
@@ -26,57 +26,9 @@
import("core.base.option")
import("core.tool.linker")
import("core.tool.compiler")
+import("core.project.depend")
import("object")
--- is modified?
-function _is_modified(target, depfile, buildinfo, program, linkflags)
-
- -- the target file not exists?
- if not os.isfile(target:targetfile()) then
- return true
- end
-
- -- this target and it's deps are not modified?
- local modified = buildinfo.rebuild or buildinfo.modified[target:name()]
- if modified then
- return true
- end
-
- -- deps modified?
- for _, depname in ipairs(target:get("deps")) do
- if buildinfo.modified[depname] then
- return true
- end
- end
-
- -- get dependent info
- local depinfo = {}
- if os.isfile(depfile) then
- depinfo = io.load(depfile) or {}
- end
-
- -- the program has been modified?
- if program ~= depinfo.program then
- return true
- end
-
- -- the flags has been modified?
- if os.args(linkflags) ~= os.args(depinfo.flags) then
- return true
- end
-
- -- the object files list has been modified?
- local objectfiles = target:objectfiles()
- if #(objectfiles or {}) ~= #(depinfo.objectfiles or {}) then
- return true
- end
- for idx, objectfile in ipairs(depinfo.objectfiles) do
- if objectfile ~= objectfiles[idx] then
- return true
- end
- end
-end
-
-- build target from objects
function _build_from_objects(target, buildinfo)
@@ -86,24 +38,21 @@ function _build_from_objects(target, buildinfo)
-- load linker instance
local linker_instance = linker.load(target:targetkind(), target:sourcekinds(), {target = target})
- -- get program
- local program = linker_instance:program()
-
-- get link flags
local linkflags = linker_instance:linkflags({target = target})
- -- this target and it's deps are not modified?
- local depfile = target:dependfile()
- local modified = _is_modified(target, depfile, buildinfo, program, linkflags)
- if not modified then
- return
+ -- load dependent info
+ local dependinfo = {}
+ local dependfile = target:dependfile()
+ if not buildinfo.rebuild then
+ dependinfo = depend.load(dependfile) or {}
end
- -- mark this target as modified
- buildinfo.modified[target:name()] = true
-
- -- clear the previous dependent info first
- io.save(depfile, {})
+ -- need build this target?
+ local depvalues = {linker_instance:program(), linkflags}
+ if not buildinfo.rebuild and not depend.is_changed(dependinfo, {lastmtime = os.mtime(target:targetfile()), values = depvalues}) then
+ return
+ end
-- make headers
local srcheaders, dstheaders = target:headerfiles()
@@ -156,8 +105,10 @@ function _build_from_objects(target, buildinfo)
-- link it
assert(linker_instance:link(objectfiles, targetfile, {linkflags = linkflags}))
- -- save program and flags to the dependent file
- io.save(depfile, {program = program, flags = linkflags, objectfiles = target:objectfiles()})
+ -- update files and values to the dependent file
+ dependinfo.values = depvalues
+ dependinfo.files = target:objectfiles()
+ depend.save(dependinfo, dependfile)
end
-- build target from sources
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index b69b3ba93..34334bf95 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -217,7 +217,7 @@ function compiler:compile(sourcefiles, objectfile, opt)
end
-- compile it
- return sandbox.load(self:_tool().compile, self:_tool(), sourcefiles, objectfile, opt.depinfo, compflags)
+ return sandbox.load(self:_tool().compile, self:_tool(), sourcefiles, objectfile, opt.dependinfo, compflags)
end
-- get the compile arguments list
diff --git a/xmake/modules/core/project/depend.lua b/xmake/modules/core/project/depend.lua
new file mode 100644
index 000000000..cbb3d1bd8
--- /dev/null
+++ b/xmake/modules/core/project/depend.lua
@@ -0,0 +1,94 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2018, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file depend.lua
+--
+
+-- load dependent info from the given file (.d)
+function load(dependfile)
+ return os.isfile(dependfile) and io.load(dependfile) or nil
+end
+
+-- save dependent info to file
+function save(dependinfo, dependfile)
+ io.save(dependfile, dependinfo)
+end
+
+-- the dependent info is changed?
+--
+-- if not depend.is_changed(dependinfo, {filemtime = os.mtime(objectfile), values = {...}}) then
+-- return
+-- end
+--
+function is_changed(dependinfo, opt)
+
+ -- check the dependent files are changed?
+ local lastmtime = nil
+ _g.file_results = _g.file_results or {}
+ for _, file in ipairs(dependinfo.files) do
+
+ -- optimization: this file has been not checked?
+ local status = _g.file_results[file]
+ if status == nil then
+
+ -- optimization: only uses the mtime of first object file
+ lastmtime = lastmtime or opt.lastmtime or 0
+
+ -- source and header files have been changed?
+ if os.mtime(file) > lastmtime then
+
+ -- mark this file as changed
+ _g.file_results[file] = true
+ return true
+ end
+
+ -- mark this file as not changed
+ _g.file_results[file] = false
+
+ -- has been checked and changed?
+ elseif status then
+ return true
+ end
+ end
+
+ -- check the dependent values are changed?
+ local depvalues = dependinfo.values or {}
+ local optvalues = opt.values or {}
+ if #depvalues ~= #optvalues then
+ return true
+ end
+ for idx, depvalue in ipairs(depvalues) do
+ local optvalue = optvalues[idx]
+ local deptype = type(depvalue)
+ local opttype = type(optvalue)
+ if deptype ~= opttype then
+ return true
+ elseif deptype == "string" and depvalue ~= optvalue then
+ return true
+ elseif deptype == "table" then
+ for subidx, subvalue in ipairs(depvalue) do
+ if subvalue ~= optvalue[subidx] then
+ return true
+ end
+ end
+ end
+ end
+end
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 8b5ffcbd6..c9286a80b 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -369,7 +369,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
end
-- complie the source file
-function _compile1(self, sourcefile, objectfile, depinfo, flags)
+function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
local objectdir = path.directory(objectfile)
@@ -384,7 +384,7 @@ function _compile1(self, sourcefile, objectfile, depinfo, flags)
-- generate includes file
local compflags = flags
- if depinfo then
+ if dependinfo then
compflags = table.join(flags, "-showIncludes")
end
return os.iorunv(_compargv1(self, sourcefile, objectfile, compflags))
@@ -410,8 +410,9 @@ function _compile1(self, sourcefile, objectfile, depinfo, flags)
}
-- generate the dependent includes
- if depinfo and outdata then
- depinfo.includes = _include_deps(self, outdata)
+ if dependinfo and outdata then
+ dependinfo.files = dependinfo.files or {}
+ table.join2(dependinfo.files, _include_deps(self, outdata))
end
end
@@ -426,13 +427,13 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- only support single source file now
assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-- for only single source file
- _compile1(self, sourcefiles, objectfile, depinfo, flags)
+ _compile1(self, sourcefiles, objectfile, dependinfo, flags)
end
diff --git a/xmake/modules/core/tools/dmd.lua b/xmake/modules/core/tools/dmd.lua
index a3c5c1f79..cb3565207 100644
--- a/xmake/modules/core/tools/dmd.lua
+++ b/xmake/modules/core/tools/dmd.lua
@@ -171,7 +171,7 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index a79c122c4..e0fa9a188 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -433,7 +433,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
end
-- complie the source file
-function _compile1(self, sourcefile, objectfile, depinfo, flags)
+function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -485,8 +485,9 @@ function _compile1(self, sourcefile, objectfile, depinfo, flags)
}
-- generate the dependent includes
- if depinfo and self:kind() ~= "as" then
- depinfo.includes = _include_deps(self, sourcefile, flags)
+ if dependinfo and self:kind() ~= "as" then
+ dependinfo.files = dependinfo.files or {}
+ table.join2(dependinfo.files, _include_deps(self, sourcefile, flags))
end
end
@@ -501,12 +502,12 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- only support single source file now
assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-- for only single source file
- _compile1(self, sourcefiles, objectfile, depinfo, flags)
+ _compile1(self, sourcefiles, objectfile, dependinfo, flags)
end
diff --git a/xmake/modules/core/tools/go.lua b/xmake/modules/core/tools/go.lua
index 538ac3c66..f092c3daa 100644
--- a/xmake/modules/core/tools/go.lua
+++ b/xmake/modules/core/tools/go.lua
@@ -131,7 +131,7 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
diff --git a/xmake/modules/core/tools/ml.lua b/xmake/modules/core/tools/ml.lua
index 5724ebc69..e706d242d 100644
--- a/xmake/modules/core/tools/ml.lua
+++ b/xmake/modules/core/tools/ml.lua
@@ -102,7 +102,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
end
-- complie the source file
-function _compile1(self, sourcefile, objectfile, depinfo, flags)
+function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -122,12 +122,12 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- only support single source file now
assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-- for only single source file
- _compile1(self, sourcefiles, objectfile, depinfo, flags)
+ _compile1(self, sourcefiles, objectfile, dependinfo, flags)
end
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index 551b25f8c..0e9a16dc2 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -242,7 +242,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
end
-- complie the source file
-function _compile1(self, sourcefile, objectfile, depinfo, flags)
+function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -305,12 +305,12 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- only support single source file now
assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-- for only single source file
- _compile1(self, sourcefiles, objectfile, depinfo, flags)
+ _compile1(self, sourcefiles, objectfile, dependinfo, flags)
end
diff --git a/xmake/modules/core/tools/rc.lua b/xmake/modules/core/tools/rc.lua
index 52d9c0100..4ff7a2faa 100644
--- a/xmake/modules/core/tools/rc.lua
+++ b/xmake/modules/core/tools/rc.lua
@@ -65,7 +65,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
end
-- complie the source file
-function _compile1(self, sourcefile, objectfile, depinfo, flags)
+function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -109,13 +109,13 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- only support single source file now
assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-- for only single source file
- _compile1(self, sourcefiles, objectfile, depinfo, flags)
+ _compile1(self, sourcefiles, objectfile, dependinfo, flags)
end
diff --git a/xmake/modules/core/tools/rustc.lua b/xmake/modules/core/tools/rustc.lua
index b8679f6e5..7be852edd 100644
--- a/xmake/modules/core/tools/rustc.lua
+++ b/xmake/modules/core/tools/rustc.lua
@@ -115,7 +115,7 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
diff --git a/xmake/modules/core/tools/swiftc.lua b/xmake/modules/core/tools/swiftc.lua
index d8b1e333c..7f72be37f 100644
--- a/xmake/modules/core/tools/swiftc.lua
+++ b/xmake/modules/core/tools/swiftc.lua
@@ -232,7 +232,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
end
-- complie the source file
-function _compile1(self, sourcefile, objectfile, depinfo, flags)
+function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -252,12 +252,12 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- only support single source file now
assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-- for only single source file
- _compile1(self, sourcefiles, objectfile, depinfo, flags)
+ _compile1(self, sourcefiles, objectfile, dependinfo, flags)
end
diff --git a/xmake/modules/core/tools/tcc.lua b/xmake/modules/core/tools/tcc.lua
index ad1939012..98c157edf 100644
--- a/xmake/modules/core/tools/tcc.lua
+++ b/xmake/modules/core/tools/tcc.lua
@@ -189,7 +189,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
end
-- complie the source file
-function _compile1(self, sourcefile, objectfile, depinfo, flags)
+function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -252,12 +252,12 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- only support single source file now
assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-- for only single source file
- _compile1(self, sourcefiles, objectfile, depinfo, flags)
+ _compile1(self, sourcefiles, objectfile, dependinfo, flags)
end
diff --git a/xmake/modules/core/tools/yasm.lua b/xmake/modules/core/tools/yasm.lua
index 7eb8a32ab..aaa0c647c 100644
--- a/xmake/modules/core/tools/yasm.lua
+++ b/xmake/modules/core/tools/yasm.lua
@@ -91,7 +91,7 @@ function _compargv1(self, sourcefile, objectfile, flags)
end
-- complie the source file
-function _compile1(self, sourcefile, objectfile, depinfo, flags)
+function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -111,12 +111,12 @@ function compargv(self, sourcefiles, objectfile, flags)
end
-- complie the source file
-function compile(self, sourcefiles, objectfile, depinfo, flags)
+function compile(self, sourcefiles, objectfile, dependinfo, flags)
-- only support single source file now
assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-- for only single source file
- _compile1(self, sourcefiles, objectfile, depinfo, flags)
+ _compile1(self, sourcefiles, objectfile, dependinfo, flags)
end