diff options
| author | ruki <[email protected]> | 2016-07-10 10:18:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-10 10:18:05 +0800 |
| commit | fd39adb3d959e605370098a72ec7e92b462fce62 (patch) | |
| tree | 392b866ab32e33cae167c95daa7bff7cfbb9767c /xmake/core/project | |
| parent | 4d2231a5136ddf5dca5398feaccc2d82bb56e1e0 (diff) | |
check include dependence
Diffstat (limited to 'xmake/core/project')
| -rw-r--r-- | xmake/core/project/option.lua | 6 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 28 |
2 files changed, 31 insertions, 3 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua index 1d554d887..af727808f 100644 --- a/xmake/core/project/option.lua +++ b/xmake/core/project/option.lua @@ -94,7 +94,7 @@ function option:_check_include(include, srcpath, objpath) end -- attempt to run this command - local ok, errors = instance:compile(srcpath, objpath, self) + local ok, errors = instance:compile(srcpath, objpath, nil, self) if not ok and option_.get("verbose") then print(errors) end @@ -148,7 +148,7 @@ function option:_check_function(checkcode, srcpath, objpath) srcfile:close() -- execute the compile command - local ok, errors = instance:compile(srcpath, objpath, self) + local ok, errors = instance:compile(srcpath, objpath, nil, self) if not ok and option_.get("verbose") then print(errors) end @@ -202,7 +202,7 @@ function option:_check_typedef(typedef, srcpath, objpath) srcfile:close() -- execute the compile command - local ok, errors = instance:compile(srcpath, objpath, self) + local ok, errors = instance:compile(srcpath, objpath, nil, self) if not ok and option_.get("verbose") then print(errors) end diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 5e3669c69..27d4e926b 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -358,6 +358,34 @@ function target:headerfiles(outputdir) return srcheaders, dstheaders end +-- get the dependent include files +function target:incdepfiles() + + -- the previous object files + local objectfiles_prev = self._OBJECTFILES + + -- the object files + local objectfiles = self:objectfiles() + + -- cached? return it directly + local modified = objectfiles_prev ~= objectfiles + if self._INCDEPFILES and not modified then + return self._INCDEPFILES + end + + -- make include files + local incdepfiles = {} + for _, objectfile in ipairs(objectfiles) do + table.insert(incdepfiles, path.join(path.directory(objectfile), path.basename(objectfile) .. ".d")) + end + + -- cache it + self._INCDEPFILES = incdepfiles + + -- ok + return incdepfiles +end + -- get the kinds of sourcefiles -- -- .e.g cc cxx mm mxx as ... |
