import("core.project.depend") function cmd_compile(target, genfile, file) import("find_sdk") print("find make_plugin", is_mode("debug")) local plugin = find_sdk.find_my_program("make_plugin") if not plugin then return end print("cmd_compile plugin", genfile, file) argv = { os.projectdir() , genfile, target:scriptdir(), file, target:name() .. ".plugin"} os.execv(plugin.program, argv) end function main(target, file) local sourcedir = path.join(target:autogendir({root = true}), target:plat()) if not os.isdir(sourcedir) then os.mkdir(sourcedir) end local genfile = path.join(sourcedir,"xmake.lua") local dependfile = target:dependfile(genfile) depend.on_changed( function() cmd_compile(target, genfile, file) end, {dependfile = dependfile, files = {path.join(target:scriptdir(), file)}} ) if os.exists(genfile) then local dependency = io.load(genfile) for k,v in ipairs(dependency) do target:add("deps", v[1], v[2]) end end end