Skip to content

Commit

Permalink
Add package:vrunv
Browse files Browse the repository at this point in the history
  • Loading branch information
SirLynix authored Mar 25, 2024
1 parent bef5a46 commit 8e5aa7f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions xmake/core/package/package.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,24 @@ function _instance:check_mxxsnippets(snippets, opt)
return sandbox_module.import("lib.detect.check_mxxsnippets", {anonymous = true})(snippets, opt)
end

-- runs an executable, passing package toolchain envs
function _instance:vrunv(program, argv, opt)
opt = opt or {}
-- pass toolchain runenvs to avoid missing DLL errors
if self:is_plat("windows") then
local msvc = self:toolchain("msvc")
if msvc and msvc:check() then
opt.envs = os.joinenvs(msvc:runenvs(), opt.envs)
end
elseif self:is_plat("mingw") then
local mingw = self:toolchain("mingw")
if mingw and mingw:check() then
opt.envs = os.joinenvs(mingw:runenvs(), opt.envs)
end
end
os.vrunv(program, argv, opt)
end

-- the current mode is belong to the given modes?
function package._api_is_mode(interp, ...)
return config.is_mode(...)
Expand Down

0 comments on commit 8e5aa7f

Please sign in to comment.