summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-07-02 23:11:47 +0800
committerruki <[email protected]>2020-07-02 13:10:42 +0800
commitb131172723bd99c7df027e7244fc9d0cee8fffa8 (patch)
tree0e0896f56e9cc0bbc1776c595cf7e83951814032
parent632953a98bfc82aabcb7752b46ed4d90e4537d45 (diff)
fix targetdir
-rw-r--r--xmake/core/project/config.lua5
-rw-r--r--xmake/core/project/target.lua37
2 files changed, 22 insertions, 20 deletions
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index 90e4656a8..512222be8 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -125,10 +125,8 @@ end
-- get the buildir
function config.buildir()
- -- get it
- local buildir = config.get("buildir") or "build"
-
-- get the absolute path first
+ local buildir = config.get("buildir") or "build"
if not path.is_absolute(buildir) then
local rootdir
if os.isdir(path.join(os.workingdir(), ".xmake")) then
@@ -142,7 +140,6 @@ function config.buildir()
-- adjust path for the current directory
buildir = path.relative(buildir, os.curdir())
-
return buildir
end
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 302f7cff8..8f51c339e 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -875,25 +875,30 @@ end
-- get the target directory
function _instance:targetdir()
- -- the target directory or build directory
- local targetdir = self:get("targetdir") or config.buildir()
+ -- the target directory
+ local targetdir = self:get("targetdir")
+ if not targetdir then
- -- append plat sub-directory
- local plat = self:plat()
- if plat then
- targetdir = path.join(targetdir, plat)
- end
+ -- get build directory
+ targetdir = config.buildir()
- -- append arch sub-directory
- local arch = self:arch()
- if arch then
- targetdir = path.join(targetdir, arch)
- end
+ -- append plat sub-directory
+ local plat = self:plat()
+ if plat then
+ targetdir = path.join(targetdir, plat)
+ end
- -- append mode sub-directory
- local mode = config.get("mode")
- if mode then
- targetdir = path.join(targetdir, mode)
+ -- append arch sub-directory
+ local arch = self:arch()
+ if arch then
+ targetdir = path.join(targetdir, arch)
+ end
+
+ -- append mode sub-directory
+ local mode = config.get("mode")
+ if mode then
+ targetdir = path.join(targetdir, mode)
+ end
end
return targetdir
end