summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-25 16:22:23 +0800
committerGitHub <[email protected]>2025-01-25 16:22:23 +0800
commite1914d8136d2cd5efb44e7c24a822b14cf599c8c (patch)
tree1eeb74ffa5f86adbeb446fbef1aafcad96d2e7ce
parent669d2db9d3468aa0dc2edea9771ace9bb99f0d19 (diff)
parentbeff9a0f84ce1ebdd1eeb85caee55500320595a3 (diff)
Merge pull request #6114 from xmake-io/toolchain
Add custom unknown toolchain support
-rw-r--r--tests/apis/custom_toolchain/src/foo.cpp5
-rw-r--r--tests/apis/custom_toolchain/src/foo.h9
-rw-r--r--tests/apis/custom_toolchain/src/test.cpp5
-rw-r--r--tests/apis/custom_toolchain/xmake.lua17
-rw-r--r--tests/apis/custom_toolchain/xmake/modules/core/tools/ar6x.lua (renamed from xmake/modules/detect/tools/armasm64_msvc/has_flags.lua)10
-rw-r--r--tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua207
-rw-r--r--tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua (renamed from xmake/modules/detect/tools/cl6x/has_flags.lua)2
-rw-r--r--tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/parse_deps.lua (renamed from xmake/modules/private/tools/cl6x/parse_deps.lua)0
-rw-r--r--tests/apis/custom_toolchain/xmake/modules/detect/tools/find_ar6x.lua58
-rw-r--r--tests/apis/custom_toolchain/xmake/modules/detect/tools/find_cl6x.lua48
-rw-r--r--tests/apis/custom_toolchain/xmake/toolchains/my-c6000/xmake.lua20
-rw-r--r--tests/apis/set_toolchains/src/foo.cpp5
-rw-r--r--tests/apis/set_toolchains/src/foo.h9
-rw-r--r--tests/apis/set_toolchains/src/interface.cpp6
-rw-r--r--tests/apis/set_toolchains/src/interface.h16
-rw-r--r--tests/apis/set_toolchains/src/test.cpp7
-rw-r--r--tests/apis/set_toolchains/xmake.lua6
-rw-r--r--xmake/core/platform/platform.lua8
-rw-r--r--xmake/core/project/project.lua38
-rw-r--r--xmake/core/sandbox/modules/import/core/tool/toolchain.lua3
-rw-r--r--xmake/core/tool/toolchain.lua9
-rw-r--r--xmake/modules/core/project/depend.lua2
-rw-r--r--xmake/modules/core/tools/ar/has_flags.lua (renamed from xmake/modules/detect/tools/ar/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/armasm64_msvc/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/armasm_msvc/has_flags.lua (renamed from xmake/modules/detect/tools/armasm_msvc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/armcc/parse_deps.lua (renamed from xmake/modules/private/tools/armcc/parse_deps.lua)0
-rw-r--r--xmake/modules/core/tools/armclang/has_flags.lua (renamed from xmake/modules/detect/tools/armclang/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/circle/has_flags.lua (renamed from xmake/modules/detect/tools/icl/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/cl.lua2
-rw-r--r--xmake/modules/core/tools/cl/cfeatures.lua (renamed from xmake/modules/detect/tools/cl/cfeatures.lua)0
-rw-r--r--xmake/modules/core/tools/cl/cxxfeatures.lua (renamed from xmake/modules/detect/tools/cl/cxxfeatures.lua)0
-rw-r--r--xmake/modules/core/tools/cl/features.lua (renamed from xmake/modules/detect/tools/cl/features.lua)0
-rw-r--r--xmake/modules/core/tools/cl/has_flags.lua (renamed from xmake/modules/detect/tools/cl/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/cl/parse_deps.lua (renamed from xmake/modules/private/tools/cl/parse_deps.lua)0
-rw-r--r--xmake/modules/core/tools/cl/parse_deps_json.lua (renamed from xmake/modules/private/tools/cl/parse_deps_json.lua)0
-rw-r--r--xmake/modules/core/tools/cl/parse_include.lua (renamed from xmake/modules/private/tools/cl/parse_include.lua)0
-rw-r--r--xmake/modules/core/tools/cl2000/has_flags.lua (renamed from xmake/modules/detect/tools/ml64/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/cl2000/parse_deps.lua (renamed from xmake/modules/private/tools/cl2000/parse_deps.lua)2
-rw-r--r--xmake/modules/core/tools/cl6x/has_flags.lua121
-rw-r--r--xmake/modules/core/tools/cl6x/parse_deps.lua77
-rw-r--r--xmake/modules/core/tools/cl_json/parse_deps.lua (renamed from xmake/modules/private/tools/cl_json/parse_deps.lua)0
-rw-r--r--xmake/modules/core/tools/clang/cfeatures.lua (renamed from xmake/modules/detect/tools/clang/cfeatures.lua)2
-rw-r--r--xmake/modules/core/tools/clang/cxxfeatures.lua (renamed from xmake/modules/detect/tools/clang/cxxfeatures.lua)2
-rw-r--r--xmake/modules/core/tools/clang/features.lua (renamed from xmake/modules/detect/tools/clang/features.lua)2
-rw-r--r--xmake/modules/core/tools/clang/has_flags.lua (renamed from xmake/modules/detect/tools/clang/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/clang_cl/has_flags.lua (renamed from xmake/modules/detect/tools/clang_cl/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/clangxx/features.lua (renamed from xmake/modules/detect/tools/nvc/features.lua)2
-rw-r--r--xmake/modules/core/tools/clangxx/has_flags.lua (renamed from xmake/modules/detect/tools/clangxx/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/cosmocc/has_flags.lua (renamed from xmake/modules/detect/tools/cosmocc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/cosmocxx/has_flags.lua (renamed from xmake/modules/detect/tools/cl2000/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/dmd/has_flags.lua (renamed from xmake/modules/detect/tools/dmd/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/dpcpp/cfeatures.lua (renamed from xmake/modules/detect/tools/dpcpp/cfeatures.lua)2
-rw-r--r--xmake/modules/core/tools/dpcpp/cxxfeatures.lua (renamed from xmake/modules/detect/tools/dpcpp/cxxfeatures.lua)2
-rw-r--r--xmake/modules/core/tools/dpcpp/features.lua22
-rw-r--r--xmake/modules/core/tools/dpcpp/has_flags.lua (renamed from xmake/modules/detect/tools/circle/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/emcc/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/emxx/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/fpc/has_flags.lua (renamed from xmake/modules/detect/tools/fpc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/gcc/cfeatures.lua (renamed from xmake/modules/detect/tools/gcc/cfeatures.lua)0
-rw-r--r--xmake/modules/core/tools/gcc/cxxfeatures.lua (renamed from xmake/modules/detect/tools/gcc/cxxfeatures.lua)0
-rw-r--r--xmake/modules/core/tools/gcc/features.lua (renamed from xmake/modules/detect/tools/gcc/features.lua)0
-rw-r--r--xmake/modules/core/tools/gcc/has_flags.lua (renamed from xmake/modules/detect/tools/gcc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/gcc/parse_deps.lua (renamed from xmake/modules/private/tools/gcc/parse_deps.lua)0
-rw-r--r--xmake/modules/core/tools/gccgo/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/gdc/has_flags.lua (renamed from xmake/modules/detect/tools/gdc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/gfortran/has_flags.lua (renamed from xmake/modules/detect/tools/gfortran/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/go/has_flags.lua (renamed from xmake/modules/detect/tools/go/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/gxx/features.lua (renamed from xmake/modules/detect/tools/gxx/features.lua)2
-rw-r--r--xmake/modules/core/tools/gxx/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/icc/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/icl/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/icpc/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/icpx/features.lua (renamed from xmake/modules/detect/tools/nvcxx/features.lua)2
-rw-r--r--xmake/modules/core/tools/icpx/has_flags.lua (renamed from xmake/modules/detect/tools/emcc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/icx/cfeatures.lua (renamed from xmake/modules/detect/tools/icx/cfeatures.lua)2
-rw-r--r--xmake/modules/core/tools/icx/cxxfeatures.lua (renamed from xmake/modules/detect/tools/icx/cxxfeatures.lua)2
-rw-r--r--xmake/modules/core/tools/icx/features.lua22
-rw-r--r--xmake/modules/core/tools/icx/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/ifort/has_flags.lua (renamed from xmake/modules/detect/tools/ifort/has_flags.lua)4
-rw-r--r--xmake/modules/core/tools/ifx/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/ldc2/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/link/has_flags.lua (renamed from xmake/modules/detect/tools/link/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/ml/has_flags.lua (renamed from xmake/modules/detect/tools/ml/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/ml64/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/nim/has_flags.lua (renamed from xmake/modules/detect/tools/nim/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/nvc/features.lua (renamed from xmake/modules/detect/tools/clangxx/features.lua)2
-rw-r--r--xmake/modules/core/tools/nvc/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/nvcc/has_flags.lua (renamed from xmake/modules/detect/tools/nvcc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/nvcxx/features.lua23
-rw-r--r--xmake/modules/core/tools/nvcxx/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/nvfortran/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/rc/has_flags.lua (renamed from xmake/modules/detect/tools/rc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/rc/parse_deps.lua (renamed from xmake/modules/private/tools/rc/parse_deps.lua)0
-rw-r--r--xmake/modules/core/tools/rustc/has_flags.lua (renamed from xmake/modules/detect/tools/rustc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/sdcc/has_flags.lua (renamed from xmake/modules/detect/tools/sdcc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/swift_frontend/has_flags.lua22
-rw-r--r--xmake/modules/core/tools/swiftc/has_flags.lua (renamed from xmake/modules/detect/tools/swiftc/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/tcc/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/zig/has_flags.lua (renamed from xmake/modules/detect/tools/zig/has_flags.lua)2
-rw-r--r--xmake/modules/core/tools/zig_cc/features.lua23
-rw-r--r--xmake/modules/core/tools/zig_cc/has_flags.lua23
-rw-r--r--xmake/modules/core/tools/zig_cxx/features.lua23
-rw-r--r--xmake/modules/core/tools/zig_cxx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/cosmocxx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/dpcpp/features.lua22
-rw-r--r--xmake/modules/detect/tools/dpcpp/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/emxx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/gccgo/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/gxx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/icc/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/icpc/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/icpx/features.lua23
-rw-r--r--xmake/modules/detect/tools/icpx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/icx/features.lua22
-rw-r--r--xmake/modules/detect/tools/icx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/ifx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/ldc2/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/nvc/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/nvcxx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/nvfortran/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/swift_frontend/has_flags.lua22
-rw-r--r--xmake/modules/detect/tools/tcc/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/zig_cc/features.lua23
-rw-r--r--xmake/modules/detect/tools/zig_cc/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/zig_cxx/features.lua23
-rw-r--r--xmake/modules/detect/tools/zig_cxx/has_flags.lua23
-rw-r--r--xmake/modules/lib/detect/features.lua4
-rw-r--r--xmake/modules/lib/detect/find_tool.lua1
-rw-r--r--xmake/modules/lib/detect/has_flags.lua4
-rw-r--r--xmake/plugins/project/ninja/build_ninja.lua2
130 files changed, 1228 insertions, 632 deletions
diff --git a/tests/apis/custom_toolchain/src/foo.cpp b/tests/apis/custom_toolchain/src/foo.cpp
new file mode 100644
index 000000000..1a1fb3425
--- /dev/null
+++ b/tests/apis/custom_toolchain/src/foo.cpp
@@ -0,0 +1,5 @@
+#include "foo.h"
+
+int add(int a, int b) {
+ return a + b;
+}
diff --git a/tests/apis/custom_toolchain/src/foo.h b/tests/apis/custom_toolchain/src/foo.h
new file mode 100644
index 000000000..d2506bca9
--- /dev/null
+++ b/tests/apis/custom_toolchain/src/foo.h
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int add(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/apis/custom_toolchain/src/test.cpp b/tests/apis/custom_toolchain/src/test.cpp
new file mode 100644
index 000000000..7cdb7d93f
--- /dev/null
+++ b/tests/apis/custom_toolchain/src/test.cpp
@@ -0,0 +1,5 @@
+#include "foo.h"
+
+int main(int argc, char** argv) {
+ return add(1, 2);
+}
diff --git a/tests/apis/custom_toolchain/xmake.lua b/tests/apis/custom_toolchain/xmake.lua
new file mode 100644
index 000000000..03d2b5344
--- /dev/null
+++ b/tests/apis/custom_toolchain/xmake.lua
@@ -0,0 +1,17 @@
+add_rules("mode.debug", "mode.release")
+
+add_moduledirs("xmake/modules")
+add_toolchaindirs("xmake/toolchains")
+
+set_toolchains("my-c6000")
+
+target("test")
+ set_kind("static")
+ add_files("src/foo.cpp")
+
+target("demo")
+ set_kind("binary")
+ add_deps("test")
+ add_files("src/test.cpp")
+
+
diff --git a/xmake/modules/detect/tools/armasm64_msvc/has_flags.lua b/tests/apis/custom_toolchain/xmake/modules/core/tools/ar6x.lua
index e05f902c8..821b955e3 100644
--- a/xmake/modules/detect/tools/armasm64_msvc/has_flags.lua
+++ b/tests/apis/custom_toolchain/xmake/modules/core/tools/ar6x.lua
@@ -15,9 +15,13 @@
-- Copyright (C) 2015-present, TBOOX Open Source Group.
--
-- @author ruki
--- @file has_flags.lua
+-- @file ar6x.lua
--
--- imports
-inherit("detect.tools.armasm_msvc.has_flags")
+inherit("core.tools.ar")
+
+-- init it
+function init(self)
+ self:set("arflags", "-r")
+end
diff --git a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua
new file mode 100644
index 000000000..f350808da
--- /dev/null
+++ b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua
@@ -0,0 +1,207 @@
+--!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 cl6x.lua
+--
+
+-- imports
+import("core.base.option")
+import("core.base.global")
+import("core.project.policy")
+import("core.language.language")
+import("utils.progress")
+
+-- init it
+function init(self)
+end
+
+-- make the symbol flag
+function nf_symbol(self, level)
+ -- only for source kind
+ local kind = self:kind()
+ if language.sourcekinds()[kind] then
+ local maps = _g.symbol_maps
+ if not maps then
+ maps =
+ {
+ debug = "-g"
+ }
+ _g.symbol_maps = maps
+ end
+ return maps[level .. '_' .. kind] or maps[level]
+ end
+end
+
+-- make the optimize flag
+function nf_optimize(self, level)
+ local maps =
+ {
+ none = "-O0"
+ , fast = "-O1"
+ , faster = "-O2"
+ , fastest = "-O3"
+ , smallest = "-m3"
+ , aggressive = "-O3"
+ }
+ return maps[level]
+end
+
+-- make the define flag
+function nf_define(self, macro)
+ return "-D" .. macro
+end
+
+-- make the undefine flag
+function nf_undefine(self, macro)
+ return "-U" .. macro
+end
+
+-- make the includedir flag
+function nf_includedir(self, dir)
+ return {"-I" .. dir}
+end
+
+-- make the sysincludedir flag
+function nf_sysincludedir(self, dir)
+ return nf_includedir(self, dir)
+end
+
+-- make the link flag
+function nf_link(self, lib)
+ if not lib:endswith(".a") and not lib:endswith(".so") then
+ lib = "lib" .. lib .. ".a"
+ end
+ return "-l" .. lib
+end
+
+-- make the syslink flag
+function nf_syslink(self, lib)
+ return nf_link(self, lib)
+end
+
+-- make the linkdir flag
+function nf_linkdir(self, dir)
+ return {"-i" .. path.translate(dir)}
+end
+
+-- make the rpathdir flag
+function nf_rpathdir(self, dir, opt)
+ opt = opt or {}
+ local extra = opt.extra
+ if extra and extra.installonly then
+ return
+ end
+ dir = path.translate(dir)
+ return {"-rpath=" .. dir}
+end
+
+-- make the link arguments list
+function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
+ local argv = table.join("-z", "--output_file=" .. targetfile, objectfiles, flags)
+ return self:program(), argv
+end
+
+-- link the target file
+--
+-- maybe we need to use os.vrunv() to show link output when enable verbose information
+-- @see https://github.com/xmake-io/xmake/discussions/2916
+--
+function link(self, objectfiles, targetkind, targetfile, flags, opt)
+ opt = opt or {}
+ os.mkdir(path.directory(targetfile))
+ local program, argv = linkargv(self, objectfiles, targetkind, targetfile, flags)
+ if option.get("verbose") then
+ os.execv(program, argv, {envs = self:runenvs(), shell = opt.shell})
+ else
+ os.vrunv(program, argv, {envs = self:runenvs(), shell = opt.shell})
+ end
+end
+
+-- make the compile arguments list
+function compargv(self, sourcefile, objectfile, flags)
+ return self:program(), table.join("-c", "--preproc_with_compile", flags, "--output_file=" .. objectfile, sourcefile)
+end
+
+-- compile the source file
+function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
+ os.mkdir(path.directory(objectfile))
+ local depfile = dependinfo and os.tmpfile() or nil
+ try
+ {
+ function ()
+ local compflags = flags
+ if depfile then
+ compflags = table.join(compflags, "-ppd=" .. depfile)
+ end
+ local outdata, errdata = os.iorunv(compargv(self, sourcefile, objectfile, compflags))
+ return (outdata or "") .. (errdata or "")
+ end,
+ catch
+ {
+ function (errors)
+
+ -- try removing the old object file for forcing to rebuild this source file
+ os.tryrm(objectfile)
+
+ -- find the start line of error
+ local lines = tostring(errors):split("\n")
+ local start = 0
+ for index, line in ipairs(lines) do
+ if line:find("error:", 1, true) or line:find("错误:", 1, true) then
+ start = index
+ break
+ end
+ end
+
+ -- get 16 lines of errors
+ if start > 0 or not option.get("verbose") then
+ if start == 0 then start = 1 end
+ errors = table.concat(table.slice(lines, start, start + ((#lines - start > 16) and 16 or (#lines - start))), "\n")
+ end
+
+ -- raise compiling errors
+ raise(errors)
+ end
+ },
+ finally
+ {
+ function (ok, warnings)
+
+ -- print some warnings
+ if warnings and #warnings > 0 and policy.build_warnings(opt) then
+ if progress.showing_without_scroll() then
+ print("")
+ end
+ cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ end
+
+ -- generate the dependent includes
+ if depfile and os.isfile(depfile) then
+ if dependinfo then
+ dependinfo.depfiles_format = "cl6x"
+ dependinfo.depfiles = io.readfile(depfile, {continuation = "\\"})
+ end
+
+ -- remove the temporary dependent file
+ os.tryrm(depfile)
+ end
+ end
+ }
+ }
+end
+
+
diff --git a/xmake/modules/detect/tools/cl6x/has_flags.lua b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua
index d18d9b233..a5f3f4b87 100644
--- a/xmake/modules/detect/tools/cl6x/has_flags.lua
+++ b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua
@@ -48,7 +48,7 @@ end
-- attempt to check it from the argument list
function _check_from_arglist(flags, opt, islinker)
- local key = "detect.tools.cl6x." .. (islinker and "has_ldflags" or "has_cflags")
+ local key = "core.tools.cl6x." .. (islinker and "has_ldflags" or "has_cflags")
local flagskey = opt.program .. "_" .. (opt.programver or "")
local allflags = detectcache:get2(key, flagskey)
if not allflags then
diff --git a/xmake/modules/private/tools/cl6x/parse_deps.lua b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/parse_deps.lua
index a5d5ecd40..a5d5ecd40 100644
--- a/xmake/modules/private/tools/cl6x/parse_deps.lua
+++ b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/parse_deps.lua
diff --git a/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_ar6x.lua b/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_ar6x.lua
new file mode 100644
index 000000000..823a1f220
--- /dev/null
+++ b/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_ar6x.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_ar6x.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_ar6x()
+-- local ar, version = find_ar6x({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 "ar6x", opt)
+end
+
diff --git a/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_cl6x.lua b/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_cl6x.lua
new file mode 100644
index 000000000..c961326ad
--- /dev/null
+++ b/tests/apis/custom_toolchain/xmake/modules/detect/tools/find_cl6x.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_cl6x.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find cl6x
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local cl6x = find_cl6x()
+-- local cl6x, version = find_cl6x({program = "cl6x", version = true})
+--
+-- @endcode
+--
+function main(opt)
+ opt = opt or {}
+ opt.check = "--help"
+ opt.command = "--help"
+ local program = find_program(opt.program or "cl6x", opt)
+ local version = nil
+ if program and opt.version then
+ version = find_programver(program, opt)
+ end
+ return program, version
+end
diff --git a/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/xmake.lua b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/xmake.lua
new file mode 100644
index 000000000..2de2275a7
--- /dev/null
+++ b/tests/apis/custom_toolchain/xmake/toolchains/my-c6000/xmake.lua
@@ -0,0 +1,20 @@
+toolchain("my-c6000")
+ set_kind("standalone")
+ set_homepage("https://www.ti.com")
+ set_description("TI-CGT C6000 compiler")
+
+ set_toolset("cc", "cl6x")
+ set_toolset("cxx", "cl6x")
+ set_toolset("ld", "cl6x")
+ set_toolset("sh", "cl6x")
+ set_toolset("ar", "ar6x")
+ set_toolset("strip", "strip6x")
+ set_toolset("as", "cl6x")
+
+ on_check(function (toolchain)
+ return import("lib.detect.find_tool")("cl6x")
+ end)
+
+ on_load(function (toolchain)
+ toolchain:add("cxflags", "-Dxxx")
+ end)
diff --git a/tests/apis/set_toolchains/src/foo.cpp b/tests/apis/set_toolchains/src/foo.cpp
new file mode 100644
index 000000000..1a1fb3425
--- /dev/null
+++ b/tests/apis/set_toolchains/src/foo.cpp
@@ -0,0 +1,5 @@
+#include "foo.h"
+
+int add(int a, int b) {
+ return a + b;
+}
diff --git a/tests/apis/set_toolchains/src/foo.h b/tests/apis/set_toolchains/src/foo.h
new file mode 100644
index 000000000..d2506bca9
--- /dev/null
+++ b/tests/apis/set_toolchains/src/foo.h
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int add(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/apis/set_toolchains/src/interface.cpp b/tests/apis/set_toolchains/src/interface.cpp
deleted file mode 100644
index 598d07560..000000000
--- a/tests/apis/set_toolchains/src/interface.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "interface.h"
-
-int add(int a, int b)
-{
- return a + b;
-}
diff --git a/tests/apis/set_toolchains/src/interface.h b/tests/apis/set_toolchains/src/interface.h
deleted file mode 100644
index 4a41e9597..000000000
--- a/tests/apis/set_toolchains/src/interface.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*! calculate add(a, b)
- *
- * @param a the first argument
- * @param b the second argument
- *
- * @return the result
- */
-int add(int a, int b);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/tests/apis/set_toolchains/src/test.cpp b/tests/apis/set_toolchains/src/test.cpp
index 72e03272b..ed1924789 100644
--- a/tests/apis/set_toolchains/src/test.cpp
+++ b/tests/apis/set_toolchains/src/test.cpp
@@ -1,10 +1,9 @@
-#include "interface.h"
+#include "foo.h"
#include <iostream>
using namespace std;
-int main(int argc, char** argv)
-{
- cout << "add(1, 2) = " << add(1, 2) << endl;
+int main(int argc, char** argv) {
+ cout << "add(1, 2) = " << add(1, 2) << endl;
return 0;
}
diff --git a/tests/apis/set_toolchains/xmake.lua b/tests/apis/set_toolchains/xmake.lua
index 9db80f107..75f866fbd 100644
--- a/tests/apis/set_toolchains/xmake.lua
+++ b/tests/apis/set_toolchains/xmake.lua
@@ -1,10 +1,6 @@
--- define toolchain
toolchain("myclang")
-
- -- mark as standalone toolchain
set_kind("standalone")
- -- set toolset
set_toolset("cc", "clang")
set_toolset("cxx", "clang", "clang++")
set_toolset("ld", "clang++", "clang")
@@ -23,7 +19,7 @@ add_rules("mode.debug", "mode.release")
target("test")
set_kind("static")
- add_files("src/interface.cpp")
+ add_files("src/foo.cpp")
set_toolset("ar", "ar")
target("demo")
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index a58d225e5..6778596d0 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -397,27 +397,19 @@ end
-- get platform directories
function platform.directories()
-
- -- init directories
local dirs = platform._DIRS or { path.join(global.directory(), "platforms")
, path.join(os.programdir(), "platforms")
}
-
- -- save directories to cache
platform._DIRS = dirs
return dirs
end
-- add platform directories
function platform.add_directories(...)
-
- -- add directories
local dirs = platform.directories()
for _, dir in ipairs({...}) do
table.insert(dirs, 1, dir)
end
-
- -- remove unique directories
platform._DIRS = table.unique(dirs)
end
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 43271c7b0..7b42d47ea 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -202,6 +202,17 @@ function project._api_add_platformdirs(interp, ...)
end
end
+-- add toolchain directories
+function project._api_add_toolchaindirs(interp, ...)
+ local scriptdir = project.interpreter():scriptdir()
+ for _, dir in ipairs({...}) do
+ if not path.is_absolute(dir) then
+ dir = path.absolute(dir, scriptdir)
+ end
+ toolchain.add_directories(dir)
+ end
+end
+
-- load the project file
function project._load(force, disable_filter)
@@ -642,22 +653,23 @@ function project.apis()
, custom =
{
-- is_xxx
- {"is_os", project._api_is_os }
- , {"is_kind", project._api_is_kind }
- , {"is_arch", project._api_is_arch }
- , {"is_mode", project._api_is_mode }
- , {"is_plat", project._api_is_plat }
- , {"is_cross", project._api_is_cross }
- , {"is_config", project._api_is_config }
+ {"is_os", project._api_is_os }
+ , {"is_kind", project._api_is_kind }
+ , {"is_arch", project._api_is_arch }
+ , {"is_mode", project._api_is_mode }
+ , {"is_plat", project._api_is_plat }
+ , {"is_cross", project._api_is_cross }
+ , {"is_config", project._api_is_config }
-- get_xxx
- , {"get_config", project._api_get_config }
+ , {"get_config", project._api_get_config }
-- has_xxx
- , {"has_config", project._api_has_config }
- , {"has_package", project._api_has_package }
+ , {"has_config", project._api_has_config }
+ , {"has_package", project._api_has_package }
-- add_xxx
- , {"add_moduledirs", project._api_add_moduledirs }
- , {"add_plugindirs", project._api_add_plugindirs }
- , {"add_platformdirs", project._api_add_platformdirs }
+ , {"add_moduledirs", project._api_add_moduledirs }
+ , {"add_plugindirs", project._api_add_plugindirs }
+ , {"add_platformdirs", project._api_add_platformdirs }
+ , {"add_toolchaindirs", project._api_add_toolchaindirs }
}
}
end
diff --git a/xmake/core/sandbox/modules/import/core/tool/toolchain.lua b/xmake/core/sandbox/modules/import/core/tool/toolchain.lua
index 46bd9fb1d..48867300e 100644
--- a/xmake/core/sandbox/modules/import/core/tool/toolchain.lua
+++ b/xmake/core/sandbox/modules/import/core/tool/toolchain.lua
@@ -28,7 +28,8 @@ local project = require("project/project")
local raise = require("sandbox/modules/raise")
-- inherit some builtin interfaces
-sandbox_core_tool_toolchain.apis = toolchain.apis
+sandbox_core_tool_toolchain.apis = toolchain.apis
+sandbox_core_tool_toolchain.directories = toolchain.directories
-- get all toolchains list
function sandbox_core_tool_toolchain.list()
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index a19413d34..1085df198 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -640,6 +640,15 @@ function toolchain.directories()
return dirs
end
+-- add toolchain directories
+function toolchain.add_directories(...)
+ local dirs = toolchain.directories()
+ for _, dir in ipairs({...}) do
+ table.insert(dirs, 1, dir)
+ end
+ toolchain._DIRS = table.unique(dirs)
+end
+
-- load toolchain
function toolchain.load(name, opt)
diff --git a/xmake/modules/core/project/depend.lua b/xmake/modules/core/project/depend.lua
index 4f81481bb..05b93acf1 100644
--- a/xmake/modules/core/project/depend.lua
+++ b/xmake/modules/core/project/depend.lua
@@ -44,7 +44,7 @@ function _get_depfiles_parser(depfiles_format)
end
local parser = depfiles_parsers[depfiles_format]
if parser == nil then
- parser = import("private.tools." .. depfiles_format .. ".parse_deps", {anonymous = true})
+ parser = import("core.tools." .. depfiles_format .. ".parse_deps", {anonymous = true})
depfiles_parsers[depfiles_format] = parser or false
end
return parser or nil
diff --git a/xmake/modules/detect/tools/ar/has_flags.lua b/xmake/modules/core/tools/ar/has_flags.lua
index 914680d69..d4742e6e2 100644
--- a/xmake/modules/detect/tools/ar/has_flags.lua
+++ b/xmake/modules/core/tools/ar/has_flags.lua
@@ -30,7 +30,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.ar.has_flags"
+ local key = "core.tools.ar.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/core/tools/armasm64_msvc/has_flags.lua b/xmake/modules/core/tools/armasm64_msvc/has_flags.lua
new file mode 100644
index 000000000..8fbab3d9f
--- /dev/null
+++ b/xmake/modules/core/tools/armasm64_msvc/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("core.tools.armasm_msvc.has_flags")
+
diff --git a/xmake/modules/detect/tools/armasm_msvc/has_flags.lua b/xmake/modules/core/tools/armasm_msvc/has_flags.lua
index 4f1d4ee97..f2aa5abed 100644
--- a/xmake/modules/detect/tools/armasm_msvc/has_flags.lua
+++ b/xmake/modules/core/tools/armasm_msvc/has_flags.lua
@@ -30,7 +30,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.armasm.has_flags"
+ local key = "core.tools.armasm.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/private/tools/armcc/parse_deps.lua b/xmake/modules/core/tools/armcc/parse_deps.lua
index afde0a575..afde0a575 100644
--- a/xmake/modules/private/tools/armcc/parse_deps.lua
+++ b/xmake/modules/core/tools/armcc/parse_deps.lua
diff --git a/xmake/modules/detect/tools/armclang/has_flags.lua b/xmake/modules/core/tools/armclang/has_flags.lua
index d1a2fa752..0c358e10a 100644
--- a/xmake/modules/detect/tools/armclang/has_flags.lua
+++ b/xmake/modules/core/tools/armclang/has_flags.lua
@@ -55,7 +55,7 @@ end
-- attempt to check it from the argument list
function _check_from_arglist(flags, opt, islinker)
- local key = "detect.tools.armclang." .. (islinker and "has_ldflags" or "has_cflags")
+ local key = "core.tools.armclang." .. (islinker and "has_ldflags" or "has_cflags")
local flagskey = opt.program .. "_" .. (opt.programver or "")
local allflags = detectcache:get2(key, flagskey)
if not allflags then
diff --git a/xmake/modules/detect/tools/icl/has_flags.lua b/xmake/modules/core/tools/circle/has_flags.lua
index eeba3941b..76744a133 100644
--- a/xmake/modules/detect/tools/icl/has_flags.lua
+++ b/xmake/modules/core/tools/circle/has_flags.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.cl.has_flags")
+inherit("core.tools.gcc.has_flags")
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 8a2971328..06e6759b9 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -26,7 +26,7 @@ import("core.project.project")
import("core.project.policy")
import("core.language.language")
import("private.tools.vstool")
-import("private.tools.cl.parse_include")
+import("core.tools.cl.parse_include")
import("private.cache.build_cache")
import("private.service.distcc_build.client", {alias = "distcc_build_client"})
import("utils.progress")
diff --git a/xmake/modules/detect/tools/cl/cfeatures.lua b/xmake/modules/core/tools/cl/cfeatures.lua
index 9b043f7e1..9b043f7e1 100644
--- a/xmake/modules/detect/tools/cl/cfeatures.lua
+++ b/xmake/modules/core/tools/cl/cfeatures.lua
diff --git a/xmake/modules/detect/tools/cl/cxxfeatures.lua b/xmake/modules/core/tools/cl/cxxfeatures.lua
index c8b683e6f..c8b683e6f 100644
--- a/xmake/modules/detect/tools/cl/cxxfeatures.lua
+++ b/xmake/modules/core/tools/cl/cxxfeatures.lua
diff --git a/xmake/modules/detect/tools/cl/features.lua b/xmake/modules/core/tools/cl/features.lua
index 0957fd7ed..0957fd7ed 100644
--- a/xmake/modules/detect/tools/cl/features.lua
+++ b/xmake/modules/core/tools/cl/features.lua
diff --git a/xmake/modules/detect/tools/cl/has_flags.lua b/xmake/modules/core/tools/cl/has_flags.lua
index 378c16a5b..d174d84e2 100644
--- a/xmake/modules/detect/tools/cl/has_flags.lua
+++ b/xmake/modules/core/tools/cl/has_flags.lua
@@ -34,7 +34,7 @@ end
-- attempt to check it from the argument list
function _check_from_arglist(flags, opt)
- local key = "detect.tools.cl.has_flags"
+ local key = "core.tools.cl.has_flags"
local flagskey = opt.program .. "_" .. (opt.programver or "")
local allflags = global_detectcache:get2(key, flagskey)
if not allflags then
diff --git a/xmake/modules/private/tools/cl/parse_deps.lua b/xmake/modules/core/tools/cl/parse_deps.lua
index 187d655cd..187d655cd 100644
--- a/xmake/modules/private/tools/cl/parse_deps.lua
+++ b/xmake/modules/core/tools/cl/parse_deps.lua
diff --git a/xmake/modules/private/tools/cl/parse_deps_json.lua b/xmake/modules/core/tools/cl/parse_deps_json.lua
index 50f728815..50f728815 100644
--- a/xmake/modules/private/tools/cl/parse_deps_json.lua
+++ b/xmake/modules/core/tools/cl/parse_deps_json.lua
diff --git a/xmake/modules/private/tools/cl/parse_include.lua b/xmake/modules/core/tools/cl/parse_include.lua
index 700f9823f..700f9823f 100644
--- a/xmake/modules/private/tools/cl/parse_include.lua
+++ b/xmake/modules/core/tools/cl/parse_include.lua
diff --git a/xmake/modules/detect/tools/ml64/has_flags.lua b/xmake/modules/core/tools/cl2000/has_flags.lua
index 259ac1e1d..5d331d6b1 100644
--- a/xmake/modules/detect/tools/ml64/has_flags.lua
+++ b/xmake/modules/core/tools/cl2000/has_flags.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.ml.has_flags")
+inherit("core.tools.cl6x.has_flags")
diff --git a/xmake/modules/private/tools/cl2000/parse_deps.lua b/xmake/modules/core/tools/cl2000/parse_deps.lua
index e02cf0501..c5d6e29c6 100644
--- a/xmake/modules/private/tools/cl2000/parse_deps.lua
+++ b/xmake/modules/core/tools/cl2000/parse_deps.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("private.tools.cl6x.parse_deps")
+inherit("core.tools.cl6x.parse_deps")
diff --git a/xmake/modules/core/tools/cl6x/has_flags.lua b/xmake/modules/core/tools/cl6x/has_flags.lua
new file mode 100644
index 000000000..a5f3f4b87
--- /dev/null
+++ b/xmake/modules/core/tools/cl6x/has_flags.lua
@@ -0,0 +1,121 @@
+--!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
+import("core.cache.detectcache")
+import("core.language.language")
+
+-- is linker?
+function _islinker(flags, opt)
+ local toolkind = opt.toolkind or ""
+ return toolkind == "ld" or toolkind == "sh" or toolkind:endswith("ld") or toolkind:endswith("sh")
+end
+
+-- try running
+function _try_running(program, argv, opt)
+ local errors = nil
+ return try { function () os.runv(program, argv, opt); return true end, catch { function (errs) errors = (errs or ""):trim() end }}, errors
+end
+
+-- attempt to check it from known flags
+function _check_from_knownargs(flags, opt, islinker)
+ local flag = flags[1]
+ if not islinker then
+ if flag:startswith("-D") or
+ flag:startswith("-U") or
+ flag:startswith("-I") then
+ return true
+ end
+ end
+end
+
+-- attempt to check it from the argument list
+function _check_from_arglist(flags, opt, islinker)
+ local key = "core.tools.cl6x." .. (islinker and "has_ldflags" or "has_cflags")
+ local flagskey = opt.program .. "_" .. (opt.programver or "")
+ local allflags = detectcache:get2(key, flagskey)
+ if not allflags then
+ allflags = {}
+ local arglist = try {function () return os.iorunv(opt.program, {"--help"}, {envs = opt.envs}) end}
+ if arglist then
+ for arg in arglist:gmatch("%s+(%-[%-%a%d]+)%s+") do
+ allflags[arg] = true
+ end
+ end
+ detectcache:set2(key, flagskey, allflags)
+ detectcache:save()
+ end
+ local flag = flags[1]
+ return allflags[flag]
+end
+
+-- get extension
+function _get_extension(opt)
+ -- @note we need to detect extension for ndk/clang++.exe: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
+ return (opt.program:endswith("++") or opt.flagkind == "cxxflags") and ".cpp" or (table.wrap(language.sourcekinds()[opt.toolkind or "cc"])[1] or ".c")
+end
+
+-- try running to check flags
+function _check_try_running(flags, opt, islinker)
+
+ -- make an stub source file
+ local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}\n"
+ local sourcefile = os.tmpfile("cl6x_has_flags:" .. snippet) .. _get_extension(opt)
+ if not os.isfile(sourcefile) then
+ io.writefile(sourcefile, snippet)
+ end
+
+ -- check flags for linker
+ local tmpfile = os.tmpfile()
+ if islinker then
+ return _try_running(opt.program, table.join(flags, "-z", "--output_file=" .. tmpfile, sourcefile), opt)
+ end
+
+ -- check flags for compiler
+ -- @note we cannot use os.nuldev() as the output file, maybe run failed for some flags, e.g. --coverage
+ return _try_running(opt.program, table.join(flags, "-c", "--output_file=" .. tmpfile, sourcefile), opt)
+end
+
+-- has_flags(flags)?
+--
+-- @param opt the argument options, e.g. {toolname = "", program = "", programver = "", toolkind = "[cc|cxx|ld|ar|sh|gc|mm|mxx]"}
+--
+-- @return true or false
+--
+function main(flags, opt)
+
+ -- is linker?
+ opt = opt or {}
+ local islinker = _islinker(flags, opt)
+
+ -- attempt to check it from the argument list
+ if not opt.tryrun then
+ if _check_from_arglist(flags, opt, islinker) then
+ return true
+ end
+ if _check_from_knownargs(flags, opt, islinker) then
+ return true
+ end
+ end
+
+ -- try running to check it
+ return _check_try_running(flags, opt, islinker)
+end
+
diff --git a/xmake/modules/core/tools/cl6x/parse_deps.lua b/xmake/modules/core/tools/cl6x/parse_deps.lua
new file mode 100644
index 000000000..a5d5ecd40
--- /dev/null
+++ b/xmake/modules/core/tools/cl6x/parse_deps.lua
@@ -0,0 +1,77 @@
+--!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 parse_deps.lua
+--
+
+-- imports
+import("core.project.config")
+import("core.project.project")
+import("core.base.hashset")
+
+-- normailize path of a dependecy
+function _normailize_dep(dep, projectdir)
+ -- escape characters, e.g. \#Qt.Widget_pch.h -> #Qt.Widget_pch.h
+ -- @see https://github.com/xmake-io/xmake/issues/4134
+ -- https://github.com/xmake-io/xmake/issues/4273
+ if not is_host("windows") then
+ dep = dep:gsub("\\(.)", "%1")
+ end
+ if path.is_absolute(dep) then
+ dep = path.translate(dep)
+ else
+ dep = path.absolute(dep, projectdir)
+ end
+ if dep:startswith(projectdir) then
+ return path.relative(dep, projectdir)
+ else
+ -- we also need to check header files outside project
+ -- https://github.com/xmake-io/xmake/issues/1154
+ return dep
+ end
+end
+
+-- parse depsfiles from string
+--
+-- parse_deps(io.readfile(depfile, {continuation = "\\"}))
+--
+-- eg.
+--
+-- build/.objs/foo/linux/x86_64/release/src/foo.c.o: src/foo.c
+-- build/.objs/foo/linux/x86_64/release/src/foo.c.o: src/foo.h
+--
+-- build/.objs/tests/linux/x86_64/release/src/main.c.o: src/main.c
+-- build/.objs/tests/linux/x86_64/release/src/main.c.o: src/foo.h
+-- build/.objs/tests/linux/x86_64/release/src/main.c.o: src/bar.h
+-- build/.objs/tests/linux/x86_64/release/src/main.c.o: src/zoo.h
+--
+function main(depsdata, opt)
+ local results = hashset.new()
+ local projectdir = os.projectdir()
+ local line = depsdata:rtrim() -- maybe there will be an empty newline at the end. so we trim it first
+ local plain = {plain = true}
+ for _, includefile in ipairs(line:split('\n', plain)) do -- it will trim all internal spaces without `{strict = true}`
+ includefile = includefile:split(": ", plain)[2]
+ if includefile and #includefile > 0 then
+ includefile = _normailize_dep(includefile, projectdir)
+ if includefile then
+ results:insert(includefile)
+ end
+ end
+ end
+ return results:to_array()
+end
diff --git a/xmake/modules/private/tools/cl_json/parse_deps.lua b/xmake/modules/core/tools/cl_json/parse_deps.lua
index 21b3c9a9d..21b3c9a9d 100644
--- a/xmake/modules/private/tools/cl_json/parse_deps.lua
+++ b/xmake/modules/core/tools/cl_json/parse_deps.lua
diff --git a/xmake/modules/detect/tools/clang/cfeatures.lua b/xmake/modules/core/tools/clang/cfeatures.lua
index e9a1687a6..a6d10f6e1 100644
--- a/xmake/modules/detect/tools/clang/cfeatures.lua
+++ b/xmake/modules/core/tools/clang/cfeatures.lua
@@ -19,7 +19,7 @@
--
-- imports
-import("detect.tools.gcc.cfeatures")
+import("core.tools.gcc.cfeatures")
-- set features
function _set(feature, condition)
diff --git a/xmake/modules/detect/tools/clang/cxxfeatures.lua b/xmake/modules/core/tools/clang/cxxfeatures.lua
index 1fd57c8d6..4a98a1e74 100644
--- a/xmake/modules/detect/tools/clang/cxxfeatures.lua
+++ b/xmake/modules/core/tools/clang/cxxfeatures.lua
@@ -19,7 +19,7 @@
--
-- imports
-import("detect.tools.gcc.cxxfeatures")
+import("core.tools.gcc.cxxfeatures")
-- set features
function _set(feature, condition)
diff --git a/xmake/modules/detect/tools/clang/features.lua b/xmake/modules/core/tools/clang/features.lua
index b7562980f..c2e2bf523 100644
--- a/xmake/modules/detect/tools/clang/features.lua
+++ b/xmake/modules/core/tools/clang/features.lua
@@ -19,7 +19,7 @@
--
-- imports
-inherit("detect.tools.gcc.features")
+inherit("core.tools.gcc.features")
import("cfeatures")
import("cxxfeatures")
diff --git a/xmake/modules/detect/tools/clang/has_flags.lua b/xmake/modules/core/tools/clang/has_flags.lua
index 6464e10b6..76744a133 100644
--- a/xmake/modules/detect/tools/clang/has_flags.lua
+++ b/xmake/modules/core/tools/clang/has_flags.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.gcc.has_flags")
+inherit("core.tools.gcc.has_flags")
diff --git a/xmake/modules/detect/tools/clang_cl/has_flags.lua b/xmake/modules/core/tools/clang_cl/has_flags.lua
index 3f173dea4..56d83998a 100644
--- a/xmake/modules/detect/tools/clang_cl/has_flags.lua
+++ b/xmake/modules/core/tools/clang_cl/has_flags.lua
@@ -31,7 +31,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.clang_cl.has_flags"
+ local key = "core.tools.clang_cl.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/detect/tools/nvc/features.lua b/xmake/modules/core/tools/clangxx/features.lua
index b887b9efc..08c822cfd 100644
--- a/xmake/modules/detect/tools/nvc/features.lua
+++ b/xmake/modules/core/tools/clangxx/features.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.gcc.features")
+inherit("core.tools.gcc.features")
diff --git a/xmake/modules/detect/tools/clangxx/has_flags.lua b/xmake/modules/core/tools/clangxx/has_flags.lua
index 6464e10b6..76744a133 100644
--- a/xmake/modules/detect/tools/clangxx/has_flags.lua
+++ b/xmake/modules/core/tools/clangxx/has_flags.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.gcc.has_flags")
+inherit("core.tools.gcc.has_flags")
diff --git a/xmake/modules/detect/tools/cosmocc/has_flags.lua b/xmake/modules/core/tools/cosmocc/has_flags.lua
index df8690652..51a673a4e 100644
--- a/xmake/modules/detect/tools/cosmocc/has_flags.lua
+++ b/xmake/modules/core/tools/cosmocc/has_flags.lua
@@ -59,7 +59,7 @@ end
-- attempt to check it from the argument list
function _check_from_arglist(flags, opt, islinker)
- local key = "detect.tools.cosmocc." .. (islinker and "has_ldflags" or "has_cflags")
+ local key = "core.tools.cosmocc." .. (islinker and "has_ldflags" or "has_cflags")
local flagskey = opt.program .. "_" .. (opt.programver or "")
local allflags = detectcache:get2(key, flagskey)
if not allflags then
diff --git a/xmake/modules/detect/tools/cl2000/has_flags.lua b/xmake/modules/core/tools/cosmocxx/has_flags.lua
index 4b108a611..3181c0647 100644
--- a/xmake/modules/detect/tools/cl2000/has_flags.lua
+++ b/xmake/modules/core/tools/cosmocxx/has_flags.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.cl6x.has_flags")
+inherit("core.tools.cosmocc.has_flags")
diff --git a/xmake/modules/detect/tools/dmd/has_flags.lua b/xmake/modules/core/tools/dmd/has_flags.lua
index 235e99d4c..c69c27166 100644
--- a/xmake/modules/detect/tools/dmd/has_flags.lua
+++ b/xmake/modules/core/tools/dmd/has_flags.lua
@@ -52,7 +52,7 @@ function _check_from_arglist(flags, opt, islinker)
end
-- make cache key
- local key = "detect.tools.dmd.has_flags"
+ local key = "core.tools.dmd.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/detect/tools/dpcpp/cfeatures.lua b/xmake/modules/core/tools/dpcpp/cfeatures.lua
index 161f91c05..9cc3928ce 100644
--- a/xmake/modules/detect/tools/dpcpp/cfeatures.lua
+++ b/xmake/modules/core/tools/dpcpp/cfeatures.lua
@@ -19,4 +19,4 @@
--
-- imports
-import("detect.tools.clang.cfeatures")
+import("core.tools.clang.cfeatures")
diff --git a/xmake/modules/detect/tools/dpcpp/cxxfeatures.lua b/xmake/modules/core/tools/dpcpp/cxxfeatures.lua
index cf7f8d08e..4c779fbb8 100644
--- a/xmake/modules/detect/tools/dpcpp/cxxfeatures.lua
+++ b/xmake/modules/core/tools/dpcpp/cxxfeatures.lua
@@ -19,4 +19,4 @@
--
-- imports
-import("detect.tools.clang.cxxfeatures")
+import("core.tools.clang.cxxfeatures")
diff --git a/xmake/modules/core/tools/dpcpp/features.lua b/xmake/modules/core/tools/dpcpp/features.lua
new file mode 100644
index 000000000..8c04a299c
--- /dev/null
+++ b/xmake/modules/core/tools/dpcpp/features.lua
@@ -0,0 +1,22 @@
+--!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 features.lua
+--
+
+-- imports
+inherit("core.tools.clang.features")
diff --git a/xmake/modules/detect/tools/circle/has_flags.lua b/xmake/modules/core/tools/dpcpp/has_flags.lua
index 6464e10b6..284736424 100644
--- a/xmake/modules/detect/tools/circle/has_flags.lua
+++ b/xmake/modules/core/tools/dpcpp/has_flags.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.gcc.has_flags")
+inherit("core.tools.clang.has_flags")
diff --git a/xmake/modules/core/tools/emcc/has_flags.lua b/xmake/modules/core/tools/emcc/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/emcc/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/core/tools/emxx/has_flags.lua b/xmake/modules/core/tools/emxx/has_flags.lua
new file mode 100644
index 000000000..b4d6369d6
--- /dev/null
+++ b/xmake/modules/core/tools/emxx/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("core.tools.emcc.has_flags")
+
diff --git a/xmake/modules/detect/tools/fpc/has_flags.lua b/xmake/modules/core/tools/fpc/has_flags.lua
index 109e1014b..8c4e68086 100644
--- a/xmake/modules/detect/tools/fpc/has_flags.lua
+++ b/xmake/modules/core/tools/fpc/has_flags.lua
@@ -38,7 +38,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.fpc.has_flags"
+ local key = "core.tools.fpc.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/detect/tools/gcc/cfeatures.lua b/xmake/modules/core/tools/gcc/cfeatures.lua
index b9ebaa036..b9ebaa036 100644
--- a/xmake/modules/detect/tools/gcc/cfeatures.lua
+++ b/xmake/modules/core/tools/gcc/cfeatures.lua
diff --git a/xmake/modules/detect/tools/gcc/cxxfeatures.lua b/xmake/modules/core/tools/gcc/cxxfeatures.lua
index 9d628522c..9d628522c 100644
--- a/xmake/modules/detect/tools/gcc/cxxfeatures.lua
+++ b/xmake/modules/core/tools/gcc/cxxfeatures.lua
diff --git a/xmake/modules/detect/tools/gcc/features.lua b/xmake/modules/core/tools/gcc/features.lua
index 153cc3fb4..153cc3fb4 100644
--- a/xmake/modules/detect/tools/gcc/features.lua
+++ b/xmake/modules/core/tools/gcc/features.lua
diff --git a/xmake/modules/detect/tools/gcc/has_flags.lua b/xmake/modules/core/tools/gcc/has_flags.lua
index 181cef04e..25d08be01 100644
--- a/xmake/modules/detect/tools/gcc/has_flags.lua
+++ b/xmake/modules/core/tools/gcc/has_flags.lua
@@ -56,7 +56,7 @@ end
-- attempt to check it from the argument list
function _check_from_arglist(flags, opt, islinker)
- local key = "detect.tools.gcc." .. (islinker and "has_ldflags" or "has_cflags")
+ local key = "core.tools.gcc." .. (islinker and "has_ldflags" or "has_cflags")
local flagskey = opt.program .. "_" .. (opt.programver or "")
local allflags = detectcache:get2(key, flagskey)
if not allflags then
diff --git a/xmake/modules/private/tools/gcc/parse_deps.lua b/xmake/modules/core/tools/gcc/parse_deps.lua
index b4b5cba7f..b4b5cba7f 100644
--- a/xmake/modules/private/tools/gcc/parse_deps.lua
+++ b/xmake/modules/core/tools/gcc/parse_deps.lua
diff --git a/xmake/modules/core/tools/gccgo/has_flags.lua b/xmake/modules/core/tools/gccgo/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/gccgo/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/detect/tools/gdc/has_flags.lua b/xmake/modules/core/tools/gdc/has_flags.lua
index 1ba8c98b0..e4cc32f65 100644
--- a/xmake/modules/detect/tools/gdc/has_flags.lua
+++ b/xmake/modules/core/tools/gdc/has_flags.lua
@@ -51,7 +51,7 @@ function _check_from_arglist(flags, opt, islinker)
end
-- make cache key
- local key = "detect.tools.gdc.has_flags"
+ local key = "core.tools.gdc.has_flags"
-- make flags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/detect/tools/gfortran/has_flags.lua b/xmake/modules/core/tools/gfortran/has_flags.lua
index 62a35c653..3552d4d45 100644
--- a/xmake/modules/detect/tools/gfortran/has_flags.lua
+++ b/xmake/modules/core/tools/gfortran/has_flags.lua
@@ -51,7 +51,7 @@ function _check_from_arglist(flags, opt, islinker)
end
-- make cache key
- local key = "detect.tools.gfortran.has_flags"
+ local key = "core.tools.gfortran.has_flags"
-- make flags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/detect/tools/go/has_flags.lua b/xmake/modules/core/tools/go/has_flags.lua
index e1acf3769..bf96a1f1f 100644
--- a/xmake/modules/detect/tools/go/has_flags.lua
+++ b/xmake/modules/core/tools/go/has_flags.lua
@@ -47,7 +47,7 @@ function _check_from_arglist(flags, opt, islinker)
end
-- make cache key
- local key = "detect.tools.go.has_flags"
+ local key = "core.tools.go.has_flags"
-- make flags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/detect/tools/gxx/features.lua b/xmake/modules/core/tools/gxx/features.lua
index b887b9efc..08c822cfd 100644
--- a/xmake/modules/detect/tools/gxx/features.lua
+++ b/xmake/modules/core/tools/gxx/features.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.gcc.features")
+inherit("core.tools.gcc.features")
diff --git a/xmake/modules/core/tools/gxx/has_flags.lua b/xmake/modules/core/tools/gxx/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/gxx/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/core/tools/icc/has_flags.lua b/xmake/modules/core/tools/icc/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/icc/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/core/tools/icl/has_flags.lua b/xmake/modules/core/tools/icl/has_flags.lua
new file mode 100644
index 000000000..ab189dfd0
--- /dev/null
+++ b/xmake/modules/core/tools/icl/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("core.tools.cl.has_flags")
+
diff --git a/xmake/modules/core/tools/icpc/has_flags.lua b/xmake/modules/core/tools/icpc/has_flags.lua
new file mode 100644
index 000000000..a2d18c48f
--- /dev/null
+++ b/xmake/modules/core/tools/icpc/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("core.tools.gxx.has_flags")
+
diff --git a/xmake/modules/detect/tools/nvcxx/features.lua b/xmake/modules/core/tools/icpx/features.lua
index b887b9efc..7628827f1 100644
--- a/xmake/modules/detect/tools/nvcxx/features.lua
+++ b/xmake/modules/core/tools/icpx/features.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.gcc.features")
+inherit("core.tools.clang.features")
diff --git a/xmake/modules/detect/tools/emcc/has_flags.lua b/xmake/modules/core/tools/icpx/has_flags.lua
index 6464e10b6..284736424 100644
--- a/xmake/modules/detect/tools/emcc/has_flags.lua
+++ b/xmake/modules/core/tools/icpx/has_flags.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.gcc.has_flags")
+inherit("core.tools.clang.has_flags")
diff --git a/xmake/modules/detect/tools/icx/cfeatures.lua b/xmake/modules/core/tools/icx/cfeatures.lua
index 161f91c05..9cc3928ce 100644
--- a/xmake/modules/detect/tools/icx/cfeatures.lua
+++ b/xmake/modules/core/tools/icx/cfeatures.lua
@@ -19,4 +19,4 @@
--
-- imports
-import("detect.tools.clang.cfeatures")
+import("core.tools.clang.cfeatures")
diff --git a/xmake/modules/detect/tools/icx/cxxfeatures.lua b/xmake/modules/core/tools/icx/cxxfeatures.lua
index cf7f8d08e..4c779fbb8 100644
--- a/xmake/modules/detect/tools/icx/cxxfeatures.lua
+++ b/xmake/modules/core/tools/icx/cxxfeatures.lua
@@ -19,4 +19,4 @@
--
-- imports
-import("detect.tools.clang.cxxfeatures")
+import("core.tools.clang.cxxfeatures")
diff --git a/xmake/modules/core/tools/icx/features.lua b/xmake/modules/core/tools/icx/features.lua
new file mode 100644
index 000000000..8c04a299c
--- /dev/null
+++ b/xmake/modules/core/tools/icx/features.lua
@@ -0,0 +1,22 @@
+--!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 features.lua
+--
+
+-- imports
+inherit("core.tools.clang.features")
diff --git a/xmake/modules/core/tools/icx/has_flags.lua b/xmake/modules/core/tools/icx/has_flags.lua
new file mode 100644
index 000000000..284736424
--- /dev/null
+++ b/xmake/modules/core/tools/icx/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("core.tools.clang.has_flags")
+
diff --git a/xmake/modules/detect/tools/ifort/has_flags.lua b/xmake/modules/core/tools/ifort/has_flags.lua
index 86a504867..df3acfe3e 100644
--- a/xmake/modules/detect/tools/ifort/has_flags.lua
+++ b/xmake/modules/core/tools/ifort/has_flags.lua
@@ -20,8 +20,8 @@
-- imports
if is_host("windows") then
- inherit("detect.tools.cl.has_flags")
+ inherit("core.tools.cl.has_flags")
else
- inherit("detect.tools.gfortran.has_flags")
+ inherit("core.tools.gfortran.has_flags")
end
diff --git a/xmake/modules/core/tools/ifx/has_flags.lua b/xmake/modules/core/tools/ifx/has_flags.lua
new file mode 100644
index 000000000..d1f745651
--- /dev/null
+++ b/xmake/modules/core/tools/ifx/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("core.tools.ifort.has_flags")
+
diff --git a/xmake/modules/core/tools/ldc2/has_flags.lua b/xmake/modules/core/tools/ldc2/has_flags.lua
new file mode 100644
index 000000000..81dd1e94a
--- /dev/null
+++ b/xmake/modules/core/tools/ldc2/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("core.tools.dmd.has_flags")
+
diff --git a/xmake/modules/detect/tools/link/has_flags.lua b/xmake/modules/core/tools/link/has_flags.lua
index 6b0cf48f8..1f93b7979 100644
--- a/xmake/modules/detect/tools/link/has_flags.lua
+++ b/xmake/modules/core/tools/link/has_flags.lua
@@ -30,7 +30,7 @@ end
-- attempt to check it from the argument list
function _check_from_arglist(flags, opt)
- local key = "detect.tools.link.has_flags"
+ local key = "core.tools.link.has_flags"
local flagskey = opt.program .. "_" .. (opt.programver or "")
local allflags = global_detectcache:get2(key, flagskey)
if not allflags then
diff --git a/xmake/modules/detect/tools/ml/has_flags.lua b/xmake/modules/core/tools/ml/has_flags.lua
index 0dbda2134..6eeb4e768 100644
--- a/xmake/modules/detect/tools/ml/has_flags.lua
+++ b/xmake/modules/core/tools/ml/has_flags.lua
@@ -30,7 +30,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.ml.has_flags"
+ local key = "core.tools.ml.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/core/tools/ml64/has_flags.lua b/xmake/modules/core/tools/ml64/has_flags.lua
new file mode 100644
index 000000000..323fd4d5e
--- /dev/null
+++ b/xmake/modules/core/tools/ml64/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("core.tools.ml.has_flags")
+
diff --git a/xmake/modules/detect/tools/nim/has_flags.lua b/xmake/modules/core/tools/nim/has_flags.lua
index 5538257fb..84ce412b7 100644
--- a/xmake/modules/detect/tools/nim/has_flags.lua
+++ b/xmake/modules/core/tools/nim/has_flags.lua
@@ -38,7 +38,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.nim.has_flags"
+ local key = "core.tools.nim.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/detect/tools/clangxx/features.lua b/xmake/modules/core/tools/nvc/features.lua
index b887b9efc..08c822cfd 100644
--- a/xmake/modules/detect/tools/clangxx/features.lua
+++ b/xmake/modules/core/tools/nvc/features.lua
@@ -19,5 +19,5 @@
--
-- imports
-inherit("detect.tools.gcc.features")
+inherit("core.tools.gcc.features")
diff --git a/xmake/modules/core/tools/nvc/has_flags.lua b/xmake/modules/core/tools/nvc/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/nvc/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/detect/tools/nvcc/has_flags.lua b/xmake/modules/core/tools/nvcc/has_flags.lua
index ff1c47b42..347961e70 100644
--- a/xmake/modules/detect/tools/nvcc/has_flags.lua
+++ b/xmake/modules/core/tools/nvcc/has_flags.lua
@@ -72,7 +72,7 @@ function _check_from_arglist(flags, opt, islinker)
end
-- make cache key
- local key = "detect.tools.nvcc.has_flags"
+ local key = "core.tools.nvcc.has_flags"
-- make flags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/core/tools/nvcxx/features.lua b/xmake/modules/core/tools/nvcxx/features.lua
new file mode 100644
index 000000000..08c822cfd
--- /dev/null
+++ b/xmake/modules/core/tools/nvcxx/features.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 features.lua
+--
+
+-- imports
+inherit("core.tools.gcc.features")
+
diff --git a/xmake/modules/core/tools/nvcxx/has_flags.lua b/xmake/modules/core/tools/nvcxx/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/nvcxx/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/core/tools/nvfortran/has_flags.lua b/xmake/modules/core/tools/nvfortran/has_flags.lua
new file mode 100644
index 000000000..d0447806f
--- /dev/null
+++ b/xmake/modules/core/tools/nvfortran/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("core.tools.gfortran.has_flags")
+
diff --git a/xmake/modules/detect/tools/rc/has_flags.lua b/xmake/modules/core/tools/rc/has_flags.lua
index ac023c466..a635a3f68 100644
--- a/xmake/modules/detect/tools/rc/has_flags.lua
+++ b/xmake/modules/core/tools/rc/has_flags.lua
@@ -31,7 +31,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.rc.has_flags"
+ local key = "core.tools.rc.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/private/tools/rc/parse_deps.lua b/xmake/modules/core/tools/rc/parse_deps.lua
index 778f7b03f..778f7b03f 100644
--- a/xmake/modules/private/tools/rc/parse_deps.lua
+++ b/xmake/modules/core/tools/rc/parse_deps.lua
diff --git a/xmake/modules/detect/tools/rustc/has_flags.lua b/xmake/modules/core/tools/rustc/has_flags.lua
index e1696e454..9072b1c35 100644
--- a/xmake/modules/detect/tools/rustc/has_flags.lua
+++ b/xmake/modules/core/tools/rustc/has_flags.lua
@@ -48,7 +48,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.rustc.has_flags"
+ local key = "core.tools.rustc.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/detect/tools/sdcc/has_flags.lua b/xmake/modules/core/tools/sdcc/has_flags.lua
index 18c0eb3ae..e960fa8e1 100644
--- a/xmake/modules/detect/tools/sdcc/has_flags.lua
+++ b/xmake/modules/core/tools/sdcc/has_flags.lua
@@ -53,7 +53,7 @@ function _check_from_arglist(flags, opt, islinker)
end
-- make cache key
- local key = "detect.tools.sdcc.has_flags"
+ local key = "core.tools.sdcc.has_flags"
-- make flags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/core/tools/swift_frontend/has_flags.lua b/xmake/modules/core/tools/swift_frontend/has_flags.lua
new file mode 100644
index 000000000..eecb0ede7
--- /dev/null
+++ b/xmake/modules/core/tools/swift_frontend/has_flags.lua
@@ -0,0 +1,22 @@
+--!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("core.tools.swiftc.has_flags")
diff --git a/xmake/modules/detect/tools/swiftc/has_flags.lua b/xmake/modules/core/tools/swiftc/has_flags.lua
index 99b36de75..cf56da7c5 100644
--- a/xmake/modules/detect/tools/swiftc/has_flags.lua
+++ b/xmake/modules/core/tools/swiftc/has_flags.lua
@@ -37,7 +37,7 @@ function _check_from_arglist(flags, opt)
end
-- make cache key
- local key = "detect.tools.swiftc.has_flags"
+ local key = "core.tools.swiftc.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/core/tools/tcc/has_flags.lua b/xmake/modules/core/tools/tcc/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/tcc/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/detect/tools/zig/has_flags.lua b/xmake/modules/core/tools/zig/has_flags.lua
index 1dea91cfe..92aeb5c72 100644
--- a/xmake/modules/detect/tools/zig/has_flags.lua
+++ b/xmake/modules/core/tools/zig/has_flags.lua
@@ -46,7 +46,7 @@ function _check_from_arglist(flags, opt, islinker)
end
-- make cache key
- local key = "detect.tools.zig.has_flags"
+ local key = "core.tools.zig.has_flags"
-- make allflags key
local flagskey = opt.program .. "_" .. (opt.programver or "")
diff --git a/xmake/modules/core/tools/zig_cc/features.lua b/xmake/modules/core/tools/zig_cc/features.lua
new file mode 100644
index 000000000..08c822cfd
--- /dev/null
+++ b/xmake/modules/core/tools/zig_cc/features.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 features.lua
+--
+
+-- imports
+inherit("core.tools.gcc.features")
+
diff --git a/xmake/modules/core/tools/zig_cc/has_flags.lua b/xmake/modules/core/tools/zig_cc/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/zig_cc/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/core/tools/zig_cxx/features.lua b/xmake/modules/core/tools/zig_cxx/features.lua
new file mode 100644
index 000000000..08c822cfd
--- /dev/null
+++ b/xmake/modules/core/tools/zig_cxx/features.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 features.lua
+--
+
+-- imports
+inherit("core.tools.gcc.features")
+
diff --git a/xmake/modules/core/tools/zig_cxx/has_flags.lua b/xmake/modules/core/tools/zig_cxx/has_flags.lua
new file mode 100644
index 000000000..76744a133
--- /dev/null
+++ b/xmake/modules/core/tools/zig_cxx/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("core.tools.gcc.has_flags")
+
diff --git a/xmake/modules/detect/tools/cosmocxx/has_flags.lua b/xmake/modules/detect/tools/cosmocxx/has_flags.lua
deleted file mode 100644
index 3f4e9dfad..000000000
--- a/xmake/modules/detect/tools/cosmocxx/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.cosmocc.has_flags")
-
diff --git a/xmake/modules/detect/tools/dpcpp/features.lua b/xmake/modules/detect/tools/dpcpp/features.lua
deleted file mode 100644
index e54887f71..000000000
--- a/xmake/modules/detect/tools/dpcpp/features.lua
+++ /dev/null
@@ -1,22 +0,0 @@
---!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 features.lua
---
-
--- imports
-inherit("detect.tools.clang.features")
diff --git a/xmake/modules/detect/tools/dpcpp/has_flags.lua b/xmake/modules/detect/tools/dpcpp/has_flags.lua
deleted file mode 100644
index d8c6f2792..000000000
--- a/xmake/modules/detect/tools/dpcpp/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.clang.has_flags")
-
diff --git a/xmake/modules/detect/tools/emxx/has_flags.lua b/xmake/modules/detect/tools/emxx/has_flags.lua
deleted file mode 100644
index 27fc6812e..000000000
--- a/xmake/modules/detect/tools/emxx/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.emcc.has_flags")
-
diff --git a/xmake/modules/detect/tools/gccgo/has_flags.lua b/xmake/modules/detect/tools/gccgo/has_flags.lua
deleted file mode 100644
index 6464e10b6..000000000
--- a/xmake/modules/detect/tools/gccgo/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gcc.has_flags")
-
diff --git a/xmake/modules/detect/tools/gxx/has_flags.lua b/xmake/modules/detect/tools/gxx/has_flags.lua
deleted file mode 100644
index 6464e10b6..000000000
--- a/xmake/modules/detect/tools/gxx/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gcc.has_flags")
-
diff --git a/xmake/modules/detect/tools/icc/has_flags.lua b/xmake/modules/detect/tools/icc/has_flags.lua
deleted file mode 100644
index 6464e10b6..000000000
--- a/xmake/modules/detect/tools/icc/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gcc.has_flags")
-
diff --git a/xmake/modules/detect/tools/icpc/has_flags.lua b/xmake/modules/detect/tools/icpc/has_flags.lua
deleted file mode 100644
index da83182b5..000000000
--- a/xmake/modules/detect/tools/icpc/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gxx.has_flags")
-
diff --git a/xmake/modules/detect/tools/icpx/features.lua b/xmake/modules/detect/tools/icpx/features.lua
deleted file mode 100644
index e9dc9ae44..000000000
--- a/xmake/modules/detect/tools/icpx/features.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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 features.lua
---
-
--- imports
-inherit("detect.tools.clang.features")
-
diff --git a/xmake/modules/detect/tools/icpx/has_flags.lua b/xmake/modules/detect/tools/icpx/has_flags.lua
deleted file mode 100644
index d8c6f2792..000000000
--- a/xmake/modules/detect/tools/icpx/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.clang.has_flags")
-
diff --git a/xmake/modules/detect/tools/icx/features.lua b/xmake/modules/detect/tools/icx/features.lua
deleted file mode 100644
index e54887f71..000000000
--- a/xmake/modules/detect/tools/icx/features.lua
+++ /dev/null
@@ -1,22 +0,0 @@
---!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 features.lua
---
-
--- imports
-inherit("detect.tools.clang.features")
diff --git a/xmake/modules/detect/tools/icx/has_flags.lua b/xmake/modules/detect/tools/icx/has_flags.lua
deleted file mode 100644
index d8c6f2792..000000000
--- a/xmake/modules/detect/tools/icx/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.clang.has_flags")
-
diff --git a/xmake/modules/detect/tools/ifx/has_flags.lua b/xmake/modules/detect/tools/ifx/has_flags.lua
deleted file mode 100644
index 161e337e9..000000000
--- a/xmake/modules/detect/tools/ifx/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.ifort.has_flags")
-
diff --git a/xmake/modules/detect/tools/ldc2/has_flags.lua b/xmake/modules/detect/tools/ldc2/has_flags.lua
deleted file mode 100644
index 107ec49b9..000000000
--- a/xmake/modules/detect/tools/ldc2/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.dmd.has_flags")
-
diff --git a/xmake/modules/detect/tools/nvc/has_flags.lua b/xmake/modules/detect/tools/nvc/has_flags.lua
deleted file mode 100644
index 6464e10b6..000000000
--- a/xmake/modules/detect/tools/nvc/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gcc.has_flags")
-
diff --git a/xmake/modules/detect/tools/nvcxx/has_flags.lua b/xmake/modules/detect/tools/nvcxx/has_flags.lua
deleted file mode 100644
index 6464e10b6..000000000
--- a/xmake/modules/detect/tools/nvcxx/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gcc.has_flags")
-
diff --git a/xmake/modules/detect/tools/nvfortran/has_flags.lua b/xmake/modules/detect/tools/nvfortran/has_flags.lua
deleted file mode 100644
index c0ee706cd..000000000
--- a/xmake/modules/detect/tools/nvfortran/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gfortran.has_flags")
-
diff --git a/xmake/modules/detect/tools/swift_frontend/has_flags.lua b/xmake/modules/detect/tools/swift_frontend/has_flags.lua
deleted file mode 100644
index 4af0d592f..000000000
--- a/xmake/modules/detect/tools/swift_frontend/has_flags.lua
+++ /dev/null
@@ -1,22 +0,0 @@
---!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.swiftc.has_flags")
diff --git a/xmake/modules/detect/tools/tcc/has_flags.lua b/xmake/modules/detect/tools/tcc/has_flags.lua
deleted file mode 100644
index 6464e10b6..000000000
--- a/xmake/modules/detect/tools/tcc/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gcc.has_flags")
-
diff --git a/xmake/modules/detect/tools/zig_cc/features.lua b/xmake/modules/detect/tools/zig_cc/features.lua
deleted file mode 100644
index b887b9efc..000000000
--- a/xmake/modules/detect/tools/zig_cc/features.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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 features.lua
---
-
--- imports
-inherit("detect.tools.gcc.features")
-
diff --git a/xmake/modules/detect/tools/zig_cc/has_flags.lua b/xmake/modules/detect/tools/zig_cc/has_flags.lua
deleted file mode 100644
index 6464e10b6..000000000
--- a/xmake/modules/detect/tools/zig_cc/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gcc.has_flags")
-
diff --git a/xmake/modules/detect/tools/zig_cxx/features.lua b/xmake/modules/detect/tools/zig_cxx/features.lua
deleted file mode 100644
index b887b9efc..000000000
--- a/xmake/modules/detect/tools/zig_cxx/features.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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 features.lua
---
-
--- imports
-inherit("detect.tools.gcc.features")
-
diff --git a/xmake/modules/detect/tools/zig_cxx/has_flags.lua b/xmake/modules/detect/tools/zig_cxx/has_flags.lua
deleted file mode 100644
index 6464e10b6..000000000
--- a/xmake/modules/detect/tools/zig_cxx/has_flags.lua
+++ /dev/null
@@ -1,23 +0,0 @@
---!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.gcc.has_flags")
-
diff --git a/xmake/modules/lib/detect/features.lua b/xmake/modules/lib/detect/features.lua
index 7a00b04b4..ac72d288d 100644
--- a/xmake/modules/lib/detect/features.lua
+++ b/xmake/modules/lib/detect/features.lua
@@ -68,8 +68,8 @@ function main(name, opt)
return result
end
- -- detect.tools.xxx.features(opt)?
- local features = import("detect.tools." .. tool.name .. ".features", {try = true})
+ -- core.tools.xxx.features(opt)?
+ local features = import("core.tools." .. tool.name .. ".features", {try = true})
if features then
result = features(opt)
end
diff --git a/xmake/modules/lib/detect/find_tool.lua b/xmake/modules/lib/detect/find_tool.lua
index e761cb9a7..fa2b7b3bb 100644
--- a/xmake/modules/lib/detect/find_tool.lua
+++ b/xmake/modules/lib/detect/find_tool.lua
@@ -23,6 +23,7 @@ import("lib.detect.find_program")
import("lib.detect.find_programver")
import("lib.detect.find_toolname")
import("core.base.semver")
+import("core.tool.toolchain")
-- find tool from modules
function _find_from_modules(name, opt)
diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua
index abfae3a57..7f915fe21 100644
--- a/xmake/modules/lib/detect/has_flags.lua
+++ b/xmake/modules/lib/detect/has_flags.lua
@@ -118,8 +118,8 @@ function main(name, flags, opt)
-- start profile
profiler.enter("has_flags", tool.name, checkflags[1])
- -- detect.tools.xxx.has_flags(flags, opt)?
- local hasflags = import("detect.tools." .. tool.name .. ".has_flags", {try = true})
+ -- core.tools.xxx.has_flags(flags, opt)?
+ local hasflags = import("core.tools." .. tool.name .. ".has_flags", {try = true})
local errors = nil
if hasflags then
result, errors = hasflags(checkflags, opt)
diff --git a/xmake/plugins/project/ninja/build_ninja.lua b/xmake/plugins/project/ninja/build_ninja.lua
index 7a9ce3998..819758447 100644
--- a/xmake/plugins/project/ninja/build_ninja.lua
+++ b/xmake/plugins/project/ninja/build_ninja.lua
@@ -27,7 +27,7 @@ import("core.tool.linker")
import("core.tool.compiler")
import("lib.detect.find_tool")
import("lib.detect.find_toolname")
-import("private.tools.cl.parse_include")
+import("core.tools.cl.parse_include")
-- this sourcebatch is built?
function _sourcebatch_is_built(sourcebatch)