From 4b83826396c3bef99e138e2c6b13e2a6f818f017 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Mon, 26 Dec 2022 18:19:28 +0100 Subject: generate module meta data file on install this should allow a support of importing modules from a XMake library with other buildsys like CMake or Meson --- xmake/rules/c++/modules/modules_support/common.lua | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'xmake/rules/c++/modules/modules_support/common.lua') diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 1c3b2f0b1..f3500a658 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -572,3 +572,55 @@ function append_dependency_objectfiles(target) end end end + +-- generate meta module informations for package / other buildsystems import +-- based on https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2473r1.pdf +-- +-- e.g +-- { +-- "include_paths": {"foo/", "bar/"} +-- "definitions": {"FOO=BAR"} +-- "imports": {"std", "bar"} +-- "_VENDOR_extension": {} +-- } +function generate_meta_module_info(target, sourcefile) + local module_metadata = {} + + -- add include paths + module_metadata.include_paths = target:get("includedirs") or {} + for _, deps in ipairs(target:orderdeps()) do + table.join2(module_metadata.include_paths, deps:get("includedirs") or {}) + end + + -- add definitions + module_metadata.definitions = target:get("defines") or {} + for _, deps in ipairs(target:orderdeps()) do + table.join2(module_metadata.definitions, deps:get("defines") or {}) + end + + module_metadata._VENDOR_extension = {} + + print(module_metadata) + + return module_metadata +end + +function install_module_target(target) + local sourcebatch = target:sourcebatches()["c++.build.modules.install"] + if sourcebatch and sourcebatch.sourcefiles then + for _, sourcefile in ipairs(sourcebatch.sourcefiles) do + local prefixdir = path.join("modules", target:name()) + local fileconfig = target:fileconfig(sourcefile) + if fileconfig and fileconfig.prefixdir then + prefixdir = fileconfig.prefixdir + end + local install = (fileconfig and not fileconfig.install) and false or true + if install then + target:add("installfiles", sourcefile, {prefixdir = prefixdir}) + local metafile = path.join(target:installdir(), prefixdir, path.basename(sourcefile) .. ".meta-ixx-info") + print(metafile) + io.writefile(metafile, json.encode(generate_meta_module_info(target, sourcefile))) + end + end + end +end \ No newline at end of file -- cgit v1.3.1 From e3aa97b577dac58da1588c096140f178e53256cd Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Thu, 29 Dec 2022 18:33:48 +0100 Subject: add support of importing module from packages --- xmake/rules/c++/modules/modules_support/clang.lua | 19 +++-- xmake/rules/c++/modules/modules_support/common.lua | 96 ++++++++++++++++++---- xmake/rules/c++/modules/modules_support/gcc.lua | 15 ++-- xmake/rules/c++/modules/modules_support/msvc.lua | 37 ++++++--- xmake/rules/c++/modules/xmake.lua | 18 ++++ 5 files changed, 148 insertions(+), 37 deletions(-) (limited to 'xmake/rules/c++/modules/modules_support/common.lua') diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua index 02d08e6b0..074ed331f 100644 --- a/xmake/rules/c++/modules/modules_support/clang.lua +++ b/xmake/rules/c++/modules/modules_support/clang.lua @@ -484,13 +484,18 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op if provide or common.has_module_extension(cppfile) then local bmifile = provide and provide.bmi - _build_modulefile(target, provide and provide.sourcefile or cppfile, { - objectfile = objectfile, - dependfile = target:dependfile(bmifile or objectfile), - provide = provide and {bmifile = bmifile, name = name}, - common_args = common_args, - requiresflags = requiresflags, - progress = (index * 100) / total}) + if not common.memcache():get2(name or cppfile, "compiling") then + if name and module.external then + common.memcache():set2(name or cppfile, "compiling", true) + end + _build_modulefile(target, provide and provide.sourcefile or cppfile, { + objectfile = objectfile, + dependfile = target:dependfile(bmifile or objectfile), + provide = provide and {bmifile = bmifile, name = name}, + common_args = common_args, + requiresflags = requiresflags, + progress = (index * 100) / total}) + end target:add("objectfiles", objectfile) if provide then diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index f3500a658..394d9b60e 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -102,6 +102,64 @@ function patch_sourcebatch(target, sourcebatch) end end +-- extract packages modules dependencies +function get_all_package_modules(target, modules, opt) + local package_modules + + -- parse all meta-info and append their informations to the package store + for name, package in pairs(target:pkgs()) do + package_modules = package_modules or {} + local modules_dir = path.join(package:installdir(), "modules", name) + local meta_files = os.match(path.join(modules_dir, "**.meta-info"), false) + if meta_files then + for _, file in ipairs(meta_files) do + local metadata = json.loadfile(file) + package_modules[metadata._VENDOR_extension.name] = { + file = path.join(modules_dir, metadata._VENDOR_extension.file), + metadata = metadata + } + end + end + end + + return package_modules +end + +-- cull unused modules +function cull_unused_modules(target, modules, package_modules_data) + local needed_modules = {} + -- append all target dependencies + for _, module in pairs(modules) do + if module.requires then + for required, _ in pairs(module.requires) do + table.append(needed_modules, required) + end + end + end + + -- append all package dependencies + local module_names = {} + for name, _ in pairs(package_modules_data) do + table.append(module_names, name) + end + + local culled + for i, name in ipairs(module_names) do + culled = culled or {} + if table.find(needed_modules, name) and package_modules_data[name] and not culled[name] then + culled[name] = package_modules_data[name] + + -- table.remove(module_names, i) + if culled[name].metadata.imports then + table.join2(needed_modules, culled[name].metadata.imports) + table.join2(module_names, culled[name].metadata.imports) + end + end + end + + return culled +end + -- get modules support function modules_support(target) local cachekey = tostring(target) @@ -510,7 +568,7 @@ end function get_module_dependencies(target, sourcebatch, opt) local cachekey = target:name() .. "/" .. sourcebatch.rulename local modules = memcache():get2("modules", cachekey) - if modules == nil then + if modules == nil or opt.regenerate then modules = localcache():get2("modules", cachekey) opt.progress = opt.progress or 0 local changed = modules_support(target).generate_dependencies(target, sourcebatch, opt) @@ -564,11 +622,11 @@ function append_dependency_objectfiles(target) local cache = localcache():get(cachekey) if cache then if target:is_binary() then - target:add("ldflags", cache, {force = true}) + target:add("ldflags", cache, {force = true, expand = false}) elseif target:is_static() then - target:add("arflags", cache, {force = true}) + target:add("arflags", cache, {force = true, expand = false}) elseif target:is_shared() then - target:add("shflags", cache, {force = true}) + target:add("shflags", cache, {force = true, expand = false}) end end end @@ -578,35 +636,42 @@ end -- -- e.g -- { --- "include_paths": {"foo/", "bar/"} --- "definitions": {"FOO=BAR"} --- "imports": {"std", "bar"} +-- "include_paths": ["foo/", "bar/"] +-- "definitions": ["FOO=BAR"] +-- "imports": ["std", "bar"] -- "_VENDOR_extension": {} -- } -function generate_meta_module_info(target, sourcefile) +function generate_meta_module_info(target, name, sourcefile, requires) local module_metadata = {} -- add include paths - module_metadata.include_paths = target:get("includedirs") or {} + module_metadata.include_paths = table.wrap(target:get("includedirs")) or {} for _, deps in ipairs(target:orderdeps()) do table.join2(module_metadata.include_paths, deps:get("includedirs") or {}) end -- add definitions - module_metadata.definitions = target:get("defines") or {} + module_metadata.definitions = table.wrap(target:get("defines")) or {} for _, deps in ipairs(target:orderdeps()) do table.join2(module_metadata.definitions, deps:get("defines") or {}) end - module_metadata._VENDOR_extension = {} + -- add imports + if requires then + for name, _ in pairs(requires) do + module_metadata.imports = module_metadata.imports or {} + table.append(module_metadata.imports, name) + end + end - print(module_metadata) + module_metadata._VENDOR_extension = {name = name, file = path.filename(sourcefile)} return module_metadata end function install_module_target(target) local sourcebatch = target:sourcebatches()["c++.build.modules.install"] + local cachedir = modules_cachedir(target) if sourcebatch and sourcebatch.sourcefiles then for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local prefixdir = path.join("modules", target:name()) @@ -617,9 +682,10 @@ function install_module_target(target) local install = (fileconfig and not fileconfig.install) and false or true if install then target:add("installfiles", sourcefile, {prefixdir = prefixdir}) - local metafile = path.join(target:installdir(), prefixdir, path.basename(sourcefile) .. ".meta-ixx-info") - print(metafile) - io.writefile(metafile, json.encode(generate_meta_module_info(target, sourcefile))) + local metafile = path.join(cachedir, path.filename(sourcefile) .. ".meta-info") + if os.exists(metafile) then + target:add("installfiles", metafile, {prefixdir = prefixdir}) + end end end end diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua index f178e550a..acc06039f 100644 --- a/xmake/rules/c++/modules/modules_support/gcc.lua +++ b/xmake/rules/c++/modules/modules_support/gcc.lua @@ -445,11 +445,16 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op end if provide or common.has_module_extension(cppfile) then - _build_modulefile(target, cppfile, { - objectfile = objectfile, - dependfile = dependfile, - name = name or cppfile, - progress = (index * 100) / total}) + if not common.memcache():get2(name or cppfile, "compiling") then + if name and module.external then + common.memcache():set2(name or cppfile, "compiling", true) + end + _build_modulefile(target, cppfile, { + objectfile = objectfile, + dependfile = dependfile, + name = name or cppfile, + progress = (index * 100) / total}) + end target:add("objectfiles", objectfile) end end)}) diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index a902721c0..8799103b0 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -26,6 +26,7 @@ import("core.project.depend") import("core.project.config") import("core.base.hashset") import("core.base.semver") +import("core.base.json") import("utils.progress") import("private.action.build.object", {alias = "objectbuilder"}) import("common") @@ -450,6 +451,7 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op for objectfile, module in pairs(get_stdmodules(target)) do table.insert(objectfiles, objectfile) modules[objectfile] = module + modules[objectfile].external = true end end @@ -480,6 +482,21 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op if provide then table.join2(flags, {ifcoutputflag, path(provide.bmi), provide.interface and interfaceflag or internalpartitionflag}) dependfile = target:dependfile(provide.bmi) + + local fileconfig = target:fileconfig(cppfile) + if fileconfig and fileconfig.install then + batchjobs:addjob(name .. "_metafile", function(index, total) + local cachedir = common.modules_cachedir(target) + local metafilepath = path.join(cachedir, path.filename(cppfile) .. ".meta-info") + depend.on_changed(function() + 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, {rootjob = flushjob}) + end end table.join2(moduleinfo, { @@ -497,17 +514,17 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op if provide or common.has_module_extension(cppfile) then if not common.memcache():get2(name or cppfile, "compiling") then - if name and name:match("std") then - common.memcache():set2(name or cppfile, "compiling", true) + if name and module.external then + common.memcache():set2(name or cppfile, "compiling", true) end - _build_modulefile(target, cppfile, { - objectfile = objectfile, - dependfile = dependfile, - name = name or module.cppfile, - flags = _flags, - progress = (index * 100) / total}) - _add_objectfile_to_link_arguments(target, path(objectfile)) + _build_modulefile(target, cppfile, { + objectfile = objectfile, + dependfile = dependfile, + name = name or module.cppfile, + flags = _flags, + progress = (index * 100) / total}) end + _add_objectfile_to_link_arguments(target, objectfile) elseif requiresflags then requiresflags = get_requiresflags(target, module.requires) target:fileconfig_add(cppfile, {force = {cxxflags = table.join(flags, requiresflags)}}) @@ -577,7 +594,7 @@ function build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, op batchcmds:mkdir(path.directory(objectfile)) _batchcmds_compile(batchcmds, target, table.join(flags, requiresflags or {})) batchcmds:add_depfiles(cppfile) - _add_objectfile_to_link_arguments(target, path(objectfile)) + _add_objectfile_to_link_arguments(target, path.translate(objectfile)) if provide then _add_module_to_mapper(target, referenceflag, name, name, objectfile, provide.bmi, requiresflags) end diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua index 2ccf27c5d..1d2852644 100644 --- a/xmake/rules/c++/modules/xmake.lua +++ b/xmake/rules/c++/modules/xmake.lua @@ -67,6 +67,24 @@ rule("c++.build.modules.builder") common.patch_sourcebatch(target, sourcebatch, opt) local modules = common.get_module_dependencies(target, sourcebatch, opt) + -- extract packages modules dependencies + local package_modules_data = common.get_all_package_modules(target, modules, opt) + if package_modules_data then + -- cull unused modules + package_modules_data = common.cull_unused_modules(target, modules, package_modules_data) + if package_modules_data then + -- append to sourcebatch + for name, package_module_data in pairs(package_modules_data) do + table.append(sourcebatch.sourcefiles, package_module_data.file) + end + + -- we need to repatch and regenerate dependencies at this point + common.patch_sourcebatch(target, sourcebatch, opt) + opt.regenerate = true + modules = common.get_module_dependencies(target, sourcebatch, opt) + end + end + -- build modules common.build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) -- cgit v1.3.1 From 64b476a2b13975e484117bc76ea04773fb9e5974 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Thu, 5 Jan 2023 14:01:18 +0100 Subject: use os.files instead of os.match --- xmake/rules/c++/modules/modules_support/common.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'xmake/rules/c++/modules/modules_support/common.lua') diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 394d9b60e..25fcc89f3 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -110,15 +110,13 @@ function get_all_package_modules(target, modules, opt) for name, package in pairs(target:pkgs()) do package_modules = package_modules or {} local modules_dir = path.join(package:installdir(), "modules", name) - local meta_files = os.match(path.join(modules_dir, "**.meta-info"), false) - if meta_files then - for _, file in ipairs(meta_files) do - local metadata = json.loadfile(file) - package_modules[metadata._VENDOR_extension.name] = { - file = path.join(modules_dir, metadata._VENDOR_extension.file), - metadata = metadata - } - end + local meta_files = os.files(path.join(modules_dir, "**.meta-info")) + for _, file in ipairs(meta_files) do + local metadata = json.loadfile(file) + package_modules[metadata._VENDOR_extension.name] = { + file = path.join(modules_dir, metadata._VENDOR_extension.file), + metadata = metadata + } end end -- cgit v1.3.1 From 02307bd1ca30bc4bfcd6617966a68327157af007 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Fri, 6 Jan 2023 13:11:51 +0100 Subject: improve metainfo handling --- xmake/rules/c++/modules/modules_support/common.lua | 41 ++++++++++++++++++---- 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'xmake/rules/c++/modules/modules_support/common.lua') diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 25fcc89f3..e1ae05393 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -102,6 +102,35 @@ function patch_sourcebatch(target, sourcebatch) end end +function parse_meta_info(target, metafile) + local metadata = json.loadfile(metafile) + if metadata._VENDOR_extension.xmake then + return metadata._VENDOR_extension.xmake.file, metadata._VENDOR_extension.xmake.name, metadata + end + + local file = path.basename(metafile) + for _, ext in pairs({".mpp", ".mxx", ".cppm", ".ixx"}) do + if os.exists(path.join(path.directory(metafile), file .. ext)) then + file = file .. ext + break + end + end + + local sourcecode = io.readfile(path.join(path.directory(metafile), file)) + sourcecode = sourcecode:gsub("//.-\n", "\n") + sourcecode = sourcecode:gsub("/%*.-%*/", "") + + local name + for _, line in ipairs(sourcecode:split("\n", {plain = true})) do + name = line:match("export%s+module%s+(.+)%s*;") or line:match("export%s+__preprocessed_module%s+(.+)%s*;") + if name then + break + end + end + + return file, name, metadata +end + -- extract packages modules dependencies function get_all_package_modules(target, modules, opt) local package_modules @@ -110,11 +139,11 @@ function get_all_package_modules(target, modules, opt) for name, package in pairs(target:pkgs()) do package_modules = package_modules or {} local modules_dir = path.join(package:installdir(), "modules", name) - local meta_files = os.files(path.join(modules_dir, "**.meta-info")) - for _, file in ipairs(meta_files) do - local metadata = json.loadfile(file) - package_modules[metadata._VENDOR_extension.name] = { - file = path.join(modules_dir, metadata._VENDOR_extension.file), + local metafiles = os.files(path.join(modules_dir, "**.meta-info")) + for _, metafile in ipairs(metafiles) do + local modulefile, name, metadata = parse_meta_info(target, metafile) + package_modules[name] = { + file = path.join(modules_dir, modulefile), metadata = metadata } end @@ -662,7 +691,7 @@ function generate_meta_module_info(target, name, sourcefile, requires) end end - module_metadata._VENDOR_extension = {name = name, file = path.filename(sourcefile)} + module_metadata._VENDOR_extension = { xmake = { name = name, file = path.filename(sourcefile) }} return module_metadata end -- cgit v1.3.1 From 2c2c67e67ba3076ff7d418af4b27e7381aa7269a Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 7 Jan 2023 20:34:27 +0800 Subject: Update common.lua --- xmake/rules/c++/modules/modules_support/common.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xmake/rules/c++/modules/modules_support/common.lua') diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index e1ae05393..5d3907dfb 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -109,8 +109,8 @@ function parse_meta_info(target, metafile) end local file = path.basename(metafile) - for _, ext in pairs({".mpp", ".mxx", ".cppm", ".ixx"}) do - if os.exists(path.join(path.directory(metafile), file .. ext)) then + for _, ext in ipairs({".mpp", ".mxx", ".cppm", ".ixx"}) do + if os.isfile(path.join(path.directory(metafile), file .. ext)) then file = file .. ext break end @@ -716,4 +716,4 @@ function install_module_target(target) end end end -end \ No newline at end of file +end -- cgit v1.3.1 From d07547fb49474e9822c7ac14031b90c5b6d78bd2 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 7 Jan 2023 20:37:01 +0800 Subject: Update common.lua --- xmake/rules/c++/modules/modules_support/common.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'xmake/rules/c++/modules/modules_support/common.lua') diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 5d3907dfb..5f1f72599 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -108,15 +108,16 @@ function parse_meta_info(target, metafile) return metadata._VENDOR_extension.xmake.file, metadata._VENDOR_extension.xmake.name, metadata end - local file = path.basename(metafile) + local filename = path.basename(metafile) + local metadir = path.directory(metafile) for _, ext in ipairs({".mpp", ".mxx", ".cppm", ".ixx"}) do - if os.isfile(path.join(path.directory(metafile), file .. ext)) then - file = file .. ext + if os.isfile(path.join(metadir, filename .. ext)) then + filename = filename .. ext break end end - local sourcecode = io.readfile(path.join(path.directory(metafile), file)) + local sourcecode = io.readfile(path.join(path.directory(metafile), filename)) sourcecode = sourcecode:gsub("//.-\n", "\n") sourcecode = sourcecode:gsub("/%*.-%*/", "") @@ -128,7 +129,7 @@ function parse_meta_info(target, metafile) end end - return file, name, metadata + return filename, name, metadata end -- extract packages modules dependencies -- cgit v1.3.1 From b5e29bdae4f381e343632cf5ea51224aea8f720a Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Sat, 7 Jan 2023 15:49:45 +0100 Subject: implement suggestions --- xmake/rules/c++/modules/modules_support/common.lua | 11 +++-------- xmake/rules/c++/modules/xmake.lua | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'xmake/rules/c++/modules/modules_support/common.lua') diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 5f1f72599..ace8f2c56 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -160,24 +160,19 @@ function cull_unused_modules(target, modules, package_modules_data) for _, module in pairs(modules) do if module.requires then for required, _ in pairs(module.requires) do - table.append(needed_modules, required) + table.insert(needed_modules, required) end end end -- append all package dependencies - local module_names = {} - for name, _ in pairs(package_modules_data) do - table.append(module_names, name) - end - + local module_names = table.keys(package_modules_data) or {} local culled - for i, name in ipairs(module_names) do + for _, name in ipairs(module_names) do culled = culled or {} if table.find(needed_modules, name) and package_modules_data[name] and not culled[name] then culled[name] = package_modules_data[name] - -- table.remove(module_names, i) if culled[name].metadata.imports then table.join2(needed_modules, culled[name].metadata.imports) table.join2(module_names, culled[name].metadata.imports) diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua index 1d2852644..b62ec0f36 100644 --- a/xmake/rules/c++/modules/xmake.lua +++ b/xmake/rules/c++/modules/xmake.lua @@ -75,7 +75,7 @@ rule("c++.build.modules.builder") if package_modules_data then -- append to sourcebatch for name, package_module_data in pairs(package_modules_data) do - table.append(sourcebatch.sourcefiles, package_module_data.file) + table.insert(sourcebatch.sourcefiles, package_module_data.file) end -- we need to repatch and regenerate dependencies at this point -- cgit v1.3.1