Compare commits

...

4 Commits

Author SHA1 Message Date
ruki 0093820554
Merge 3260d857fb into cd6663abb6 2024-10-16 15:04:52 +08:00
ruki cd6663abb6 fix armclang #5719 2024-10-16 22:51:12 +08:00
ruki 5393bc0d2b fix pacman find_package #5720 2024-10-16 22:50:31 +08:00
ruki 3260d857fb improve clang-tidy to support multiple sourcefiles 2024-09-10 00:53:59 +08:00
3 changed files with 10 additions and 16 deletions

View File

@ -184,7 +184,7 @@ function main(name, opt)
end end
-- get package files list -- get package files list
list = name and try { function() return os.iorunv(pacman.program, {"-Q", "-l", name}) end } local list = name and try { function() return os.iorunv(pacman.program, {"-Q", "-l", name}) end }
if not list then if not list then
return return
end end

View File

@ -81,8 +81,8 @@ function _add_target_files(sourcefiles, target)
end end
end end
-- check sourcefile -- check sourcefiles
function _check_sourcefile(clang_tidy, sourcefile, opt) function _check_sourcefiles(clang_tidy, sourcefiles, opt)
opt = opt or {} opt = opt or {}
local projectdir = project.directory() local projectdir = project.directory()
local argv = {} local argv = {}
@ -108,10 +108,12 @@ function _check_sourcefile(clang_tidy, sourcefile, opt)
if opt.quiet then if opt.quiet then
table.insert(argv, "--quiet") table.insert(argv, "--quiet")
end end
if not path.is_absolute(sourcefile) then for _, sourcefile in ipairs(sourcefiles) do
sourcefile = path.absolute(sourcefile, projectdir) if not path.is_absolute(sourcefile) then
sourcefile = path.absolute(sourcefile, projectdir)
end
table.insert(argv, sourcefile)
end end
table.insert(argv, sourcefile)
os.execv(clang_tidy, argv, {curdir = projectdir}) os.execv(clang_tidy, argv, {curdir = projectdir})
end end
@ -164,15 +166,7 @@ function _check(clang_tidy, opt)
end end
-- check files -- check files
local jobs = tonumber(opt.jobs or "1") _check_sourcefiles(clang_tidy, sourcefiles, opt)
runjobs("check_files", function (index)
local sourcefile = sourcefiles[index]
if sourcefile then
_check_sourcefile(clang_tidy, sourcefile, opt)
end
end, {total = #sourcefiles,
comax = jobs,
isolate = true})
end end
function main(argv) function main(argv)

View File

@ -39,7 +39,7 @@ toolchain("armclang")
toolchain:config_set("sdkdir", mdk.sdkdir_armclang) toolchain:config_set("sdkdir", mdk.sdkdir_armclang)
-- different assembler choices for different versions of armclang -- different assembler choices for different versions of armclang
local armclang = find_tool("armclang", {version = true, force = true, paths = path.join(mdk.sdkdir_armclang, "bin")}) local armclang = find_tool("armclang", {version = true, force = true, paths = path.join(mdk.sdkdir_armclang, "bin")})
if armclang and semver.compare(armclang.version, "6.13") > 0 then if armclang and armclang.version and semver.compare(armclang.version, "6.13") > 0 then
toolchain:config_set("toolset_as", "armclang") toolchain:config_set("toolset_as", "armclang")
else else
toolchain:config_set("toolset_as", "armasm") toolchain:config_set("toolset_as", "armasm")