From e1ede04e5e66b503ac010d837f8e0aa94f0a7709 Mon Sep 17 00:00:00 2001 From: as564335sa <809885126@qq.com> Date: Mon, 22 Aug 2022 13:15:34 +0800 Subject: fixed armasm macro definition option --- xmake/modules/core/tools/armasm.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua index 3ae578c55..8d982010d 100644 --- a/xmake/modules/core/tools/armasm.lua +++ b/xmake/modules/core/tools/armasm.lua @@ -101,7 +101,16 @@ end -- make the define flag function nf_define(self, macro) - return {"--pd", macro .. " SETA 1"} + local s = macro:replace(" ", "") + local def = s:split("=") + if def[1] == nil then + return {"--pd", macro .. " SETA 1"} + end + local value = 1 + if def[2] ~= nil and #def[2] > 0 then + value = def[2] + end + return {"--pd", def[1] .. " SETA " .. value} end -- make the includedir flag -- cgit v1.3.1 From a705771770c4d049b1273ee04b19a4ce4737e0fb Mon Sep 17 00:00:00 2001 From: as564335sa <809885126@qq.com> Date: Mon, 22 Aug 2022 14:12:15 +0800 Subject: add comments --- xmake/modules/core/tools/armasm.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua index 8d982010d..822d413f0 100644 --- a/xmake/modules/core/tools/armasm.lua +++ b/xmake/modules/core/tools/armasm.lua @@ -100,6 +100,9 @@ function nf_runtime(self, runtime) end -- make the define flag +-- eg. +-- add_defines("MACRO") -> --pd "MACRO SETA 1 +-- add_defines("MACRO=3") -> --pd "MACRO SETA 3" function nf_define(self, macro) local s = macro:replace(" ", "") local def = s:split("=") -- cgit v1.3.1 From b6b38e5ca97d5056e8f2b6941a8121d6c9c3a79f Mon Sep 17 00:00:00 2001 From: as564335sa <809885126@qq.com> Date: Mon, 22 Aug 2022 15:14:15 +0800 Subject: fix --- xmake/modules/core/tools/armasm.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua index 822d413f0..e9ec41acf 100644 --- a/xmake/modules/core/tools/armasm.lua +++ b/xmake/modules/core/tools/armasm.lua @@ -104,16 +104,13 @@ end -- add_defines("MACRO") -> --pd "MACRO SETA 1 -- add_defines("MACRO=3") -> --pd "MACRO SETA 3" function nf_define(self, macro) - local s = macro:replace(" ", "") - local def = s:split("=") - if def[1] == nil then - return {"--pd", macro .. " SETA 1"} - end + local def = macro:split("=") + local key = def[1]:trim() local value = 1 - if def[2] ~= nil and #def[2] > 0 then + if #def == 2 then value = def[2] end - return {"--pd", def[1] .. " SETA " .. value} + return {"--pd", key .. " SETA " .. value} end -- make the includedir flag -- cgit v1.3.1 From 95d016345759d9e839fdfabb40e19083fbabd52e Mon Sep 17 00:00:00 2001 From: as564335sa <809885126@qq.com> Date: Mon, 22 Aug 2022 16:04:05 +0800 Subject: fix --- xmake/modules/core/tools/armasm.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua index e9ec41acf..765cdcdb4 100644 --- a/xmake/modules/core/tools/armasm.lua +++ b/xmake/modules/core/tools/armasm.lua @@ -106,9 +106,9 @@ end function nf_define(self, macro) local def = macro:split("=") local key = def[1]:trim() - local value = 1 + local value = "1" if #def == 2 then - value = def[2] + value = def[2]:trim() end return {"--pd", key .. " SETA " .. value} end -- cgit v1.3.1