summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-07-28 16:47:10 +0800
committerGitHub <[email protected]>2025-07-28 16:47:10 +0800
commitb3d31f41800d12235e56260e7e34821b8200dfe4 (patch)
treec362291b301892c15f2b277630d3ffc95cd71928
parent16fb087ad29883bd2ea4bc082be2cda621b578c1 (diff)
parent650b30b94c8a5a0a0e6113cf4e7bc4bc5e50904c (diff)
Merge pull request #6656 from Redbeanw44602/dev
Make build tools support passing in `opt.targets`.
-rw-r--r--xmake/modules/package/tools/cmake.lua8
-rw-r--r--xmake/modules/package/tools/gn.lua4
-rw-r--r--xmake/modules/package/tools/ninja.lua2
-rw-r--r--xmake/modules/package/tools/xmake.lua8
4 files changed, 11 insertions, 11 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 90b2530ee..b677a8f0f 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -1075,7 +1075,7 @@ end
-- do build for make
function _build_for_make(package, configs, opt)
local argv = {}
- local targets = table.wrap(opt.target)
+ local targets = table.wrap(opt.targets or opt.target)
if #targets ~= 0 then
table.join2(argv, targets)
end
@@ -1110,7 +1110,7 @@ function _build_for_ninja(package, configs, opt)
_fix_pdbdir_for_ninja(package)
ninja.build(package, {}, {envs = opt.envs or buildenvs(package, opt),
jobs = opt.jobs,
- target = opt.target})
+ targets = opt.targets or opt.target})
end
-- do build for cmake/build
@@ -1121,7 +1121,7 @@ function _build_for_cmakebuild(package, configs, opt)
table.insert(argv, "--config")
table.insert(argv, opt.config)
end
- local targets = table.wrap(opt.target)
+ local targets = table.wrap(opt.targets or opt.target)
if #targets ~= 0 then
table.insert(argv, "--target")
if #targets > 1 then
@@ -1199,7 +1199,7 @@ function _install_for_ninja(package, configs, opt)
_fix_pdbdir_for_ninja(package)
ninja.install(package, {}, {envs = opt.envs or buildenvs(package, opt),
jobs = opt.jobs,
- target = opt.target})
+ targets = opt.targets or opt.target})
end
-- do install for cmake/build
diff --git a/xmake/modules/package/tools/gn.lua b/xmake/modules/package/tools/gn.lua
index 5558860c6..7813b14be 100644
--- a/xmake/modules/package/tools/gn.lua
+++ b/xmake/modules/package/tools/gn.lua
@@ -127,7 +127,7 @@ function build(package, configs, opt)
-- do build
local builddir = _get_builddir(opt)
- local targets = table.wrap(opt.target)
+ local targets = table.wrap(opt.targets or opt.target)
ninja.build(package, targets, {builddir = builddir, envs = opt.envs or buildenvs(package, opt)})
end
@@ -140,6 +140,6 @@ function install(package, configs, opt)
-- do build and install
local builddir = _get_builddir(opt)
- local targets = table.wrap(opt.target)
+ local targets = table.wrap(opt.targets or opt.target)
ninja.install(package, targets, {builddir = builddir, envs = opt.envs or buildenvs(package, opt)})
end
diff --git a/xmake/modules/package/tools/ninja.lua b/xmake/modules/package/tools/ninja.lua
index 4aab472ec..168266c47 100644
--- a/xmake/modules/package/tools/ninja.lua
+++ b/xmake/modules/package/tools/ninja.lua
@@ -31,7 +31,7 @@ function _default_argv(package, configs, opt)
end
local argv = {}
- local targets = table.wrap(opt.target)
+ local targets = table.wrap(opt.targets or opt.target)
if #targets ~= 0 then
table.join2(argv, targets)
end
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index 54f766f71..f8b48bb41 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -527,16 +527,16 @@ function install(package, configs, opt)
if njob then
table.insert(argv, "--jobs=" .. njob)
end
- local target = table.wrap(opt.target)
- if #target ~= 0 then
- table.join2(argv, target)
+ local targets = table.wrap(opt.targets or opt.target)
+ if #targets ~= 0 then
+ table.join2(argv, targets)
end
os.vrunv(os.programfile(), argv, {envs = envs})
-- do install
argv = {"install", "-y", "--nopkgs", "-o", package:installdir()}
_set_builtin_argv(package, argv)
- local targets = table.wrap(opt.target)
+ local targets = table.wrap(opt.targets or opt.target)
if #targets ~= 0 then
table.join2(argv, targets)
end