summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-10-15 22:55:25 +0800
committerruki <[email protected]>2018-10-15 11:32:31 +0800
commit254c4084d7cbf9882d9b09da049ae5d06b491654 (patch)
tree73518658ed166c4eeb6fb4d8003618561a84d23e
parent68a27547cfdd4157162b6b536f4dc8c2c04786e8 (diff)
improve find_rc
-rw-r--r--xmake/modules/detect/sdks/find_vstudio.lua18
-rw-r--r--xmake/modules/detect/tools/find_rc.lua23
2 files changed, 23 insertions, 18 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua
index b4014e2d0..2e8083768 100644
--- a/xmake/modules/detect/sdks/find_vstudio.lua
+++ b/xmake/modules/detect/sdks/find_vstudio.lua
@@ -108,24 +108,6 @@ function _load_vcvarsall(vcvarsall, arch)
variables["UCRTVersion"] = UCRTVersion
end
- -- fix rc.exe missing issues
- --
- -- @see https://github.com/tboox/xmake/issues/225
- -- https://stackoverflow.com/questions/43847542/rc-exe-no-longer-found-in-vs-2015-command-prompt/45319119
- --
- -- patch sdk bin directory to path environment
- --
- -- .e.g C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64
- --
- local WindowsSdkDir = variables["WindowsSdkDir"]
- if WindowsSdkDir and WindowsSDKVersion then
- local pathes = variables["path"]
- local bindir = path.join(WindowsSdkDir, "bin", WindowsSDKVersion, arch)
- if os.isdir(bindir) and pathes then
- variables["path"] = pathes .. ';' .. bindir
- end
- end
-
-- ok
return variables
end
diff --git a/xmake/modules/detect/tools/find_rc.lua b/xmake/modules/detect/tools/find_rc.lua
index ab55e3a1e..ae2e17284 100644
--- a/xmake/modules/detect/tools/find_rc.lua
+++ b/xmake/modules/detect/tools/find_rc.lua
@@ -23,6 +23,7 @@
--
-- imports
+import("core.project.config")
import("lib.detect.find_program")
import("lib.detect.find_programver")
@@ -46,6 +47,28 @@ function main(opt)
opt.command = opt.command or "-?"
opt.parse = opt.parse or function (output) return output:match("Version (%d+%.?%d*%.?%d*.-)%s") end
+ -- fix rc.exe missing issues
+ --
+ -- @see https://github.com/tboox/xmake/issues/225
+ -- https://stackoverflow.com/questions/43847542/rc-exe-no-longer-found-in-vs-2015-command-prompt/45319119
+ --
+ -- patch sdk bin directory to path environment
+ --
+ -- .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] or {}
+ if vcvars.WindowsSdkDir and vcvars.WindowsSDKVersion then
+ local bindir = path.join(vcvars.WindowsSdkDir, "bin", vcvars.WindowsSDKVersion, arch)
+ if os.isdir(bindir) then
+ opt.pathes = opt.pathes or {}
+ table.insert(opt.pathes, bindir)
+ end
+ end
+ end
+
-- find program
local program = find_program(opt.program or "rc.exe", opt)