diff options
| author | ruki <[email protected]> | 2022-08-06 00:59:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-08-06 00:59:10 +0800 |
| commit | 53c31dfffd73cd635a6512d49b902e8c45dca102 (patch) | |
| tree | 998921520a998224de105e5dcfb637a6ba85a38c /xmake/rules/c++/modules/modules_support/common.lua | |
| parent | 8ac03c2d83d6cf5b9509ab2d4e756998711886b8 (diff) | |
add batchjobs stub
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/common.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/common.lua | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index b5a49e680..5d5c625ec 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -52,10 +52,9 @@ function modules_cachedir(target) end -- get headerunits info -function get_headerunits(target, sourcebatch) +function get_headerunits(target, sourcebatch, modules) local headerunits local stl_headerunits - local modules = target:data("cxx.modules") for _, objectfile in ipairs(sourcebatch.objectfiles) do local m = modules[objectfile] if m then @@ -281,6 +280,7 @@ function _topological_sort_get_first_unmarked_node(nodes) end end +-- topological sort function sort_modules_by_dependencies(objectfiles, modules) local output = {} local nodes = {} @@ -412,22 +412,55 @@ function generate_dependencies(target, sourcebatch, opt) return parse_dependency_data(target, moduleinfos) end --- generate headerunits -function generate_headerunits(target, batchcmds, sourcebatch, opt) +-- generate headerunits for batchjobs, TODO +function generate_headerunits_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) -- get headerunits info - local headerunits, stl_headerunits = get_headerunits(target, sourcebatch) + local headerunits, stl_headerunits = get_headerunits(target, sourcebatch, modules) -- generate headerunits + -- build stl header units as other headerunits may need them local headerunits_flags + if stl_headerunits then + headerunits_flags = headerunits_flags or {} +-- table.join2(headerunits_flags, modules_support(target).generate_stl_headerunits_for_batchjobs(target, batchjobs, stl_headerunits, opt)) + end + if headerunits then + headerunits_flags = headerunits_flags or {} +-- table.join2(headerunits_flags, modules_support(target).generate_user_headerunits_for_batchjobs(target, batchjobs, headerunits, opt)) + end + return headerunits_flags +end + +-- generate headerunits for batchcmds +function generate_headerunits_for_batchcmds(target, batchcmds, sourcebatch, modules, opt) + + -- get headerunits info + local headerunits, stl_headerunits = get_headerunits(target, sourcebatch, modules) + + -- generate headerunits -- build stl header units as other headerunits may need them + local headerunits_flags if stl_headerunits then headerunits_flags = headerunits_flags or {} - table.join2(headerunits_flags, modules_support(target).generate_stl_headerunits(target, batchcmds, stl_headerunits, opt)) + table.join2(headerunits_flags, modules_support(target).generate_stl_headerunits_for_batchcmds(target, batchcmds, stl_headerunits, opt)) end if headerunits then headerunits_flags = headerunits_flags or {} - table.join2(headerunits_flags, modules_support(target).generate_user_headerunits(target, batchcmds, headerunits, opt)) + table.join2(headerunits_flags, modules_support(target).generate_user_headerunits_for_batchcmds(target, batchcmds, headerunits, opt)) end return headerunits_flags end + +-- build modules for batchjobs, TODO +function build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) + local objectfiles = sort_modules_by_dependencies(sourcebatch.objectfiles, modules) +-- modules_support(target).build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, opt) +end + +-- build modules for batchcmds +function build_modules_for_batchcmds(target, batchcmds, sourcebatch, modules, opt) + local objectfiles = sort_modules_by_dependencies(sourcebatch.objectfiles, modules) + modules_support(target).build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, opt) +end + |
