summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-25 00:37:42 +0800
committerruki <[email protected]>2025-01-25 00:37:42 +0800
commit8d1f5001b073cbfeed8ac23510f21bcfb72e5fab (patch)
treeb788bb5a9fa6aac218cca85d526ea4d1e119ebbd /xmake/modules/detect/tools
parentab2569e28977aa20d8ac27c4d0233482200d3723 (diff)
add cl2000 support
Diffstat (limited to 'xmake/modules/detect/tools')
-rw-r--r--xmake/modules/detect/tools/cl2000/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/find_ar2000.lua58
-rw-r--r--xmake/modules/detect/tools/find_cl2000.lua48
3 files changed, 129 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/cl2000/has_flags.lua b/xmake/modules/detect/tools/cl2000/has_flags.lua
new file mode 100644
index 000000000..4b108a611
--- /dev/null
+++ b/xmake/modules/detect/tools/cl2000/has_flags.lua
@@ -0,0 +1,23 @@
+--!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 has_flags.lua
+--
+
+-- imports
+inherit("detect.tools.cl6x.has_flags")
+
diff --git a/xmake/modules/detect/tools/find_ar2000.lua b/xmake/modules/detect/tools/find_ar2000.lua
new file mode 100644
index 000000000..410b89147
--- /dev/null
+++ b/xmake/modules/detect/tools/find_ar2000.lua
@@ -0,0 +1,58 @@
+--!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_ar2000.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.execv(program, {"-r", 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_ar2000()
+-- local ar, version = find_ar2000({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 "ar2000", opt)
+end
+
diff --git a/xmake/modules/detect/tools/find_cl2000.lua b/xmake/modules/detect/tools/find_cl2000.lua
new file mode 100644
index 000000000..e93e75874
--- /dev/null
+++ b/xmake/modules/detect/tools/find_cl2000.lua
@@ -0,0 +1,48 @@
+--!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_cl2000.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find cl2000
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local cl2000 = find_cl2000()
+-- local cl2000, version = find_cl2000({program = "cl2000", version = true})
+--
+-- @endcode
+--
+function main(opt)
+ opt = opt or {}
+ opt.check = "--help"
+ opt.command = "--help"
+ local program = find_program(opt.program or "cl2000", opt)
+ local version = nil
+ if program and opt.version then
+ version = find_programver(program, opt)
+ end
+ return program, version
+end