summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-28 07:39:00 +0800
committerruki <[email protected]>2022-05-28 07:39:00 +0800
commit79d42b329c0b075a154fc9009e0d4294a5caafbf (patch)
tree461ccebd4e2c725f20064614d07ef2e06698b0d4
parentd0a2d52633fcf5bc04ad6794ec287b3545d667bd (diff)
add packagedir
-rw-r--r--xmake/actions/package/local/main.lua21
-rw-r--r--xmake/actions/package/remote/main.lua7
-rw-r--r--xmake/core/project/target.lua12
3 files changed, 16 insertions, 24 deletions
diff --git a/xmake/actions/package/local/main.lua b/xmake/actions/package/local/main.lua
index 1a3a0a190..1a51e56f9 100644
--- a/xmake/actions/package/local/main.lua
+++ b/xmake/actions/package/local/main.lua
@@ -42,13 +42,8 @@ end
function _package_binary(target)
-- get the output directory
- local outputdir = option.get("outputdir") or config.buildir()
+ local packagedir = target:packagedir()
local packagename = target:name():lower()
- if #packagename > 1 and bit.band(packagename:byte(2), 0xc0) == 0x80 then
- wprint("package(%s): cannot generate package, becauese it contains unicode characters!", packagename)
- return
- end
- local packagedir = path.join(outputdir, "packages", packagename:sub(1, 1), packagename)
local binarydir = path.join(packagedir, target:plat(), target:arch(), config.mode(), "bin")
-- copy the binary file to the output directory
@@ -95,13 +90,8 @@ end
function _package_library(target)
-- get the output directory
- local outputdir = option.get("outputdir") or config.buildir()
+ local packagedir = target:packagedir()
local packagename = target:name():lower()
- if #packagename > 1 and bit.band(packagename:byte(2), 0xc0) == 0x80 then
- wprint("package(%s): cannot generate package, becauese it contains unicode characters!", packagename)
- return
- end
- local packagedir = path.join(outputdir, "packages", packagename:sub(1, 1), packagename)
local binarydir = path.join(packagedir, target:plat(), target:arch(), config.mode(), "bin")
local librarydir = path.join(packagedir, target:plat(), target:arch(), config.mode(), "lib")
local headerdir = path.join(packagedir, target:plat(), target:arch(), config.mode(), "include")
@@ -183,13 +173,8 @@ end
function _package_headeronly(target)
-- get the output directory
- local outputdir = option.get("outputdir") or config.buildir()
+ local packagedir = target:packagedir()
local packagename = target:name():lower()
- if #packagename > 1 and bit.band(packagename:byte(2), 0xc0) == 0x80 then
- wprint("package(%s): cannot generate package, becauese it contains unicode characters!", packagename)
- return
- end
- local packagedir = path.join(outputdir, "packages", packagename:sub(1, 1), packagename)
local headerdir = path.join(packagedir, target:plat(), target:arch(), config.mode(), "include")
-- copy headers
diff --git a/xmake/actions/package/remote/main.lua b/xmake/actions/package/remote/main.lua
index 9db86e8d5..dfe76bd6b 100644
--- a/xmake/actions/package/remote/main.lua
+++ b/xmake/actions/package/remote/main.lua
@@ -42,13 +42,8 @@ end
function _package_remote(target)
-- get the output directory
- local outputdir = option.get("outputdir") or config.buildir()
+ local packagedir = target:packagedir()
local packagename = target:name():lower()
- if #packagename > 1 and bit.band(packagename:byte(2), 0xc0) == 0x80 then
- wprint("package(%s): cannot generate package, becauese it contains unicode characters!", packagename)
- return
- end
- local packagedir = path.join(outputdir, "packages", packagename:sub(1, 1), packagename)
-- generate xmake.lua
local file = io.open(path.join(packagedir, "xmake.lua"), "w")
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 67e9cd08a..210a3d482 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1152,6 +1152,18 @@ function _instance:installdir()
return installdir
end
+-- get package directory
+function _instance:packagedir()
+ -- get the output directory
+ local outputdir = baseoption.get("outputdir") or config.buildir()
+ local packagename = self:name():lower()
+ if #packagename > 1 and bit.band(packagename:byte(2), 0xc0) == 0x80 then
+ utils.wprint("package(%s): cannot generate package, becauese it contains unicode characters!", packagename)
+ return
+ end
+ return path.join(outputdir, "packages", packagename:sub(1, 1), packagename)
+end
+
-- get rules of the source file
function _instance:filerules(sourcefile)