diff options
| author | ruki <[email protected]> | 2022-05-22 12:06:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-22 12:06:52 +0800 |
| commit | 9d7ff9055927118fab28537d204d4bb331842826 (patch) | |
| tree | 7bd3d24ce83a7f1d860bfc933d38650978c20d34 /xmake/modules/private/utils/batchcmds.lua | |
| parent | c990367664d6389990cb37c5a0ae4e9157d7b24e (diff) | |
wrap path for batchcmds
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
| -rw-r--r-- | xmake/modules/private/utils/batchcmds.lua | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua index bb5204072..8a31f7afd 100644 --- a/xmake/modules/private/utils/batchcmds.lua +++ b/xmake/modules/private/utils/batchcmds.lua @@ -222,13 +222,24 @@ function batchcmds:compile(sourcefiles, objectfile, opt) opt = opt or {} opt.target = self._TARGET + -- wrap path for sourcefiles + if type(sourcefiles) == "table" then + local sourcefiles_wrap = {} + for _, sourcefile in ipairs(sourcefiles) do + table.insert(sourcefiles_wrap, path(sourcefile)) + end + sourcefiles = sourcefiles_wrap + else + sourcefiles = path(sourcefiles) + end + -- load compiler and get compilation command local sourcekind = opt.sourcekind if not sourcekind and type(sourcefiles) == "string" then sourcekind = language.sourcekind_of(sourcefiles) end local compiler_inst = compiler.load(sourcekind, opt) - local program, argv = compiler_inst:compargv(sourcefiles, objectfile, opt) + local program, argv = compiler_inst:compargv(sourcefiles, path(objectfile), opt) -- add compilation command and bind run environments of compiler self:mkdir(path.directory(objectfile)) @@ -243,9 +254,16 @@ function batchcmds:link(objectfiles, targetfile, opt) opt = opt or {} opt.target = target + -- wrap path for objectfiles + local objectfiles_wrap = {} + for _, objectfile in ipairs(objectfiles) do + table.insert(objectfiles_wrap, path(objectfile)) + end + objectfiles = objectfiles_wrap + -- load linker and get link command local linker_inst = target and target:linker() or linker.load(opt.targetkind, opt.sourcekinds, opt) - local program, argv = linker_inst:linkargv(objectfiles, targetfile, opt) + local program, argv = linker_inst:linkargv(objectfiles, path(targetfile), opt) -- add link command and bind run environments of linker self:mkdir(path.directory(targetfile)) |
