diff options
| author | ruki <[email protected]> | 2019-09-21 00:49:28 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-09-20 22:56:48 +0800 |
| commit | 8e57109a69c4c19be728e7797124f8ff5a4a6e35 (patch) | |
| tree | c09f0509c7fa941444884e1a0dd628d6b9afdd98 /xmake/modules/detect | |
| parent | e037a04e699bd67832024fdd6729e0ea835784e2 (diff) | |
uses devenv to load and debug win program
Diffstat (limited to 'xmake/modules/detect')
| -rw-r--r-- | xmake/modules/detect/tools/find_devenv.lua | 61 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_rc.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_vsjitdebugger.lua | 2 |
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 |
