diff options
| author | ruki <[email protected]> | 2024-01-02 23:39:06 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-02 23:39:06 +0800 |
| commit | b5e1cb814c554f529372dc9c2127d64964eea013 (patch) | |
| tree | 74ae4de731ad8153cb98270aafb00f5a8d08dd69 | |
| parent | a43b2a25dd3d7ae1dd244695637277bf08ec2038 (diff) | |
| parent | 7295f8ff7f8b4df195f64155cd0ba2aa39793090 (diff) | |
Merge pull request #4557 from star-hengxing/dll
Support .def on mingw
| -rw-r--r-- | xmake/rules/platform/windows/def/xmake.lua | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/xmake/rules/platform/windows/def/xmake.lua b/xmake/rules/platform/windows/def/xmake.lua index 545d61fd1..8aaac52d6 100644 --- a/xmake/rules/platform/windows/def/xmake.lua +++ b/xmake/rules/platform/windows/def/xmake.lua @@ -21,17 +21,24 @@ -- add *.def for windows/dll rule("platform.windows.def") set_extensions(".def") - on_config("windows", function (target) + on_config("windows", "mingw", function (target) if not target:is_shared() then return end - if target:has_tool("sh", "link") then - local sourcebatch = target:sourcebatches()["platform.windows.def"] - if sourcebatch then - for _, sourcefile in ipairs(sourcebatch.sourcefiles) do - target:add("shflags", "/def:" .. path.translate(sourcefile), {force = true}) - break; + + if target:is_plat("windows") and (not target:has_tool("sh", "link")) then + return + end + + local sourcebatch = target:sourcebatches()["platform.windows.def"] + if sourcebatch then + for _, sourcefile in ipairs(sourcebatch.sourcefiles) do + local flag = path.translate(sourcefile) + if target:is_plat("windows") then + flag = "/def:" .. flag end + target:add("shflags", flag, {force = true}) + break; end end end) |
