Skip to content

Commit ea213b5

Browse files
committed
Enhance environment variable handling in find_concerto_pkg_generator.lua for Windows support
1 parent 286a89a commit ea213b5

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

Xmake/rules/find_concerto_pkg_generator.lua

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,25 @@ rule("find_cct_pkg_generator")
1010
dir = path.join(cctPkgGen:installdir(), "bin")
1111
else
1212
cctPkgGen = project.target("concerto-pkg-generator")
13-
if cctPkgGen then
14-
dir = cctPkgGen:targetdir()
15-
envs = cctPkgGen:get("runenvs")
16-
if not envs and os.host() == "linux" or os.host() == "macosx" then
17-
envs = {}
18-
for _, pkg in ipairs(cctPkgGen:orderpkgs()) do
19-
local installDir = path.join(pkg:installdir(), "lib")
20-
envs.LD_LIBRARY_PATH = installDir .. path.envsep() .. (envs.LD_LIBRARY_PATH or "")
21-
end
22-
end
23-
13+
end
14+
15+
if cctPkgGen then
16+
dir = cctPkgGen:targetdir()
17+
envs = cctPkgGen:get("runenvs")
18+
if not envs then
19+
envs = {}
20+
for _, pkg in ipairs(cctPkgGen:orderpkgs()) do
21+
if os.host() == "linux" or os.host() == "macosx" then
22+
local installDir = path.join(pkg:installdir(), "lib")
23+
envs.LD_LIBRARY_PATH = installDir .. path.envsep() .. (envs.LD_LIBRARY_PATH or "")
24+
elseif os.host() == "windows" then
25+
local installDir = path.join(pkg:installdir(), "bin")
26+
envs.PATH = installDir .. path.envsep() .. (envs.PATH or "")
27+
end
28+
end
2429
end
2530
end
31+
print(envs)
2632
local program = find_tool("concerto-pkg-generator", {version = false, paths = dir, envs = envs})
2733
target:data_set("concerto-pkg-generator", program)
2834
target:data_set("concerto-pkg-generator-envs", envs)

0 commit comments

Comments
 (0)