import("core.project.project") 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)", api .. "_VAL", {public=false}) end end function is_static_f(kind) return kind == "static" or kind == "headeronly" or kind == "moduleonly" end function main(target) local name = target:name() local is_static = is_static_f(target:kind()) add_define(target, name, is_static) local deps = target:get("deps") if not deps then return end for _,dep in ipairs(deps) do local deptarget = project.target(dep) if is_static_f(deptarget:kind()) then add_define(target, dep, is_static) end end end