diff options
| author | ruki <[email protected]> | 2021-02-18 00:39:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-18 00:39:45 +0800 |
| commit | 95f51bf95445d86e9cfddfb11b0d3897fc06cd15 (patch) | |
| tree | ddd778260be0661ce7bdd47d548cac37288e2ab6 /xmake/modules/detect/tools/find_dumpbin.lua | |
| parent | 7041777d5967a33c9739c60a07ad3a7f5c4f888e (diff) | |
add find_dumpbin
Diffstat (limited to 'xmake/modules/detect/tools/find_dumpbin.lua')
| -rw-r--r-- | xmake/modules/detect/tools/find_dumpbin.lua | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_dumpbin.lua b/xmake/modules/detect/tools/find_dumpbin.lua new file mode 100644 index 000000000..4520e84c1 --- /dev/null +++ b/xmake/modules/detect/tools/find_dumpbin.lua @@ -0,0 +1,55 @@ +--!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 ruki +-- @file find_dumpbin.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find cl +-- +-- @param opt the argument options, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local cl = find_dumpbin() +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + opt.check = opt.check or function (program) os.runv(program, {"/symbols"}, {envs = opt.envs}) end + + -- find program + local program = find_program(opt.program or "dumpbin.exe", opt) + + -- find program version + local version = nil + if program and opt and opt.version then + opt.command = opt.command or function () local info = os.iorunv(program, {"/symbols"}, {envs = opt.envs}); return info end + opt.parse = opt.parse or function (output) return output:match("Version (%d+%.?%d*%.?%d*.-)%s") end + version = find_programver(program, opt) + end + return program, version +end + |
