summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-10-14 22:23:08 +0800
committerruki <[email protected]>2018-10-14 22:23:08 +0800
commit65f989753d3e3f64dc61bcb37e3725423297bfa7 (patch)
tree54ae7d9615e5a97fb4d5879842b62c75c491df94
parent59610ab1ed230b70fa1e403eb05f60df40df8640 (diff)
fix missing rc.exe and add find_vswhere
-rw-r--r--xmake/modules/detect/sdks/find_vstudio.lua18
-rw-r--r--xmake/modules/detect/tools/find_dmd.lua28
-rw-r--r--xmake/modules/detect/tools/find_vswhere.lua69
3 files changed, 107 insertions, 8 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua
index ae011d9db..7cf4dca17 100644
--- a/xmake/modules/detect/sdks/find_vstudio.lua
+++ b/xmake/modules/detect/sdks/find_vstudio.lua
@@ -107,6 +107,24 @@ 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_dmd.lua b/xmake/modules/detect/tools/find_dmd.lua
index 2e450fde0..70dcbacdd 100644
--- a/xmake/modules/detect/tools/find_dmd.lua
+++ b/xmake/modules/detect/tools/find_dmd.lua
@@ -19,34 +19,46 @@
-- Copyright (C) 2015 - 2018, TBOOX Open Source Group.
--
-- @author ruki
--- @file find_dmd.lua
+-- @file find_vswhere.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
--- find dmd
+-- find vswhere
--
--- @param opt the argument options, .e.g {version = true}
+-- @param opt the argument options, .e.g {version = true, program = "c:\xxx\vswhere.exe"}
--
-- @return program, version
--
-- @code
--
--- local dmd = find_dmd()
+-- local vswhere = find_vswhere()
+-- local vswhere, version = find_vswhere({version = true})
+-- local vswhere, version = find_vswhere({version = true, program = "c:\xxx\vswhere.exe"})
--
-- @endcode
--
function main(opt)
+ -- not on windows?
+ if not is_host("windows") then
+ return
+ end
+
-- init options
- opt = opt or {}
- opt.command = opt.command or "--version"
- opt.parse = opt.parse or function (output) return output:match("v(%d+%.?%d*%.?%d*.-)%s") end
+ opt = opt or {}
-- find program
- local program = find_program(opt.program or "dmd", opt)
+ opt.check = "/?"
+ opt.command = "/?"
+ opt.pathes = opt.pathes or
+ {
+ path.join(os.getenv("ProgramFiles(x86)"), "Microsoft Visual Studio", "Installer"),
+ path.join(os.getenv("ProgramFiles"), "Microsoft Visual Studio", "Installer"),
+ }
+ local program = find_program(opt.program or "vswhere.exe", opt)
-- find program version
local version = nil
diff --git a/xmake/modules/detect/tools/find_vswhere.lua b/xmake/modules/detect/tools/find_vswhere.lua
new file mode 100644
index 000000000..73fbcfc92
--- /dev/null
+++ b/xmake/modules/detect/tools/find_vswhere.lua
@@ -0,0 +1,69 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2018, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_vswhere.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find vswhere
+--
+-- @param opt the argument options, .e.g {version = true, program = "c:\xxx\vswhere.exe"}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local vswhere = find_vswhere()
+-- local vswhere, version = find_vswhere({version = true})
+-- local vswhere, version = find_vswhere({version = true, program = "c:\xxx\vswhere.exe"})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- not on windows?
+ if not is_host("windows") then
+ return
+ end
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ opt.pathes = opt.pathes or
+ {
+ path.join(os.getenv("ProgramFiles(x86)"), "Microsoft Visual Studio", "Installer", "vswhere.exe"),
+ path.join(os.getenv("ProgramFiles"), "Microsoft Visual Studio", "Installer", "vswhere.exe"),
+ }
+ local program = find_program(opt.program or "vswhere.exe", opt)
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program, opt)
+ end
+
+ -- ok?
+ return program, version
+end