function add_define(target, name, is_static) local api = string.upper(name) .. "_API" if is_static then target:add("defines", api .. "=", api .. "_VAL", {public = false}) else target:add("defines", api.."=__declspec(dllimport)", {interface=true}) target:add("defines", api.."=__declspec(dllexport)", {public=false}) end end function main(target) local name = target:name() local is_static = target:kind() == "static" add_define(target, name, is_static) local deps = target:get("deps") if not deps then return end import("core.project.project") for _,dep in ipairs(deps) do local deptarget = project.target(dep) if deptarget:kind() == "static" then add_define(target, dep, is_static) end end end