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.lua61
-rw-r--r--xmake/modules/detect/tools/find_rc.lua5
-rw-r--r--xmake/modules/detect/tools/find_vsjitdebugger.lua2
3 files changed, 67 insertions, 1 deletions
diff --git a/xmake/modules/detect/tools/find_devenv.lua b/xmake/modules/detect/tools/find_devenv.lua
new file mode 100644
index 000000000..ce633e649
--- /dev/null
+++ b/xmake/modules/detect/tools/find_devenv.lua
@@ -0,0 +1,61 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed 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 - 2019, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_devenv.lua
+--
+
+-- imports
+import("core.project.config")
+
+-- find devenv
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local devenv = find_devenv()
+--
+-- @endcode
+--
+function main(opt)
+
+ -- not on windows?
+ if not is_host("windows") then
+ return
+ end
+
+ -- disable to check version
+ opt = opt or {}
+ opt.command = function () end
+
+ -- find it from %DevEnvdir%
+ -- 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")
+ end
+ end
+ end
+ return program
+end
+
diff --git a/xmake/modules/detect/tools/find_rc.lua b/xmake/modules/detect/tools/find_rc.lua
index cadf9fc6e..4157bcca4 100644
--- a/xmake/modules/detect/tools/find_rc.lua
+++ b/xmake/modules/detect/tools/find_rc.lua
@@ -37,6 +37,11 @@ import("lib.detect.find_programver")
--
function main(opt)
+ -- not on windows?
+ if not is_host("windows") then
+ return
+ end
+
-- init options
opt = opt or {}
opt.check = opt.check or "-?"
diff --git a/xmake/modules/detect/tools/find_vsjitdebugger.lua b/xmake/modules/detect/tools/find_vsjitdebugger.lua
index 7f5c647af..b8fb6245f 100644
--- a/xmake/modules/detect/tools/find_vsjitdebugger.lua
+++ b/xmake/modules/detect/tools/find_vsjitdebugger.lua
@@ -39,7 +39,7 @@ import("lib.detect.find_programver")
function main(opt)
-- not on windows?
- if os.host() ~= "windows" then
+ if not is_host("windows") then
return
end