diff options
| author | ruki <[email protected]> | 2022-08-08 07:18:26 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-08-08 07:18:26 +0800 |
| commit | 46cf0ad2545d829a255e88371660dfe8bb11de22 (patch) | |
| tree | 093a2e3e79dadaa04f4d9323511aa6bf629d5a57 /xmake/rules/c++/modules | |
| parent | c6ee1e60c83626215ba3f1bf8471fcc72ab3d4b4 (diff) | |
| parent | 583617288e914b282f7c3278ff1403adef941f85 (diff) | |
Merge pull request #2657 from Arthapz/cxxmodules
Fix clang module mapper
Diffstat (limited to 'xmake/rules/c++/modules')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/clang.lua | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua index 4749f7fe3..35b7cdbc5 100644 --- a/xmake/rules/c++/modules/modules_support/clang.lua +++ b/xmake/rules/c++/modules/modules_support/clang.lua @@ -51,7 +51,6 @@ end -- function _add_headerunit_to_mapper(target, bmi) local cache = common.localcache():get("mapflags") or {} - local modulefileflag = get_modulefileflag(target) local mapflag = format("%s%s", modulefileflag, bmi) if table.contains(cache, mapflag) then return @@ -61,17 +60,6 @@ function _add_headerunit_to_mapper(target, bmi) common.localcache():save("mapflags") end - local modulefileflag = get_modulefileflag(target) - for line in io.lines(file) do - if line:startswith(modulefileflag .. bmi) then - return - end - end - local f = io.open(file, "a") - f:print("%s%s", modulefileflag, bmi) - f:close() -end - -- load module support for the current target function load(target) local cachedir = common.modules_cachedir(target) @@ -266,9 +254,8 @@ function build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, op local emitmoduleinterfaceflag = get_emitmoduleinterfaceflag(target) -- append module mapper flags - for line in io.lines(mapper_file) do - target:add("cxxflags", line, {force = true}) - end + local cache = common.localcache():get("mapflags") or {} + target:add("cxxflags", cache, {force = true}) -- build modules local common_args = {modulecachepathflag .. cachedir} @@ -340,21 +327,6 @@ function get_builtinmodulemapflag(target) return builtinmodulemapflag or nil end -function get_modulemapfileflag(target) - local modulemapfileflag = _g.modulemapfileflag - if modulemapfileflag == nil then - local compinst = target:compiler("cxx") - local mapper_file = path.join(os.tmpfile(), "mapper.txt") - os.touch(mapper_file) - if compinst:has_flags("-fmodule-map-file=" .. mapper_file, "cxxflags", {flagskey = "clang_module_map_file"}) then - modulemapfileflag = "-fmodule-map-file=" - end - assert(modulemapfileflag, "compiler(clang): does not support c++ module!") - _g.modulemapfileflag = modulemapfileflag or false - end - return modulemapfileflag or nil -end - function get_implicitmodulesflag(target) local implicitmodulesflag = _g.implicitmodulesflag if implicitmodulesflag == nil then |
