From ab9c894df1fa591a591e68e0bd5ab69b136daa78 Mon Sep 17 00:00:00 2001 From: Guyutongxue Date: Wed, 29 Nov 2023 11:20:38 +0800 Subject: Fix #4439 --- xmake/rules/asn1c/xmake.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xmake/rules/asn1c/xmake.lua b/xmake/rules/asn1c/xmake.lua index cc1c60dd0..d4d4dba1d 100644 --- a/xmake/rules/asn1c/xmake.lua +++ b/xmake/rules/asn1c/xmake.lua @@ -32,6 +32,12 @@ rule("asn1c") batchcmds:mkdir(sourcefile_dir) batchcmds:vrunv(asn1c.program, {path(sourcefile_asn1):absolute()}, {curdir = sourcefile_dir}) + -- add includedirs + target:add("includedirs", sourcefile_dir) + end) + on_buildcmd_file(function (target, batchcmds, sourcefile_asn1, opt) + local sourcefile_dir = path.join(target:autogendir(), "rules", "asn1c") + -- compile *.c for _, sourcefile in ipairs(os.files(path.join(sourcefile_dir, "*.c|converter-*.c"))) do local objectfile = target:objectfile(sourcefile) @@ -39,9 +45,6 @@ rule("asn1c") table.insert(target:objectfiles(), objectfile) end - -- add includedirs - target:add("includedirs", sourcefile_dir) - -- add deps batchcmds:add_depfiles(sourcefile_asn1) batchcmds:set_depcache(target:dependfile(sourcefile_asn1)) -- cgit v1.3.1