summaryrefslogtreecommitdiff
path: root/xmake/core/project/project.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-04-11 22:39:34 +0800
committerGitHub <[email protected]>2026-04-11 22:39:34 +0800
commitb1fa41d52b72eed6d55982ace4af94b60d6948de (patch)
tree0aceb4eaf6f322579c1c3071e068424e9c0c2d6e /xmake/core/project/project.lua
parent151d094ca9bc0c7ab6f31561af5e998bacfe35c7 (diff)
parent5522c0c028562b4ede39bd5dbc5ee0aba91b4049 (diff)
Merge pull request #7478 from xmake-io/toolchain
Improve custom toolchain
Diffstat (limited to 'xmake/core/project/project.lua')
-rw-r--r--xmake/core/project/project.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index beab21a22..2ea22e655 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -215,6 +215,22 @@ function project._api_add_toolchaindirs(interp, ...)
dir = path.absolute(dir, scriptdir)
end
toolchain.add_directories(dir)
+ -- auto-register modules directories under each toolchain
+ -- e.g. toolchains/my-c6000/modules/ will be added as module search path
+ -- so that custom toolchain can bundle its tool modules together
+ local toolchain_subdirs = os.dirs(path.join(dir, "*"))
+ if toolchain_subdirs then
+ local modulesdirs = {}
+ for _, toolchain_subdir in ipairs(toolchain_subdirs) do
+ local modulesdir = path.join(toolchain_subdir, "modules")
+ if os.isdir(modulesdir) then
+ table.insert(modulesdirs, modulesdir)
+ end
+ end
+ if #modulesdirs > 0 then
+ sandbox_module.add_directories(table.unpack(modulesdirs))
+ end
+ end
end
end