summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-16 22:47:18 +0800
committerruki <[email protected]>2023-01-16 22:47:18 +0800
commit503e32aa9f2b40e3f5c3167e67d732c79ec26440 (patch)
tree46891ab47b1422fb15e66f110feb73d46b9aacea
parent525cc07aac1c9663f86078cb6c5af88576ede25b (diff)
fix check flags
-rw-r--r--xmake/core/tool/builder.lua6
-rw-r--r--xmake/modules/core/tools/c51.lua19
2 files changed, 24 insertions, 1 deletions
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