summaryrefslogtreecommitdiff
path: root/xmake/modules/core
diff options
context:
space:
mode:
authorruki <[email protected]>2017-11-16 22:57:11 +0800
committerruki <[email protected]>2017-11-16 11:43:11 +0800
commit90d3eb8fbd05ffa02df5df18d2f7b6b6c5d7ae87 (patch)
tree77ec0085757430f1b79c6f9b4ec71119d788d087 /xmake/modules/core
parentb8e726a61ac0fef93528175dd360fb3844e8dfbe (diff)
improve to build share library on mingw
Diffstat (limited to 'xmake/modules/core')
-rw-r--r--xmake/modules/core/tools/gcc.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 649a2e48f..205921400 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -280,11 +280,19 @@ end
function linkargv(self, objectfiles, targetkind, targetfile, flags)
-- add rpath for dylib (macho), .e.g -install_name @rpath/file.dylib
- local flags_rpath = nil
+ local flags_extra = {}
if targetkind == "shared" and targetfile:endswith(".dylib") then
- flags_rpath = {"-install_name", "@rpath/" .. path.filename(targetfile)}
+ table.insert(flags_extra, "-install_name")
+ table.insert(flags_extra, "@rpath/" .. path.filename(targetfile))
end
- return self:program(), table.join("-o", targetfile, objectfiles, flags, flags_rpath)
+
+ -- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc
+ if targetkind == "shared" and config.plat() == "mingw" then
+ table.insert(flags_extra, "-Wl,--out-implib," .. os.args(path.join(path.directory(targetfile), path.basename(targetfile) .. ".a")))
+ end
+
+ -- make link args
+ return self:program(), table.join("-o", targetfile, objectfiles, flags, flags_extra)
end
-- link the target file