summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-21 22:41:43 +0800
committerruki <[email protected]>2021-05-21 22:41:43 +0800
commitbedb7222fdbbb3ce4aa201f3ef0cb24ebe6ad3d6 (patch)
tree20f850dc47b96447b9410b6c281d66f9da69f033
parent5e70495c695cea990d07e3471e1c0a65de788a93 (diff)
add target:filename
-rw-r--r--xmake/core/project/target.lua27
1 files 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