summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstar9029 <[email protected]>2024-01-01 23:42:36 +0800
committerstar9029 <[email protected]>2024-01-01 23:42:36 +0800
commit7295f8ff7f8b4df195f64155cd0ba2aa39793090 (patch)
treefe233d81f150905a1482686be1144175060d3606
parent21729b8a9abd072d992e2cb1d046ea0c50534673 (diff)
improve xmake.lua
-rw-r--r--xmake/rules/platform/windows/def/xmake.lua26
1 files changed, 12 insertions, 14 deletions
diff --git a/xmake/rules/platform/windows/def/xmake.lua b/xmake/rules/platform/windows/def/xmake.lua
index 3ff6415ed..8aaac52d6 100644
--- a/xmake/rules/platform/windows/def/xmake.lua
+++ b/xmake/rules/platform/windows/def/xmake.lua
@@ -26,21 +26,19 @@ rule("platform.windows.def")
return
end
- if target:is_plat("windows") and 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;
- end
- end
- elseif target:is_plat("mingw") then
- local sourcebatch = target:sourcebatches()["platform.windows.def"]
- if sourcebatch then
- for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- target:add("shflags", 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)