diff options
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/core/project/project.lua | 16 |
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 |
