diff options
| author | ruki <[email protected]> | 2023-09-01 09:40:50 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-01 09:40:50 +0800 |
| commit | 2df911b8d9f35d293d6215a52dd77522078016af (patch) | |
| tree | 8230bc3f1b7c156f4b7c9a0f6baaf5448862f873 /xmake/rules/c++ | |
| parent | 515dbd9e94793b0bd126a19ecc8f482752897ed9 (diff) | |
| parent | dcc5abf105e7df9d47e37e18191bef2503edb085 (diff) | |
Merge pull request #4159 from xmake-io/rebuild
improve to rebuild target #4154
Diffstat (limited to 'xmake/rules/c++')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/clang.lua | 11 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/gcc.lua | 10 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc.lua | 10 | ||||
| -rw-r--r-- | xmake/rules/c++/unity_build/unity_build.lua | 2 |
4 files changed, 17 insertions, 16 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua index 9f7e2225d..8cf54c883 100644 --- a/xmake/rules/c++/modules/modules_support/clang.lua +++ b/xmake/rules/c++/modules/modules_support/clang.lua @@ -247,7 +247,7 @@ function _build_modulefile(target, sourcefile, opt) local dependfile = opt.dependfile local compinst = compiler.load("cxx", {target = target}) local compflags = compinst:compflags({sourcefile = sourcefile, target = target}) - local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {}) + local dependinfo = target:is_rebuilt() and {} or (depend.load(dependfile) or {}) -- need build this object? local dryrun = option.get("dry-run") @@ -411,7 +411,7 @@ function generate_dependencies(target, sourcebatch, opt) end return {moduleinfo = rawdependinfo} - end, {dependfile = dependfile, files = {sourcefile}}) + end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt()}) end return changed end @@ -442,7 +442,8 @@ function generate_stl_headerunits_for_batchjobs(target, batchjobs, headerunits, os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), args)) end - end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}}) + end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}, changed = target:is_rebuilt()}) + -- libc++ have a builtin module mapper if not _use_stdlib(target, "libc++") then _add_module_to_mapper(target, headerunit.name, bmifile) @@ -523,7 +524,7 @@ function generate_user_headerunits_for_batchjobs(target, batchjobs, headerunits, end os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), args)) - end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}}) + end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}, changed = target:is_rebuilt()}) _add_module_to_mapper(target, headerunit.name, bmifile) end, {rootjob = flushjob}) end @@ -614,7 +615,7 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op progress.show(opt.progress, "${color.build.object}generating.module.metadata %s", name) local metadata = common.generate_meta_module_info(target, name, cppfile, module.requires) json.savefile(metafilepath, metadata) - end, {dependfile = target:dependfile(metafilepath), files = {cppfile}}) + end, {dependfile = target:dependfile(metafilepath), files = {cppfile}, changed = target:is_rebuilt()}) end, {rootjob = flushjob}) end end diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua index 20b783821..4fa92e4df 100644 --- a/xmake/rules/c++/modules/modules_support/gcc.lua +++ b/xmake/rules/c++/modules/modules_support/gcc.lua @@ -123,7 +123,7 @@ function _build_modulefile(target, sourcefile, opt) local dependfile = opt.dependfile local compinst = compiler.load("cxx", {target = target}) local compflags = table.join("-x", "c++", compinst:compflags({sourcefile = sourcefile, target = target})) - local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {}) + local dependinfo = target:is_rebuilt() and {} or (depend.load(dependfile) or {}) -- need build this object? local dryrun = option.get("dry-run") @@ -219,7 +219,7 @@ function generate_dependencies(target, sourcebatch, opt) local dependinfo = io.readfile(jsonfile) return { moduleinfo = dependinfo } - end, {dependfile = dependfile, files = {sourcefile}}) + end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt()}) end return changed end @@ -255,7 +255,7 @@ function generate_stl_headerunits_for_batchjobs(target, batchjobs, headerunits, os.vrunv(compinst:program(), flags) _add_module_to_mapper(mapper_file, headerunit.path, path.absolute(bmifile, projectdir)) os.tryrm(mapper_file_tmp) - end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}}) + end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}, changed = target:is_rebuilt()}) end, {rootjob = opt.rootjob}) else _add_module_to_mapper(mapper_file, headerunit.path, path.absolute(bmifile, projectdir)) @@ -331,7 +331,7 @@ function generate_user_headerunits_for_batchjobs(target, batchjobs, headerunits, end os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), args)) - end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}}) + end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}, changed = target:is_rebuilt()}) end, {rootjob = opt.rootjob}) _add_module_to_mapper(mapper_file, headerunit_path, path.absolute(bmifile, projectdir)) end @@ -421,7 +421,7 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op progress.show((index * 100) / total, "${color.build.object}generating.module.metadata %s", name) local metadata = common.generate_meta_module_info(target, name, cppfile, module.requires) json.savefile(metafilepath, metadata) - end, {dependfile = target:dependfile(metafilepath), files = {cppfile}}) + end, {dependfile = target:dependfile(metafilepath), files = {cppfile}, changed = target:is_rebuilt()}) end, {rootjob = opt.rootjob}) end end diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index 0372ca997..0643117d0 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -100,7 +100,7 @@ function _build_modulefile(target, sourcefile, opt) local dependfile = opt.dependfile local compinst = compiler.load("cxx", {target = target}) local compflags = compinst:compflags({sourcefile = sourcefile, target = target}) - local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {}) + local dependinfo = target:is_rebuilt() and {} or (depend.load(dependfile) or {}) -- need build this object? local dryrun = option.get("dry-run") @@ -216,7 +216,7 @@ function generate_dependencies(target, sourcebatch, opt) local dependinfo = io.readfile(jsonfile) return { moduleinfo = dependinfo } - end, {dependfile = dependfile, files = {sourcefile}}) + end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt()}) end return changed end @@ -274,7 +274,7 @@ function generate_stl_headerunits_for_batchjobs(target, batchjobs, headerunits, } generate_headerunit_for_batchjob(target, headerunit.name, flags, objectfile, index, total) - end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}}) + end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}, changed = target:is_rebuilt()}) _add_module_to_mapper(target, headerunitflag .. ":angle", headerunit.name, headerunit.name, objectfile, bmifile) end, {rootjob = flushjob}) end @@ -351,7 +351,7 @@ function generate_user_headerunits_for_batchjobs(target, batchjobs, headerunits, "/Fo" .. objectfile } generate_headerunit_for_batchjob(target, headerunit.name, flags, objectfile, index, total) - end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}}) + end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}, changed = target:is_rebuilt()}) _add_module_to_mapper(target, headerunitflag, headerunit.name, headerunit.path, objectfile, bmifile) end, {rootjob = flushjob}) end @@ -454,7 +454,7 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op progress.show((index * 100) / total, "${color.build.object}generating.module.metadata %s", name) local metadata = common.generate_meta_module_info(target, name, cppfile, module.requires) json.savefile(metafilepath, metadata) - end, {dependfile = target:dependfile(metafilepath), files = {cppfile}}) + end, {dependfile = target:dependfile(metafilepath), files = {cppfile}, changed = target:is_rebuilt()}) end, {rootjob = flushjob}) end end diff --git a/xmake/rules/c++/unity_build/unity_build.lua b/xmake/rules/c++/unity_build/unity_build.lua index ad93753c0..a6059fec0 100644 --- a/xmake/rules/c++/unity_build/unity_build.lua +++ b/xmake/rules/c++/unity_build/unity_build.lua @@ -45,7 +45,7 @@ function _merge_unityfile(target, sourcefile_unity, sourcefiles, opt) end unityfile:close() - end, {dependfile = dependfile, files = sourcefiles}) + end, {dependfile = dependfile, files = sourcefiles, changed = target:is_rebuilt()}) end function generate_unityfiles(target, sourcebatch, opt) |
