From 8482d2e658cbac1720f500eb3cc37ce9491301eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=B8=A1=E5=BF=AB=E8=B7=91?= <2283572185@qq.com> Date: Mon, 30 Sep 2024 18:58:34 +0800 Subject: [PATCH] refactor(rules/iverilog): Use target:get_from to get defines --- xmake/rules/iverilog/xmake.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/xmake/rules/iverilog/xmake.lua b/xmake/rules/iverilog/xmake.lua index b538f782be..ec5e0257ee 100644 --- a/xmake/rules/iverilog/xmake.lua +++ b/xmake/rules/iverilog/xmake.lua @@ -82,16 +82,8 @@ rule("iverilog.binary") end -- get defines - local add_defines = function(defines) - for _, define in ipairs(defines or {}) do - table.insert(argv, "-D" .. define) - end - end - add_defines(target:get("defines")) - -- support add_defines in options - for _, option_name in ipairs(target:get("options") or {}) do - local option = project.option(option_name) - add_defines(option:enabled() and option:get("defines")) + for _, define in ipairs(target:get_from("defines", "*") or {}) do + table.insert(argv, "-D" .. define) end -- get includedirs