diff options
| author | ruki <[email protected]> | 2019-06-15 09:06:27 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-06-15 09:06:27 +0800 |
| commit | 42ddca8c330acd5928a553fbd562f3a3d2a4700b (patch) | |
| tree | 0fee80537171972b1aa3b4b3987017ff27acf540 | |
| parent | cd6e27d1392acbc56366561fda2bf939e492f16a (diff) | |
add find lex/flex and yacc/bison
| -rw-r--r-- | xmake/modules/detect/tools/find_bison.lua | 54 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_flex.lua | 54 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_lex.lua | 54 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_yacc.lua | 54 |
4 files changed, 216 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_bison.lua b/xmake/modules/detect/tools/find_bison.lua new file mode 100644 index 000000000..89ff96138 --- /dev/null +++ b/xmake/modules/detect/tools/find_bison.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 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_bison.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find bison +-- +-- @param opt the argument options, .e.g {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local bison = find_bison() +-- local bison, version = find_bison({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + + -- find program + local program = find_program(opt.program or "bison", 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 diff --git a/xmake/modules/detect/tools/find_flex.lua b/xmake/modules/detect/tools/find_flex.lua new file mode 100644 index 000000000..f95aea27b --- /dev/null +++ b/xmake/modules/detect/tools/find_flex.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 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_flex.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find flex +-- +-- @param opt the argument options, .e.g {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local flex = find_flex() +-- local flex, version = find_flex({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + + -- find program + local program = find_program(opt.program or "flex", 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 diff --git a/xmake/modules/detect/tools/find_lex.lua b/xmake/modules/detect/tools/find_lex.lua new file mode 100644 index 000000000..c127cf7b6 --- /dev/null +++ b/xmake/modules/detect/tools/find_lex.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 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_lex.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find lex +-- +-- @param opt the argument options, .e.g {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local lex = find_lex() +-- local lex, version = find_lex({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + + -- find program + local program = find_program(opt.program or "lex", 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 diff --git a/xmake/modules/detect/tools/find_yacc.lua b/xmake/modules/detect/tools/find_yacc.lua new file mode 100644 index 000000000..45853b2bb --- /dev/null +++ b/xmake/modules/detect/tools/find_yacc.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 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_yacc.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find yacc +-- +-- @param opt the argument options, .e.g {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local yacc = find_yacc() +-- local yacc, version = find_yacc({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + + -- find program + local program = find_program(opt.program or "yacc", 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 |
