diff options
| -rw-r--r-- | xmake/core/project/project.lua | 3 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index 5a069f644..043ff3cfa 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -417,7 +417,8 @@ function project._load_targets() for _, sourcefile in ipairs(table.wrap(t:get("files"))) do local extension = path.extension((sourcefile:gsub("|.*$", ""))) if not extensions[extension] then - local lang = language.load_ex(extension) + local sourcekind = t:extraconf("files", sourcefile, "sourcekind") + local lang = sourcekind and language.load_sk(sourcekind) or language.load_ex(extension) if lang and lang:rules() then table.join2(rulenames, lang:rules()) end diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 6f4ad4d89..eb29ed952 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -201,7 +201,8 @@ function _instance:_update_filerules() for _, sourcefile in ipairs(table.wrap(self:get("files"))) do local extension = path.extension((sourcefile:gsub("|.*$", ""))) if not extensions[extension] then - local lang = language.load_ex(extension) + local sourcekind = self:extraconf("files", sourcefile, "sourcekind") + local lang = sourcekind and language.load_sk(sourcekind) or language.load_ex(extension) if lang and lang:rules() then table.join2(rulenames, lang:rules()) end @@ -1859,7 +1860,8 @@ function _instance:filerules(sourcefile) local filename = path.filename(sourcefile):lower() for _, r in ipairs(table.wrap(key2rules[path.extension(filename, 2)] or key2rules[path.extension(filename)] or - key2rules[self:sourcekind_of(filename)])) do + key2rules[self:sourcekind_of(filename)] or + key2rules[fileconfig and fileconfig.sourcekind])) do -- add_files("*.nasm", {sourcekind = "asm"}) if self:extraconf("rules", r:name(), "override") then table.insert(rules_override, r) else |
