From d70a24d9daf8c829ad2c949076d6bc2e50676a86 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 5 Jun 2024 23:11:14 +0800 Subject: improve dmd linkargv #5192 --- xmake/modules/core/tools/dmd.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xmake/modules/core/tools/dmd.lua b/xmake/modules/core/tools/dmd.lua index 182c2ce04..4a14acfac 100644 --- a/xmake/modules/core/tools/dmd.lua +++ b/xmake/modules/core/tools/dmd.lua @@ -173,7 +173,8 @@ function nf_rpathdir(self, dir) end -- make the link arguments list -function linkargv(self, objectfiles, targetkind, targetfile, flags) +function linkargv(self, objectfiles, targetkind, targetfile, flags, opt) + opt = opt or {} -- add rpath for dylib (macho), e.g. -install_name @rpath/file.dylib local flags_extra = {} @@ -183,7 +184,11 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags) end -- init arguments - return self:program(), table.join(flags, flags_extra, "-of" .. targetfile, objectfiles) + local argv = table.join(flags, flags_extra, "-of" .. targetfile, objectfiles) + if is_host("windows") and not opt.rawargs then + argv = winos.cmdargv(argv, {escape = true}) + end + return self:program(), argv end -- link the target file -- cgit v1.3.1