improve libfile finding on mingw
-- imports
import("core.project.project")
--- get the builtin variables
-function _get_builtinvars(target, installdir)
+-- get the lib file of the target
+function _get_libfile(target, installdir)
local libfile = path.filename(target:targetfile())
if target:is_plat("windows") then
libfile = libfile:gsub("%.dll$", ".lib")
elseif target:is_plat("mingw") then
+ if os.isfile(path.join(installdir, "lib", libfile:gsub("%.dll$", ".dll.a"))) then
libfile = libfile:gsub("%.dll$", ".dll.a")
+ else
+ libfile = libfile:gsub("%.dll$", ".lib")
+ end
end
+ return libfile
+end
+
+-- get the builtin variables
+function _get_builtinvars(target, installdir)
return {TARGETNAME = target:name(),
PROJECTNAME = project.name() or target:name(),
- TARGETFILENAME = libfile,
+ TARGETFILENAME = _get_libfile(target, installdir),
TARGETKIND = target:is_shared() and "SHARED" or "STATIC",
PACKAGE_VERSION = target:get("version") or "1.0.0",
TARGET_PTRBYTES = target:is_arch("x86", "i386") and "4" or "8"}
