diff options
Diffstat (limited to 'xmake/modules/detect')
| -rw-r--r-- | xmake/modules/detect/sdks/find_mingw.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_ndk.lua | 10 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_fasm.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ld.lua | 46 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_nasm.lua | 55 |
5 files changed, 108 insertions, 10 deletions
diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index a8c22a9ee..6aa5e3f2a 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -33,6 +33,8 @@ function _find_mingwdir(sdkdir) if not sdkdir then if is_host("macosx") then sdkdir = "/usr/local/opt/mingw-w64" + elseif is_host("linux") then + sdkdir = "/usr" end end @@ -54,11 +56,11 @@ function _find_mingw(sdkdir, bindir, cross) -- find mingw root directory sdkdir = _find_mingwdir(sdkdir) if not sdkdir then - return {} + return end -- select cross on macos, e.g x86_64-w64-mingw32- or i686-w64-mingw32- - if is_host("macosx") and not cross then + if is_host("macosx", "linux") and not cross then local arch = config.get("arch") if not arch or arch == "i386" then cross = "i686-*-" diff --git a/xmake/modules/detect/sdks/find_ndk.lua b/xmake/modules/detect/sdks/find_ndk.lua index 7dee10690..f0ee66676 100644 --- a/xmake/modules/detect/sdks/find_ndk.lua +++ b/xmake/modules/detect/sdks/find_ndk.lua @@ -101,7 +101,7 @@ function _find_ndk(sdkdir, arch, ndk_sdkver, ndk_toolchains_ver) -- find ndk root directory sdkdir = _find_ndkdir(sdkdir) if not sdkdir then - return {} + return end -- get cross @@ -142,14 +142,11 @@ function _find_ndk(sdkdir, arch, ndk_sdkver, ndk_toolchains_ver) bindir = find_directory("bin", path.join(sdkdir, "toolchains", gcc_toolchain_subdir, "prebuilt", "*")) end if not bindir then - return {} + return end -- find the sdk version local sdkver = ndk_sdkver or _find_ndk_sdkver(sdkdir, bindir, arch) - if not sdkver then - return {} - end -- find the gcc toolchain local gcc_toolchain = find_directory("bin", path.join(sdkdir, "toolchains", gcc_toolchain_subdir, "prebuilt", "*")) @@ -159,9 +156,6 @@ function _find_ndk(sdkdir, arch, ndk_sdkver, ndk_toolchains_ver) -- find the toolchains version local toolchains_ver = ndk_toolchains_ver or _find_ndk_toolchains_ver(gcc_toolchain or bindir) - if not toolchains_ver then - return {} - end -- get ndk version, e.g. r16b, .. local ndkver = nil diff --git a/xmake/modules/detect/tools/find_fasm.lua b/xmake/modules/detect/tools/find_fasm.lua index 5ebf9e699..0b555a406 100644 --- a/xmake/modules/detect/tools/find_fasm.lua +++ b/xmake/modules/detect/tools/find_fasm.lua @@ -39,6 +39,7 @@ function main(opt) -- init options opt = opt or {} + opt.norun = true -- find program local program = find_program(opt.program or "fasm", opt) diff --git a/xmake/modules/detect/tools/find_ld.lua b/xmake/modules/detect/tools/find_ld.lua new file mode 100644 index 000000000..7b015e043 --- /dev/null +++ b/xmake/modules/detect/tools/find_ld.lua @@ -0,0 +1,46 @@ +--!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-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_ld.lua +-- + +-- imports +import("core.tool.compiler") +import("lib.detect.find_program") + +-- find ar +-- +-- @param opt the argument options, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local ar = find_ld() +-- local ar, version = find_ld({program = "ld", version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + opt.norun = true + + -- find program + return find_program(opt.program or "ld", opt) +end diff --git a/xmake/modules/detect/tools/find_nasm.lua b/xmake/modules/detect/tools/find_nasm.lua new file mode 100644 index 000000000..68936502e --- /dev/null +++ b/xmake/modules/detect/tools/find_nasm.lua @@ -0,0 +1,55 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_nasm.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find nasm +-- +-- @param opt the argument options, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local nasm = find_nasm() +-- local nasm, version = find_nasm({program = "nasm", version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + opt.check = "-v" + + -- find program + local program = find_program(opt.program or "nasm", 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 |
