summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-10-18 22:57:48 +0800
committerruki <[email protected]>2018-10-18 11:46:53 +0800
commitd81ec1fbea02cac09cee3fa04ac2d8876425eb0b (patch)
treecbcfcf8b8c311a1fe56206e9e67da88c78098695
parent3ae8c87c61b28be22e944235e3c4c23ff49d2584 (diff)
revert find_dmd.lua
-rw-r--r--xmake/modules/detect/tools/find_dmd.lua28
1 files changed, 8 insertions, 20 deletions
diff --git a/xmake/modules/detect/tools/find_dmd.lua b/xmake/modules/detect/tools/find_dmd.lua
index 70dcbacdd..2e450fde0 100644
--- a/xmake/modules/detect/tools/find_dmd.lua
+++ b/xmake/modules/detect/tools/find_dmd.lua
@@ -19,46 +19,34 @@
-- Copyright (C) 2015 - 2018, TBOOX Open Source Group.
--
-- @author ruki
--- @file find_vswhere.lua
+-- @file find_dmd.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
--- find vswhere
+-- find dmd
--
--- @param opt the argument options, .e.g {version = true, program = "c:\xxx\vswhere.exe"}
+-- @param opt the argument options, .e.g {version = true}
--
-- @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"})
+-- local dmd = find_dmd()
--
-- @endcode
--
function main(opt)
- -- not on windows?
- if not is_host("windows") then
- return
- end
-
-- init options
- opt = opt or {}
+ 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
-- find program
- 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)
+ local program = find_program(opt.program or "dmd", opt)
-- find program version
local version = nil