From 503e32aa9f2b40e3f5c3167e67d732c79ec26440 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 16 Jan 2023 22:47:18 +0800 Subject: fix check flags --- xmake/core/tool/builder.lua | 6 ++++++ xmake/modules/core/tools/c51.lua | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index 9fa225155..9070cca85 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -343,6 +343,12 @@ function builder:_add_flags_from_language(flags, target, getters) local flagscope = flaginfo[1] local flagname = flaginfo[2] local checkstate = flaginfo[3] + if checkstate then + local auto_ignore_flags = target and target.policy and target:policy("check.auto_ignore_flags") + if auto_ignore_flags == false then + checkstate = false + end + end -- get getter local getter = getters[flagscope] diff --git a/xmake/modules/core/tools/c51.lua b/xmake/modules/core/tools/c51.lua index fd3f3db26..803d6f3c0 100644 --- a/xmake/modules/core/tools/c51.lua +++ b/xmake/modules/core/tools/c51.lua @@ -29,6 +29,23 @@ import("core.project.policy") function init(self) end +-- make the optimize flag +function nf_optimize(self, level) + local kind = self:kind() + print("kind", kind) + print("level", level) + if language.sourcekinds()[kind] then + local maps = { + fast = "OT(8,SPEED)" + , faster = "OT(9,SPEED)" + , fastest = "OT(10,SPEED)" + , smallest = "OT(10,SIZE)" + , aggressive = "OT(11,SPEED)" + } + return maps[level] + end +end + -- make the includedir flag function nf_includedirs(self, dirs) local paths = {} @@ -53,7 +70,7 @@ function compargv(self, sourcefile, objectfile, flags) end -- compile the source file -function compile(self, sourcefile, objectfile, dependinfo, flags) +function compile(self, sourcefile, objectfile, dependinfo, flags, opt) os.mkdir(path.directory(objectfile)) try -- cgit v1.3.1