summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-04-11 20:15:02 +0800
committerruki <[email protected]>2026-04-11 20:15:02 +0800
commit8d8601bb1655094e1c711f8a48150453f076b5d1 (patch)
tree947cd318273fea6b592b2a2d34cce72707ab17aa
parent151d094ca9bc0c7ab6f31561af5e998bacfe35c7 (diff)
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.lua12
8 files changed, 12 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..5376f406d 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -215,6 +215,18 @@ 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
+ for _, toolchain_subdir in ipairs(toolchain_subdirs) do
+ local modulesdir = path.join(toolchain_subdir, "modules")
+ if os.isdir(modulesdir) then
+ sandbox_module.add_directories(modulesdir)
+ end
+ end
+ end
end
end