summaryrefslogtreecommitdiff
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
parent151d094ca9bc0c7ab6f31561af5e998bacfe35c7 (diff)
parent5522c0c028562b4ede39bd5dbc5ee0aba91b4049 (diff)
Merge pull request #7478 from xmake-io/toolchain
Improve custom toolchain
-rw-r--r--tests/apis/custom_toolchain/xmake.lua1
-rw-r--r--tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/ar6x.lua (renamed from tests/apis/custom_toolchain/xmake/modules/core/tools/ar6x.lua)0
-rw-r--r--tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x.lua (renamed from tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua)0
-rw-r--r--tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x/has_flags.lua (renamed from tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua)0
-rw-r--r--tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x/parse_deps.lua (renamed from tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/parse_deps.lua)0
-rw-r--r--tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/detect/tools/find_ar6x.lua (renamed from tests/apis/custom_toolchain/xmake/modules/detect/tools/find_ar6x.lua)0
-rw-r--r--tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/detect/tools/find_cl6x.lua (renamed from tests/apis/custom_toolchain/xmake/modules/detect/tools/find_cl6x.lua)0
-rw-r--r--xmake/core/project/project.lua16
8 files changed, 16 insertions, 1 deletions
diff --git a/tests/apis/custom_toolchain/xmake.lua b/tests/apis/custom_toolchain/xmake.lua
index 03d2b5344..b06229a33 100644
--- a/tests/apis/custom_toolchain/xmake.lua
+++ b/tests/apis/custom_toolchain/xmake.lua
@@ -1,6 +1,5 @@
add_rules("mode.debug", "mode.release")
-add_moduledirs("xmake/modules")
add_toolchaindirs("xmake/toolchains")
set_toolchains("my-c6000")
diff --git a/tests/apis/custom_toolchain/xmake/modules/core/tools/ar6x.lua b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/ar6x.lua
index 7e51734ff..7e51734ff 100644
--- a/tests/apis/custom_toolchain/xmake/modules/core/tools/ar6x.lua
+++ b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/ar6x.lua
diff --git a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x.lua
index 37ceec0b8..37ceec0b8 100644
--- a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua
+++ b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x.lua
diff --git a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x/has_flags.lua
index 629f25c12..629f25c12 100644
--- a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua
+++ b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x/has_flags.lua
diff --git a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/parse_deps.lua b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x/parse_deps.lua
index 301d696aa..301d696aa 100644
--- a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/parse_deps.lua
+++ b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/core/tools/cl6x/parse_deps.lua
diff --git a/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_ar6x.lua b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/detect/tools/find_ar6x.lua
index 2ee4c4853..2ee4c4853 100644
--- a/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_ar6x.lua
+++ b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/detect/tools/find_ar6x.lua
diff --git a/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_cl6x.lua b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/detect/tools/find_cl6x.lua
index 1db484762..1db484762 100644
--- a/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_cl6x.lua
+++ b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/modules/detect/tools/find_cl6x.lua
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