diff options
| author | SineStriker <[email protected]> | 2025-04-20 05:07:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-04-23 11:30:30 +0800 |
| commit | d57cceb19f58b99d5198cea0c32ec306ea22a9fb (patch) | |
| tree | 74f5b5cd3f707887b35fea49e6621dd1ee5b34d7 /xmake/modules/core | |
| parent | cef17b4c566a186ba8e9dd3dc52ab44901fed9f1 (diff) | |
Add `set_implibdir` to target APIs
Diffstat (limited to 'xmake/modules/core')
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 10 | ||||
| -rw-r--r-- | xmake/modules/core/tools/link.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/core/tools/nvcc.lua | 10 |
3 files changed, 16 insertions, 12 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 48e2ebe73..e59898efa 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -575,8 +575,8 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt) -- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc if targetkind == "shared" and self:is_plat("mingw") then - local implibdir = opt.implibdir or path.directory(targetfile) - table.insert(flags_extra, "-Wl,--out-implib," .. path.join(implibdir, path.basename(targetfile) .. ".dll.a")) + local implib = opt.implib or path.join(path.directory(targetfile), path.basename(targetfile) .. ".dll.a") + table.insert(flags_extra, "-Wl,--out-implib," .. implib) end -- init arguments @@ -595,11 +595,13 @@ end -- function link(self, objectfiles, targetkind, targetfile, flags, opt) opt = opt or {} + + -- ensure the target directory os.mkdir(path.directory(targetfile)) -- ensure the implib directory - if opt.implibdir then - os.mkdir(opt.implibdir) + if opt.implib then + os.mkdir(path.directory(opt.implib)) end local program, argv = linkargv(self, objectfiles, targetkind, targetfile, flags, opt) diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua index 7220b59c2..12bad4a0d 100644 --- a/xmake/modules/core/tools/link.lua +++ b/xmake/modules/core/tools/link.lua @@ -137,8 +137,8 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt) table.insert(argv, 1, "-lib") elseif targetkind == "shared" then table.insert(argv, 1, "-dll") - if opt.implibdir then - table.insert(argv, "/IMPLIB:" .. path.join(opt.implibdir, path.basename(targetfile) .. ".lib")) + if opt.implib then + table.insert(argv, "/IMPLIB:" .. opt.implib) end end return self:program(), argv @@ -151,8 +151,8 @@ function link(self, objectfiles, targetkind, targetfile, flags, opt) os.mkdir(path.directory(targetfile)) -- ensure the implib directory - if opt and opt.implibdir then - os.mkdir(opt.implibdir) + if opt and opt.implib then + os.mkdir(path.directory(opt.implib)) end try diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 58d614fbd..ec0e15874 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -288,9 +288,9 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt) -- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc if targetkind == "shared" and self:is_plat("mingw") then - local implibdir = opt.implibdir or path.directory(targetfile) + local implib = opt.implib or path.join(path.directory(targetfile), path.basename(targetfile) .. ".dll.a") table.insert(flags_extra, "-Xlinker") - table.insert(flags_extra, "-Wl,--out-implib," .. path.join(implibdir, path.basename(targetfile) .. ".dll.a")) + table.insert(flags_extra, "-Wl,--out-implib," .. implib) end -- make link args @@ -299,11 +299,13 @@ end -- link the target file function link(self, objectfiles, targetkind, targetfile, flags, opt) + + -- ensure the target directory os.mkdir(path.directory(targetfile)) -- ensure the implib directory - if opt and opt.implibdir then - os.mkdir(opt.implibdir) + if opt and opt.implib then + os.mkdir(path.directory(opt.implib)) end local program, argv = linkargv(self, objectfiles, targetkind, targetfile, flags, opt) |
