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/tools/find_devenv.lua | |
| parent | e037a04e699bd67832024fdd6729e0ea835784e2 (diff) | |
uses devenv to load and debug win program
Diffstat (limited to 'xmake/modules/detect/tools/find_devenv.lua')
| -rw-r--r-- | xmake/modules/detect/tools/find_devenv.lua | 61 |
1 files changed, 61 insertions, 0 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 + |
