diff options
| author | ruki <[email protected]> | 2021-04-05 14:28:19 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-05 14:28:19 +0800 |
| commit | 0dfd8b4e451abbd646fee5de0b50ee845164f304 (patch) | |
| tree | f5aa257a2e727efe606352b73f738dd3d4647a34 /xmake/modules/detect/tools | |
| parent | aa51e91121a5d4e21deb1f10b536fccfe4cc163e (diff) | |
| parent | 7fc0928774fb5d4e022d85e77fea8f3c29426a80 (diff) | |
Merge pull request #1319 from xq114/dev
add find_bash.lua and find_vulkansdk.lua
Diffstat (limited to 'xmake/modules/detect/tools')
| -rw-r--r-- | xmake/modules/detect/tools/find_bash.lua | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_bash.lua b/xmake/modules/detect/tools/find_bash.lua new file mode 100644 index 000000000..0c1322ad2 --- /dev/null +++ b/xmake/modules/detect/tools/find_bash.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-present, TBOOX Open Source Group. +-- +-- @author xq114 +-- @file find_bash.lua +-- + +-- imports +import("lib.detect.find_tool") +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find bash +-- +-- @param opt the argument options, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local bash = find_bash() +-- local bash, version = find_bash({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + + -- find bash from git for windows + if is_host("windows") then + opt.paths = opt.paths or {} + table.insert(opt.paths, "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\GitForWindows;InstallPath)\\bin") + end + + -- find program + local program = find_program(opt.program or "bash", opt) + + -- find program version + local version = nil + if program and opt and opt.version then + version = find_programver(program, opt) + end + + -- ok? + return program, version +end |
