From bedb7222fdbbb3ce4aa201f3ef0cb24ebe6ad3d6 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 21 May 2021 22:41:43 +0800 Subject: add target:filename --- xmake/core/project/target.lua | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 4e1f2c5eb..af402c58f 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -986,26 +986,29 @@ function _instance:targetdir() return targetdir end --- get the target file -function _instance:targetfile() - - -- the target directory - local targetdir = self:targetdir() - - -- get target kind - local targetkind = self:kind() +-- get the target file name +function _instance:filename() -- only compile objects? no target file + local targetkind = self:kind() if targetkind == "object" then return end -- make the target file name and attempt to use the format of linker first - local filename = self:get("filename") or target.filename(self:basename(), targetkind, {plat = self:plat(), arch = self:arch(), format = self:linker():format(targetkind)}) - assert(filename) + local filename = self:get("filename") + if not filename then + filename = target.filename(self:basename(), targetkind, {plat = self:plat(), arch = self:arch(), format = self:linker():format(targetkind)}) + end + return filename +end - -- make the target file path - return path.join(targetdir, filename) +-- get the target file +function _instance:targetfile() + local filename = self:filename() + if filename then + return path.join(self:targetdir(), filename) + end end -- get the symbol file -- cgit v1.3.1