summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/detect/tools')
-rw-r--r--xmake/modules/detect/tools/find_devenv.lua12
-rw-r--r--xmake/modules/detect/tools/find_lib.lua4
-rw-r--r--xmake/modules/detect/tools/find_rc.lua16
3 files changed, 15 insertions, 17 deletions
diff --git a/xmake/modules/detect/tools/find_devenv.lua b/xmake/modules/detect/tools/find_devenv.lua
index 745c26099..1111c92a3 100644
--- a/xmake/modules/detect/tools/find_devenv.lua
+++ b/xmake/modules/detect/tools/find_devenv.lua
@@ -20,6 +20,7 @@
-- imports
import("core.project.config")
+import("core.tool.toolchain")
-- find devenv
--
@@ -48,11 +49,12 @@ function main(opt)
-- e.g. C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
--
local program = nil
- local vcvarsall = config.get("__vcvarsall")
- if vcvarsall then
- for _, vsvars in pairs(vcvarsall) do
- if vsvars.DevEnvdir and os.isexec(path.join(vsvars.DevEnvdir, "devenv.exe")) then
- program = path.join(vsvars.DevEnvdir, "devenv.exe")
+ local msvc = toolchain.load("msvc")
+ if msvc then
+ local vcvars = msvc:config("vcvars")
+ if vcvars then
+ if vcvars.DevEnvdir and os.isexec(path.join(vcvars.DevEnvdir, "devenv.exe")) then
+ program = path.join(vcvars.DevEnvdir, "devenv.exe")
end
end
end
diff --git a/xmake/modules/detect/tools/find_lib.lua b/xmake/modules/detect/tools/find_lib.lua
index f3c5806ee..b01960e25 100644
--- a/xmake/modules/detect/tools/find_lib.lua
+++ b/xmake/modules/detect/tools/find_lib.lua
@@ -51,8 +51,8 @@ function main(opt)
io.writefile(sourcefile, "int test(void)\n{return 0;}")
-- check it
- local cl = assert(find_tool("cl"))
- local link = assert(find_tool("link"))
+ local cl = assert(find_tool("cl", {envs = opt.envs}))
+ local link = assert(find_tool("link", {envs = opt.envs}))
os.runv(cl.program, {"-c", "-Fo" .. objectfile, sourcefile}, {envs = opt.envs})
os.runv(link.program, {"-lib", "-out:" .. libraryfile, objectfile}, {envs = opt.envs})
verinfo = os.iorunv(program, {"-list", libraryfile}, {envs = opt.envs})
diff --git a/xmake/modules/detect/tools/find_rc.lua b/xmake/modules/detect/tools/find_rc.lua
index 5edd8d69c..a36cd25bb 100644
--- a/xmake/modules/detect/tools/find_rc.lua
+++ b/xmake/modules/detect/tools/find_rc.lua
@@ -57,16 +57,12 @@ function main(opt)
--
-- e.g. C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64
--
- local arch = opt.arch or config.arch() or os.arch()
- local vcvarsall = config.get("__vcvarsall")
- if vcvarsall then
- local vcvars = vcvarsall[arch]
- if vcvars and vcvars.WindowsSdkDir and vcvars.WindowsSDKVersion then
- local bindir = path.join(vcvars.WindowsSdkDir, "bin", vcvars.WindowsSDKVersion, arch)
- if os.isdir(bindir) then
- opt.paths = opt.paths or {}
- table.insert(opt.paths, bindir)
- end
+ local envs = opt.envs
+ if envs and envs.WindowsSdkDir and envs.WindowsSDKVersion then
+ local bindir = path.join(envs.WindowsSdkDir, "bin", envs.WindowsSDKVersion, arch)
+ if os.isdir(bindir) then
+ opt.paths = opt.paths or {}
+ table.insert(opt.paths, bindir)
end
end