diff options
| author | ruki <[email protected]> | 2018-10-14 22:23:08 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-10-14 22:23:08 +0800 |
| commit | 65f989753d3e3f64dc61bcb37e3725423297bfa7 (patch) | |
| tree | 54ae7d9615e5a97fb4d5879842b62c75c491df94 /xmake/modules/detect/tools/find_dmd.lua | |
| parent | 59610ab1ed230b70fa1e403eb05f60df40df8640 (diff) | |
fix missing rc.exe and add find_vswhere
Diffstat (limited to 'xmake/modules/detect/tools/find_dmd.lua')
| -rw-r--r-- | xmake/modules/detect/tools/find_dmd.lua | 28 |
1 files changed, 20 insertions, 8 deletions
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 |
