summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools/find_meson.lua
diff options
context:
space:
mode:
authorxq114 <[email protected]>2023-02-16 13:53:47 +0800
committerxq114 <[email protected]>2023-02-16 13:53:47 +0800
commit08eac51e8874519707627a0d79809ac8cd60a9f5 (patch)
treec3a5524d2f58539db81938020cac5ff8a08035e4 /xmake/modules/detect/tools/find_meson.lua
parent7fd2cec12bf091a8695fa50009e7399447f4622d (diff)
improve meson for flexible build
Diffstat (limited to 'xmake/modules/detect/tools/find_meson.lua')
-rw-r--r--xmake/modules/detect/tools/find_meson.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_meson.lua b/xmake/modules/detect/tools/find_meson.lua
new file mode 100644
index 000000000..e85f537d5
--- /dev/null
+++ b/xmake/modules/detect/tools/find_meson.lua
@@ -0,0 +1,54 @@
+--!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_meson.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find meson
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local meson = find_meson()
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "meson", 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
+