diff options
| author | Arthur LAURENT <[email protected]> | 2024-01-31 13:01:40 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-01-31 13:01:40 +0100 |
| commit | f3ec9cc0f7cf6d0b48dce8a69c5f6103b9dd6df3 (patch) | |
| tree | ef053b0f6d8642ac4dd97d7d151557ebff97f0f0 /xmake/rules/c++/modules/modules_support/builder.lua | |
| parent | 95996d7b59b420f9bc6b9f8e817e48d6be183acc (diff) | |
implement missing headerunit aliasing
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/builder.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/builder.lua | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/xmake/rules/c++/modules/modules_support/builder.lua b/xmake/rules/c++/modules/modules_support/builder.lua index b17bb73b3..5c2ec113f 100644 --- a/xmake/rules/c++/modules/modules_support/builder.lua +++ b/xmake/rules/c++/modules/modules_support/builder.lua @@ -167,18 +167,13 @@ function _target_module_map_cachekey(target) return target:name() .. "module_mapper" .. (mode or "") end -function _is_duplicated_headerunit(target, headerunit) +function _is_duplicated_headerunit(target, key) local mapper = get_target_module_mapper(target) - local key = hash.md5(path.normalize(headerunit.path)) - - -- for _, mapped in pairs(mapper) do - -- print("CHECK", mapped.key, key) - -- if mapped.key == key then - -- return true - -- end - -- end - - return false + for _, mapped in pairs(mapper) do + if mapped.key == key then + return mapped + end + end end function _builder(target) @@ -363,7 +358,13 @@ end -- add a headerunit to target mapper function add_headerunit_to_target_mapper(target, headerunit, bmifile) local mapper = get_target_module_mapper(target) - mapper[headerunit.name] = {name = headerunit.name, key = path.normalize(headerunit.path), headerunit = headerunit, bmi = bmifile} - return _is_duplicated_headerunit(target, headerunit) + local key = hash.uuid(path.normalize(headerunit.path)) + local deduplicated = _is_duplicated_headerunit(target, key) + if deduplicated then + mapper[headerunit.name] = {name = headerunit.name, key = key, aliasof = deduplicated.name} + else + mapper[headerunit.name] = {name = headerunit.name, key = key, headerunit = headerunit, bmi = bmifile} + end + return deduplicated and true or false end |
