diff options
| author | ruki <[email protected]> | 2026-03-16 23:49:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-16 23:49:33 +0800 |
| commit | 495d8e9f70608edf20f9b719df96312a21ae78c3 (patch) | |
| tree | 9d7af3d6035f72761e8fc814eb64192c9640512d | |
| parent | 8aa975d2fc26c603146c933684aba299bd3dc60c (diff) | |
pass opt to buildargv
| -rw-r--r-- | xmake/core/tool/compiler.lua | 83 |
1 files changed, 2 insertions, 81 deletions
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua index dce7bf532..1afa7165e 100644 --- a/xmake/core/tool/compiler.lua +++ b/xmake/core/tool/compiler.lua @@ -203,73 +203,6 @@ function compiler.load(sourcekind, target) return instance end ---[[ --- build the source files (compile and link) -function compiler:build(sourcefiles, targetfile, opt) - opt = opt or {} - local target = opt.target or self:target() - if not opt.target and target then - opt = table.copy(opt) - opt.target = target - end - - -- get compile flags - local compflags = opt.compflags - if not compflags then - -- patch sourcefile to get flags of the given source file - if type(sourcefiles) == "string" then - opt.sourcefile = sourcefiles - end - compflags = self:compflags(opt) - end - - -- make flags - local flags = compflags - if target then - flags = table.join(flags, target:linkflags()) - end - - -- get target kind - local targetkind = opt.targetkind - if not targetkind and target and target.targetkind then - targetkind = target:kind() - end - return sandbox.load(self:_tool().build, self:_tool(), sourcefiles, targetkind or "binary", targetfile, flags, opt) -end - --- get the build arguments list (compile and link) -function compiler:buildargv(sourcefiles, targetfile, opt) - opt = opt or {} - local target = opt.target or self:target() - if not opt.target and target then - opt = table.copy(opt) - opt.target = target - end - - -- get compile flags - local compflags = opt.compflags - if not compflags then - -- patch sourcefile to get flags of the given source file - if type(sourcefiles) == "string" then - opt.sourcefile = sourcefiles - end - compflags = self:compflags(opt) - end - - -- make flags - local flags = compflags - if target then - flags = table.join(flags, target:linkflags()) - end - - -- get target kind - local targetkind = opt.targetkind - if not targetkind and target and target.targetkind then - targetkind = target:kind() - end - return self:_tool():buildargv(sourcefiles, targetkind or "binary", targetfile, flags, opt) -end]] - -- build the source files (compile and link) function compiler:build(sourcefiles, targetfile, opt) opt = opt or {} @@ -295,7 +228,7 @@ function compiler:build(sourcefiles, targetfile, opt) if not targetkind and opt.target and opt.target.targetkind then targetkind = opt.target:kind() end - return sandbox.load(self:_tool().build, self:_tool(), sourcefiles, targetkind or "binary", targetfile, flags) + return sandbox.load(self:_tool().build, self:_tool(), sourcefiles, targetkind or "binary", targetfile, flags, opt) end -- get the build arguments list (compile and link) @@ -323,7 +256,7 @@ function compiler:buildargv(sourcefiles, targetfile, opt) if not targetkind and opt.target and opt.target.targetkind then targetkind = opt.target:kind() end - return self:_tool():buildargv(sourcefiles, targetkind or "binary", targetfile, flags) + return self:_tool():buildargv(sourcefiles, targetkind or "binary", targetfile, flags, opt) end -- get the build command @@ -334,12 +267,6 @@ end -- compile the source files function compiler:compile(sourcefiles, objectfile, opt) opt = opt or {} - --[[ - local target = opt.target or self:target() - if not opt.target and target then - opt = table.copy(opt) - opt.target = target - end]] -- get compile flags local compflags = opt.compflags @@ -363,12 +290,6 @@ end -- get the compile arguments list function compiler:compargv(sourcefiles, objectfile, opt) opt = opt or {} - --[[ - local target = opt.target or self:target() - if not opt.target and target then - opt = table.copy(opt) - opt.target = target - end]] -- get compile flags local compflags = opt.compflags |
