Unnamed: 0
int64 0
0
| repo_id
stringlengths 5
186
| file_path
stringlengths 15
223
| content
stringlengths 1
32.8M
⌀ |
---|---|---|---|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_objcopy.lua | --!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_objcopy.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find objcopy
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local objcopy = find_objcopy()
-- local objcopy, version = find_objcopy({program = "xcrun -sdk macosx objcopy", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "objcopy", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_devenv.lua | --!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_devenv.lua
--
-- imports
import("core.project.config")
import("core.tool.toolchain")
-- find devenv
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local devenv = find_devenv()
--
-- @endcode
--
function main(opt)
-- not on windows?
if not is_host("windows") then
return
end
-- disable to check version
opt = opt or {}
opt.command = function () end
-- find it from %DevEnvdir%
-- e.g. C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
--
local program = nil
local msvc = toolchain.load("msvc", {plat = os.host(), arch = os.arch()})
if msvc then
local vcvars = msvc:config("vcvars")
if vcvars then
if vcvars.DevEnvdir and os.isexec(path.join(vcvars.DevEnvdir, "devenv.exe")) then
program = path.join(vcvars.DevEnvdir, "devenv.exe")
end
end
end
return program
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_lua.lua | --!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_lua.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find lua
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local lua = find_lua()
-- local lua, version = find_lua({program = "lua", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-v"
opt.command = opt.command or "-v"
-- find program
local program = find_program(opt.program or "lua", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_cl.lua | --!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_cl.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_cl()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or function (program)
local ok = try { function () os.runv(program, {}, {envs = opt.envs}); return true end }
if not ok then
-- @see https://github.com/xmake-io/xmake/issues/3057
local objectfile = os.tmpfile() .. ".obj"
local sourcefile = os.tmpfile() .. ".c"
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
os.runv(program, {"-c", "-Fo" .. objectfile, sourcefile}, {envs = opt.envs})
os.rm(objectfile)
os.rm(sourcefile)
end
end
-- find program
local program = find_program(opt.program or "cl.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, {}, {envs = opt.envs})
return info
end
opt.parse = opt.parse or function (output)
return output:match("(%d+%.%d+%.%d*.-)%s")
end
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_armasm64_msvc.lua | --!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_armasm64_msvc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_mdk")
-- find armasm
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local armasm = find_armasm64_msvc()
-- local armasm, version = find_armasm64_msvc({program = "armasm64", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = "-h"
-- find program
local program = find_program(opt.program or "armasm64.exe", opt)
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_sudo.lua | --!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_sudo.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find sudo
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local sudo = find_sudo()
-- local sudo, version = find_sudo({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-h"
opt.command = opt.command or "-V"
-- find program
local program = find_program(opt.program or "sudo", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_clang_cl.lua | --!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_clang_cl.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find clang_cl
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local clang_cl = find_clang_cl()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "clang-cl.exe", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_nvcc.lua | --!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_nvcc.lua
--
-- imports
import("private.detect.find_cudatool")
-- find nvcc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local nvcc = find_nvcc()
-- local nvcc, version = find_nvcc({program = "nvcc", version = true})
--
-- @endcode
--
function main(opt)
return find_cudatool("nvcc", "V(%d+%.?%d*%.?%d*.-)%s", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_where.lua | --!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_where.lua
--
-- imports
import("lib.detect.find_program")
-- find where
--
-- @code
-- local where = find_where()
-- @endcode
--
function main(opt)
opt = opt or {}
opt.check = "/?"
local program
if is_host("windows") then
program = find_program(opt.program or "where.exe", opt)
end
return program
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_conda.lua | --!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_conda.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find conda
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local conda = find_conda()
-- local conda, version = find_conda({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
if is_host("windows") then
opt.paths = {"$(env CONDA_BAT)",
"$(env USERPROFILE)/miniconda3/condabin"}
end
local program = find_program(opt.program or (is_host("windows") and "conda.bat" or "conda"), 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_yum.lua | --!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_yum.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find yum
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local yum = find_yum()
-- local yum, version = find_yum({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "yum", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_cargo.lua | --!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_cargo.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find nim
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local nim = find_cargo()
-- local nim, version = find_cargo({program = "cargo", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "cargo", opt)
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_luajit.lua | --!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_luajit.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find lua
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local lua = find_luajit()
-- local lua, version = find_luajit({program = "luajit", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-v"
opt.command = opt.command or "-v"
-- find program
local program = find_program(opt.program or "luajit", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_icx.lua | --!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_icx.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find icx
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local icx = find_icx()
-- local icx, version, hintname = find_icx({program = "icx", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "icx", opt)
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_gxx.lua | --!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_gxx.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find g++
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local gxx = find_gxx()
-- local gxx, version, hintname = find_gxx({program = "xcrun -sdk macosx g++", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "g++", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
-- is clang++ or g++
local is_clang = false
if program then
local versioninfo = os.iorunv(program, {"--version"}, {envs = opt.envs})
if versioninfo and versioninfo:find("clang", 1, true) then
is_clang = true
end
end
return program, version, (is_clang and "clangxx" or "gxx")
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_gfortran.lua | --!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_gfortran.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find gfortran
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local gfortran = find_gfortran()
-- local gfortran, version = find_gfortran({program = "g95", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "gfortran", opt)
if not program then
program = find_program("g95", opt)
end
-- 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_nim.lua | --!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_nim.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find nim
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local nim = find_nim()
-- local nim, version = find_nim({program = "nim", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "nim", opt)
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_go.lua | --!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_go.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find go
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local go = find_go()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "version"
opt.command = opt.command or "version"
-- find program
local program = find_program(opt.program or "go", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ranlib.lua | --!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_ranlib.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find ranlib
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ranlib = find_ranlib()
-- local ranlib, version = find_ranlib({program = "xcrun -sdk macosx ranlib", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "ranlib", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_7z.lua | --!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_7z.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find 7z
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local 7z = find_7z()
-- local 7z, version = find_7z({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "--help"
opt.command = opt.command or "--help"
opt.parse = "(%d+%.?%d*)%s"
-- find 7z from builtin xmake/winenv
if is_host("windows") then
opt.paths = opt.paths or {}
table.insert(opt.paths, path.join(os.programdir(), "winenv", "bin"))
end
-- find program
local program = find_program(opt.program or "7z", opt)
if not program and not opt.program then
program = find_program("7za", opt)
end
-- find it from msys/mingw, it is only a shell script
if not program and is_subhost("msys") then
program = find_program("sh 7z", opt)
end
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_icpc.lua | --!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_icpc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find icpc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local icpc = find_icpc()
-- local icpc, version, hintname = find_icpc({program = "icpc", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "icpc", opt)
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_clang_tidy.lua | --!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_clang_tidy.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find clang-tidy
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local clang_tidy = find_clang_tidy()
-- local clang_tidy, version = find_clang_tidy({program = "clang-tidy", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "clang-tidy", opt)
if not program and is_host("macosx") then
local llvm = try {function () return os.iorunv("brew", {"--prefix", "llvm"}) end}
if llvm then
opt.paths = opt.paths or {}
opt.force = true
table.insert(opt.paths, path.join(llvm:trim(), "bin"))
program = find_program(opt.program or "clang-tidy", opt)
end
end
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_swiftc.lua | --!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_swiftc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find swiftc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local swiftc = find_swiftc()
-- local swiftc, version = find_swiftc({program = "xcrun -sdk macosx swiftc", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "swiftc", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ccache.lua | --!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_ccache.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find ccache
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ccache = find_ccache()
-- local ccache, version = find_ccache({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "ccache", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_gdc.lua | --!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_gdc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find gdc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local gdc = find_gdc()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.command = opt.command or "--version"
opt.parse = opt.parse or function (output) return output:match("%s(%d+%.?%d+%.?%d+)%s") end
-- find program
local program = find_program(opt.program or "gdc", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_icl.lua | --!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_icl.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find icl
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local icl = find_icl()
-- local icl, version, hintname = find_icl({program = "icl", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or function (program) os.runv(program, {"/help"}, {envs = opt.envs}) end
-- find program
local program = find_program(opt.program or "icl.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, {"/help"}, {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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_verilator.lua | --!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_verilator.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find verilator
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local verilator = find_verilator()
--
-- @endcode
--
function main(opt)
-- find program
opt = opt or {}
local program = find_program(opt.program or "verilator", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_meson.lua | --!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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_lipo.lua | --!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_lipo.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find lipo
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local lipo = find_lipo()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or function (program) os.run("%s -info %s", program, os.programfile()) end
-- find program
return find_program(opt.program or "lipo", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_gcc.lua | --!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_gcc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("core.cache.detectcache")
-- find gcc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local gcc = find_gcc()
-- local gcc, version, hintname = find_gcc({program = "xcrun -sdk macosx gcc", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "gcc", opt)
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
local is_clang = false
if program and is_host("macosx") then
local cachekey = "find_gcc_versioninfo_" .. program
local versioninfo = detectcache:get(cachekey)
if versioninfo == nil then
versioninfo = os.iorunv(program, {"--version"}, {envs = opt.envs})
detectcache:set(cachekey, versioninfo)
end
if versioninfo and versioninfo:find("clang", 1, true) then
is_clang = true
end
end
return program, version, (is_clang and "clang" or "gcc")
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_clang.lua | --!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_clang.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find clang
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local clang = find_clang()
-- local clang, version = find_clang({program = "xcrun -sdk macosx clang", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "clang", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_dumpbin.lua | --!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 dumpbin
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local dumpbin = 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_nmake.lua | --!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_nmake.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find nmake
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local nmake = find_nmake()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = "/?"
-- find program
local program = find_program(opt.program or "nmake.exe", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_make.lua | --!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_make.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find make
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local make = find_make()
--
-- @endcode
--
function main(opt)
-- find program
opt = opt or {}
local program = find_program(opt.program or (is_host("bsd") and "gmake" or "make"), opt)
if not program and not opt.program and is_subhost("msys", "cygwin") then
program = find_program("mingw32-make.exe", opt)
end
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_gccgo.lua | --!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_gogccgo.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find gccgo
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local gccgo = find_gccgo()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.command = opt.command or "--version"
opt.parse = opt.parse or function (output) return output:match("%s(%d+%.?%d+%.?%d+)%s") end
-- find program
local program = find_program(opt.program or "gccgo", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_vcpkg.lua | --!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_vcpkg.lua
--
-- imports
import("lib.detect.find_file")
import("lib.detect.find_program")
import("core.project.config")
import("detect.sdks.find_vcpkgdir")
-- find vcpkg
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local vcpkg = find_vcpkg()
-- local vcpkg, version = find_vcpkg({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "version"
opt.command = opt.command or "version"
-- init the search directories
local paths = {}
local vcpkgdir = find_vcpkgdir()
if vcpkgdir then
table.insert(paths, vcpkgdir)
end
-- find program
opt.paths = paths
opt.envs = {PATH = os.getenv("PATH")}
local program = find_program(opt.program or (is_host("windows") and "vcpkg.exe" or "vcpkg"), opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_wget.lua | --!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_wget.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find wget
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local wget = find_wget()
-- local wget, version = find_wget({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "wget", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_cmake.lua | --!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_cmake.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("core.tool.toolchain")
-- find cmake
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local cmake = find_cmake()
-- local cmake, version = find_cmake({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
if is_host("windows") then
opt.paths = "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\CMake;InstallDir)\\bin"
end
-- find program
local program = find_program(opt.program or "cmake", opt)
if not program and is_host("windows") then
-- we always use host/arch to avoid windows/arm64, because we are building packages for cross-compilation
local msvc = toolchain.load("msvc", {plat = os.host(), arch = os.arch()})
if msvc:check() then
opt.envs = msvc:runenvs() -- we attempt to find it from vstudio environments
opt.force = true
program = find_program(opt.program or "cmake", opt)
end
end
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_nvcxx.lua | --!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_nvcxx.lua
--
-- imports
import("private.detect.find_cudatool")
-- find nvcxx
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local nvcxx = find_nvcxx()
-- local nvcxx, version = find_nvcxx({program = "nvcxx", version = true})
--
-- @endcode
--
function main(opt)
return find_cudatool("nvc++", "V(%d+%.?%d*%.?%d*.-)%s", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_oh51.lua | --!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 DawnMagnet
-- @file find_oh51.lua
-- OBJECT TO HEX FILE CONVERTER OH51
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_c51")
import("lib.detect.find_tool")
function _check(program)
local c51 = assert(find_tool("c51"), "c51 not found")
local bl51 = assert(find_tool("bl51"), "bl51 not found")
-- make temp source file
local tmpdir = os.tmpfile() .. ".dir"
os.mkdir(tmpdir)
local cfile = path.join(tmpdir, "test.c")
local objfile = path.join(tmpdir, "test.obj")
local binfile = path.join(tmpdir, "test")
-- write test code
io.writefile(cfile, "void main() {}")
-- archive it
os.runv(c51.program, {"test.c"}, {curdir = tmpdir})
os.runv(bl51.program, {objfile, "TO", binfile})
os.runv(program, {binfile})
-- remove files
os.rmdir(tmpdir)
end
-- find oh51
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local oh51 = find_oh51()
-- local oh51, version = find_oh51()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or _check
local program = find_program(opt.program or "oh51.exe", opt)
if not program then
local c51 = find_c51()
if c51 then
if c51.sdkdir_c51 then
program = find_program(path.join(c51.sdkdir_c51, "bin", "oh51.exe"), opt)
end
if not program and c51.sdkdir_a51 then
program = find_program(path.join(c51.sdkdir_a51, "bin", "oh51.exe"), opt)
end
end
end
return program, nil
end |
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_jom.lua | --!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_jom.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find jom
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local jom = find_jom()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = "/?"
-- find program
local program = find_program(opt.program or "jom.exe", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_swig.lua | --!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_swig.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find swig
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local swig = find_swig()
-- local swig, version = find_swig({program = "swig", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-version"
-- find program
local program = find_program(opt.program or "swig", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_vsjitdebugger.lua | --!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_vsjitdebugger.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find vsjitdebugger
--
-- @param opt the argument options, e.g. {version = true, program = "c:\xxx\vsjitdebugger.exe"}
--
-- @return program, version
--
-- @code
--
-- local vsjitdebugger = find_vsjitdebugger()
-- local vsjitdebugger, version = find_vsjitdebugger({version = true})
-- local vsjitdebugger, version = find_vsjitdebugger({version = true, program = "c:\xxx\vsjitdebugger.exe"})
--
-- @endcode
--
function main(opt)
-- not on windows?
if not is_host("windows") then
return
end
-- init options
opt = opt or {}
opt.paths = opt.paths or function ()
for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
return (val("reg " .. reg) or ""):match("\"(.-)\"")
end
end
opt.check = opt.check or function (program) if not os.isfile(program) then raise() end end
-- find program
return find_program(opt.program or "vsjitdebugger", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_bzip2.lua | --!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_bzip2.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find bzip2
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local bzip2 = find_bzip2()
-- local bzip2, version = find_bzip2({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "--help"
opt.command = opt.command or "--help"
opt.parse = "(%d+%.?%d*)%s"
-- find program
local program = find_program(opt.program or "bzip2", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_cudamemcheck.lua | --!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 OpportunityLiu
-- @file find_cudamemcheck.lua
--
-- imports
import("private.detect.find_cudatool")
-- find cudamemcheck
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local cudamemcheck = find_cudamemcheck()
-- local cudamemcheck, version = find_cudamemcheck({program = "cuda-memcheck", version = true})
--
-- @endcode
--
function main(opt)
return find_cudatool("cuda-memcheck", "version (%d+%.?%d*%.?%d*.-)", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_unzip.lua | --!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_unzip.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find unzip
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local unzip = find_unzip()
-- local unzip, version = find_unzip({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-v"
opt.command = opt.command or "-v"
-- find program
local program = find_program(opt.program or "unzip", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_cosmocxx.lua | --!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_cosmocxx.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find cosmocxx
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local cosmocxx = find_cosmocxx()
--
-- @endcode
--
function main(opt)
opt = opt or {}
opt.shell = true
opt.envs = opt.envs or {PATH = os.getenv("PATH")}
local program = find_program(opt.program or "cosmoc++", opt)
if program and is_host("windows") then
program = program:gsub("\\", "/")
end
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_yacc.lua | --!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_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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ldc2.lua | --!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_ldc2.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find ldc2
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ldc2 = find_ldc2()
--
-- @endcode
--
function main(opt)
opt = opt or {}
opt.command = opt.command or "--version"
opt.parse = opt.parse or function (output) return output:match("%((%d+%.?%d*%.?%d*.-)%)") end
local version = nil
local program = find_program(opt.program or "ldc2", opt)
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_asn1c.lua | --!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_asn1c.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find asn1c
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local asn1c = find_asn1c()
-- local asn1c, version = find_asn1c({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-v"
opt.command = opt.command or "-v"
-- find program
local program = find_program(opt.program or "asn1c", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ping.lua | --!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_ping.lua
--
-- imports
import("lib.detect.find_program")
-- find ping
--
--
-- @param opt the argument options
--
-- @return program
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or function (program)
if is_host("windows") then
os.run("%s -n 1 -w 500 127.0.0.1", program)
elseif is_host("macosx") then
os.run("%s -c 1 -t 1 127.0.0.1", program)
else
os.run("%s -c 1 -W 1 127.0.0.1", program)
end
end
-- find program
return find_program(opt.program or "ping", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_zig.lua | --!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_zig.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find zig
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local zig = find_zig()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "version"
opt.command = opt.command or "version"
-- find program
local program = find_program(opt.program or "zig", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_pwsh.lua | --!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_pwsh.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find pwsh
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local pwsh = find_pwsh()
--
-- @endcode
--
function main(opt)
opt = opt or {}
opt.check = opt.check or {"-c", "$PSVersionTable"}
local program = find_program(opt.program or "pwsh", opt)
local version = nil
if program and opt and opt.version then
opt.command = opt.command or {"-c", "$PSVersionTable"}
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_zig_cc.lua | --!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_zig_cc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find zig_cc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local zig_cc = find_zig_cc()
-- local zig_cc, version, hintname = find_zig_cc({program = "zig cc", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "zig cc", opt)
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_qmake.lua | --!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_qmake.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find qmake
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local qmake = find_qmake()
-- local qmake, version = find_qmake({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "qmake", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_glslangValidator.lua | --!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_glslangValidator.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find glslangValidator
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local glslangValidator = find_glslangValidator()
-- local glslangValidator, version = find_glslangValidator({program = "glslangValidator", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "glslangValidator", opt)
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_pkgconf.lua | --!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_pkgconf.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find pkgconf
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local pkgconf = find_pkgconf()
-- local pkgconf, version = find_pkgconf({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "pkgconf", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_clib.lua | --!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 Adel Vilkov (aka RaZeR-RBI)
-- @file find_clib.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find clib
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local clib = find_clib()
-- local clib, version = find_clib({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "clib", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_zig_cxx.lua | --!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_zig_cxx.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find zig_cxx
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local zig_cxx = find_zig_cxx()
-- local zig_cxx, version, hintname = find_zig_cxx({program = "zig c++", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "zig c++", opt)
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_doxygen.lua | --!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_doxygen.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find doxygen
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local doxygen = find_doxygen()
-- local doxygen, version = find_doxygen({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "doxygen", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_dub.lua | --!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_dub.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find dub
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local dub = find_dub()
-- local dub, version = find_dub({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "dub", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_scons.lua | --!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_scons.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find scons
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local scons = find_scons()
-- local scons, version = find_scons({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "scons", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_curl.lua | --!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_curl.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find curl
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local curl = find_curl()
-- local curl, version = find_curl({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find curl from builtin xmake/winenv
if is_host("windows") then
opt.paths = opt.paths or {}
table.insert(opt.paths, path.join(os.programdir(), "winenv", "bin"))
end
-- find program
local program = find_program(opt.program or "curl", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_lld_link.lua | --!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_lld_link.lua
--
-- imports
import("core.tool.compiler")
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find ar
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ar = find_lld_link()
-- local ar, version = find_lld_link({program = "lld.link", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "lld.link", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_dsymutil.lua | --!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_dsymutil.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find dsymutil
--
-- @param opt the arguments, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local dsymutil = find_dsymutil()
-- local dsymutil, version = find_dsymutil({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "dsymutil", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_lex.lua | --!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_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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_cosmocc.lua | --!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_cosmocc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find cosmocc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local cosmocc = find_cosmocc()
--
-- @endcode
--
function main(opt)
opt = opt or {}
opt.shell = true
opt.envs = opt.envs or {PATH = os.getenv("PATH")}
local program = find_program(opt.program or "cosmocc", opt)
if program and is_host("windows") then
program = program:gsub("\\", "/")
end
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_bash.lua | --!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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ollydbg.lua | --!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_ollydbg.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find ollydbg
--
-- @param opt the argument options, e.g. {version = true, program = "c:\xxx\ollydbg.exe"}
--
-- @return program, version
--
-- @code
--
-- local ollydbg = find_ollydbg()
-- local ollydbg, version = find_ollydbg({version = true})
-- local ollydbg, version = find_ollydbg({version = true, program = "c:\xxx\ollydbg.exe"})
--
-- @endcode
--
function main(opt)
-- not on windows?
if os.host() ~= "windows" then
return
end
-- init options
opt = opt or {}
opt.paths = opt.paths or function ()
for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
return (val("reg " .. reg) or ""):match("\"(.-)\"")
end
end
opt.check = opt.check or function (program) if not os.isfile(program) then raise() end end
-- find program
return find_program(opt.program or "ollydbg", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_python3.lua | --!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_python3.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find python
--
-- @param opt the arguments, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local python = find_python3()
-- local python, version = find_python3({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
if is_host("windows") then
opt.paths = opt.paths or {}
local keys = winos.registry_keys("HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.*\\InstallPath")
for _, key in ipairs(keys) do
local value = try {function () return winos.registry_query(key .. ";ExecutablePath") end}
if value and os.isfile(value) then
table.insert(opt.paths, value)
end
end
end
-- find program
local program = find_program(opt.program or "python3", opt)
if not program then
opt.force = true
program = find_program("python", opt)
opt.version = true
end
-- find program version
local version = nil
if program and opt.version then
opt.command = function ()
local outs, errs = os.iorunv(program, {"--version"})
return ((outs or "") .. (errs or "")):trim()
end
version = find_programver(program, opt)
end
-- check version
if version and not version:startswith("3.") then
return
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_python2.lua | --!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_python2.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find python
--
-- @param opt the arguments, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local python = find_python2()
-- local python, version = find_python2({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "python2", opt)
if not program then
opt.force = true
program = find_program("python", opt)
opt.version = true
end
-- find program version
local version = nil
if program and opt.version then
opt.command = function ()
local outs, errs = os.iorunv(program, {"--version"})
return ((outs or "") .. (errs or "")):trim()
end
version = find_programver(program, opt)
end
-- check version
if version and not version:startswith("2.") then
return
end
-- ok?
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_lldb.lua | --!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_lldb.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find lldb
--
-- @param opt the argument options, e.g. {version = true, program="/usr/bin/lldb"}
--
-- @return program, version
--
-- @code
--
-- local lldb = find_lldb()
-- local lldb, version = find_lldb({version = true})
-- local lldb, version = find_lldb({version = true, program = "/usr/bin/lldb"})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "lldb", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_flex.lua | --!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_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)
opt = opt or {}
local program = find_program(opt.program or "flex", opt)
if not program and not opt.program and is_host("windows") then
program = find_program("win_flex", opt)
end
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_zip.lua | --!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_zip.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find zip
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local zip = find_zip()
-- local zip, version = find_zip({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-v"
opt.command = opt.command or "-v"
-- find program
local program = find_program(opt.program or "zip", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ar.lua | --!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_ar.lua
--
-- imports
import("lib.detect.find_program")
-- check
function _check(program)
-- make a stub object file
local libraryfile = os.tmpfile() .. ".a"
local objectfile = os.tmpfile() .. ".o"
io.writefile(objectfile, "")
-- archive it
os.runv(program, {"-cr", libraryfile, objectfile})
-- remove files
os.rm(objectfile)
os.rm(libraryfile)
end
-- find ar
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ar = find_ar()
-- local ar, version = find_ar({program = "xcrun -sdk macosx g++", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
opt.check = opt.check or _check
return find_program(opt.program or "ar", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_conan.lua | --!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_conan.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find conan
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local conan = find_conan()
-- local conan, version = find_conan({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "conan", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_fpc.lua | --!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_fpc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find fpc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local fpc = find_fpc()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-h"
-- find program
local program = find_program(opt.program or "fpc", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_fasm.lua | --!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_fasm.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find fasm
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local fasm = find_fasm()
-- local fasm, version = find_fasm({program = "fasm", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.norun = true
-- find program
local program = find_program(opt.program or "fasm", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_emxx.lua | --!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_emxx.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_emsdk")
-- find emxx
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local emxx = find_emxx()
-- local emxx, version = find_emxx({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- init the search directories
local emsdk = find_emsdk()
if emsdk and emsdk.emscripten then
local paths = {}
table.insert(paths, emsdk.emscripten)
opt.paths = paths
end
-- find program
local program = find_program(opt.program or (is_host("windows") and "em++.bat" or "em++"), opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_rpm.lua | --!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, Lingfeng Fu
-- @file find_rpm.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find rpm
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local rpm = find_rpm()
-- local rpm, version = find_rpm({version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "rpm", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_armar.lua | --!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_armar.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_mdk")
-- find armar
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local armar = find_armar()
-- local armar, version = find_armar({program = "armar", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = "-h"
-- find program
local program = find_program(opt.program or "armar.exe", opt)
if not program then
local mdk = find_mdk()
if mdk then
if mdk.sdkdir_armcc then
program = find_program(path.join(mdk.sdkdir_armcc, "bin", "armar.exe"), opt)
end
if not program and mdk.sdkdir_armclang then
program = find_program(path.join(mdk.sdkdir_armclang, "bin", "armar.exe"), opt)
end
end
end
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ninja.lua | --!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_ninja.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("core.tool.toolchain")
-- find ninja
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ninja = find_ninja()
-- local ninja, version = find_ninja({version = true})
--
-- @endcode
--
function main(opt)
-- find program
opt = opt or {}
local program = find_program(opt.program or "ninja", opt)
if not program and is_host("windows") then
local msvc = toolchain.load("msvc", {plat = os.host(), arch = os.arch()})
if msvc:check() then
opt.envs = msvc:runenvs() -- we attempt to find it from vstudio environments
opt.force = true
program = find_program(opt.program or "ninja", opt)
end
end
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_mold.lua | --!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_mold.lua
--
-- imports
import("core.tool.compiler")
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find ar
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ar = find_mold()
-- local ar, version = find_mold({program = "mold", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "mold", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_c51.lua | --!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 DawnMagnet
-- @file find_c51.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_c51")
function _check(program)
-- make temp source file
local tmpdir = os.tmpfile() .. ".dir"
local cfile = path.join(tmpdir, "test.c")
-- write test code
io.writefile(cfile, "void main() {}")
-- archive it
os.runv(program, {"test.c"}, {curdir = tmpdir})
-- remove files
os.rmdir(tmpdir)
end
-- find c51
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local c51 = find_c51()
-- local c51, version = find_c51()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or _check
local program = find_program(opt.program or "c51", opt)
if not program then
local c51 = find_c51()
if c51 then
if c51.sdkdir_c51 then
program = find_program(path.join(c51.sdkdir_c51, "bin", "c51"), opt)
end
if not program and c51.sdkdir_a51 then
program = find_program(path.join(c51.sdkdir_a51, "bin", "c51"), opt)
end
end
end
return program, nil
end |
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_debuild.lua | --!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_debuild.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find debuild
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local debuild = find_debuild()
-- local debuild, version = find_debuild({version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "debuild", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ld64_lld.lua | --!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_ld64_lld.lua
--
-- imports
import("core.tool.compiler")
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find ar
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ar = find_ld64_lld()
-- local ar, version = find_ld64_lld({program = "ld64.lld", version = true})
--
-- @endcode
--
function main(opt)
opt = opt or {}
local program = find_program(opt.program or "ld64.lld", opt)
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_iverilog.lua | --!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_iverilog.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find iverilog
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local iverilog = find_iverilog()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-V"
opt.command = opt.command or "-V"
-- find it from some logical drives paths
if is_host("windows") then
opt.paths = opt.paths or {}
for _, logical_drive in ipairs(winos.logical_drives()) do
table.insert(opt.paths, path.join(logical_drive, "iverilog", "bin"))
end
end
-- find program
local program = find_program(opt.program or "iverilog", opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_vswhere.lua | --!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_vswhere.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find vswhere
--
-- @param opt the argument options, e.g. {version = true, program = "c:\xxx\vswhere.exe"}
--
-- @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"})
--
-- @endcode
--
function main(opt)
-- not on windows?
if not is_host("windows") then
return
end
-- init options
opt = opt or {}
-- find program
opt.check = opt.check or "-?"
opt.command = opt.command or "-?"
opt.paths = opt.paths or
{
"$(env VSINSTALLERDIR)",
"$(env ProgramFiles%(x86%))\\Microsoft Visual Studio\\Installer",
"$(env ProgramFiles)\\Microsoft Visual Studio\\Installer"
}
local program = find_program(opt.program or "vswhere.exe", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_cxxbridge.lua | --!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_cxxbridge.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find nim
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local nim = find_cxxbridge()
-- local nim, version = find_cxxbridge({program = "cxxbridge", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "cxxbridge", opt)
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_armcc.lua | --!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_armcc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_mdk")
-- find armcc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local armcc = find_armcc()
-- local armcc, version = find_armcc({program = "armcc", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = "-h"
-- find program
local program = find_program(opt.program or "armcc.exe", opt)
if not program then
local mdk = find_mdk()
if mdk and mdk.sdkdir_armcc then
program = find_program(path.join(mdk.sdkdir_armcc, "bin", "armcc.exe"), opt)
end
end
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_cparser.lua | --!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_cparser.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find cparser
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local cparser = find_cparser()
-- local cparser, version = find_cparser({program = "cparser", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or "cparser", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_xrepo.lua | --!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_xrepo.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find xz
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local xz = find_xrepo()
-- local xz, version = find_xrepo({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
-- find program
local program = find_program(opt.program or (is_host("windows") and "xrepo.bat" or "xrepo"), opt)
-- find program version
local version = nil
if program and opt and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_armasm_msvc.lua | --!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_armasm_msvc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_mdk")
-- find armasm
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local armasm = find_armasm_msvc()
-- local armasm, version = find_armasm_msvc({program = "armasm", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = "-h"
-- find program
local program = find_program(opt.program or "armasm.exe", opt)
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_nmap.lua | --!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_nmap.lua
--
-- imports
import("lib.detect.find_program")
-- find nmap
--
--
-- @param opt the argument options
--
-- @return program
--
function main(opt)
-- find program
opt = opt or {}
return find_program(opt.program or "nmap", opt)
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_ml64.lua | --!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_ml64.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find ml64
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local ml64 = find_ml64()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or function (program) os.runv(program, {}, {envs = opt.envs}) end
-- find program
local program = find_program(opt.program or "ml64.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, {}, {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
-- ok?
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_tcc.lua | --!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_tcc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find tcc
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local tcc = find_tcc()
-- local tcc, version = find_tcc({program = "xcrun -sdk macosx tcc", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or "-v"
opt.command = opt.command or "-v"
-- find program
local program = find_program(opt.program or "tcc", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_armasm.lua | --!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_armasm.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_mdk")
-- find armasm
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local armasm = find_armasm()
-- local armasm, version = find_armasm({program = "armasm", version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = "-h"
-- find program
local program = find_program(opt.program or "armasm.exe", opt)
if not program then
local mdk = find_mdk()
if mdk then
if mdk.sdkdir_armcc then
program = find_program(path.join(mdk.sdkdir_armcc, "bin", "armasm.exe"), opt)
end
if not program and mdk.sdkdir_armclang then
program = find_program(path.join(mdk.sdkdir_armclang, "bin", "armasm.exe"), opt)
end
end
end
-- find program version
local version = nil
if program and opt.version then
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_renderdoc.lua | --!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, SirLynix
-- @file find_renderdoc.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find qmake
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local qmake = find_renderdoc()
-- local qmake, version = find_renderdoc({version = true})
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
if is_host("windows") then
opt.paths = opt.paths or {}
-- add paths from registry
local regs =
{
"HKEY_CLASSES_ROOT\\Applications\\qrenderdoc.exe\\shell\\Open\\Command",
"HKEY_CURRENT_USER\\SOFTWARE\\Classes\\Applications\\qrenderdoc.exe\\shell\\Open\\Command",
}
for _, reg in ipairs(regs) do
table.insert(opt.paths, function ()
local value = val("reg " .. reg)
if value then
local p = value:split("\"")
if p and p[1] then
return path.translate(p[1])
end
end
end)
end
end
-- find program
local program = find_program(opt.program or "qrenderdoc", 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
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_powershell.lua | --!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_powershell.lua
--
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
-- find powershell
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local powershell = find_powershell()
--
-- @endcode
--
function main(opt)
opt = opt or {}
opt.check = opt.check or {"-c", "$PSVersionTable"}
local program = find_program(opt.program or "powershell", opt)
local version = nil
if program and opt and opt.version then
opt.command = opt.command or {"-c", "$PSVersionTable"}
version = find_programver(program, opt)
end
return program, version
end
|
0 | repos/xmake/xmake/modules/detect | repos/xmake/xmake/modules/detect/tools/find_bl51.lua | --!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 DawnMagnet
-- @file find_bl51.lua
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("detect.sdks.find_c51")
import("lib.detect.find_tool")
function _check(program)
local c51 = assert(find_tool("c51"), "c51 not found")
-- make temp source file
local tmpdir = os.tmpfile() .. ".dir"
local cfile = path.join(tmpdir, "test.c")
local objfile = path.join(tmpdir, "test.obj")
local binfile = path.join(tmpdir, "test")
-- write test code
io.writefile(cfile, "void main() {}")
-- archive it
os.runv(c51.program, {"test.c"}, {curdir = tmpdir})
os.runv(program, {objfile, "TO", binfile})
-- remove files
os.rmdir(tmpdir)
end
-- find bl51
--
-- @param opt the argument options, e.g. {version = true}
--
-- @return program, version
--
-- @code
--
-- local bl51 = find_bl51()
-- local bl51, version = find_bl51()
--
-- @endcode
--
function main(opt)
-- init options
opt = opt or {}
opt.check = opt.check or _check
local program = find_program(opt.program or "bl51.exe", opt)
if not program then
local c51 = find_c51()
if c51 then
if c51.sdkdir_c51 then
program = find_program(path.join(c51.sdkdir_c51, "bin", "bl51.exe"), opt)
end
if not program and c51.sdkdir_a51 then
program = find_program(path.join(c51.sdkdir_a51, "bin", "bl51.exe"), opt)
end
end
end
return program, nil
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.