summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-06-03 09:44:28 +0800
committerruki <[email protected]>2016-06-03 09:44:28 +0800
commite3e2def67c94826326a150859f45a6898fdfc405 (patch)
tree28163fae4f8fe1da8ee665465d15c1c003a01362
parentac478a1b8661b5470830743f6b495235747eed61 (diff)
add lipo for package macro
-rw-r--r--xmake/core/base/deprecated.lua6
-rwxr-xr-xxmake/plugins/lua/xmake.lua3
-rwxr-xr-xxmake/plugins/macro/macros/package.lua47
3 files changed, 53 insertions, 3 deletions
diff --git a/xmake/core/base/deprecated.lua b/xmake/core/base/deprecated.lua
index cb50c6fc6..43fe4755b 100644
--- a/xmake/core/base/deprecated.lua
+++ b/xmake/core/base/deprecated.lua
@@ -50,10 +50,14 @@ function deprecated.dump()
deprecated._ENTRIES = deprecated._ENTRIES or {}
-- dump all
- print("")
local index = 0
for old, new in pairs(deprecated._ENTRIES) do
+ -- trace newline
+ if index == 0 then
+ print("")
+ end
+
-- trace
utils.printf("deprecated: please uses %s instead of %s", new, old)
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua
index 519a06d1d..29eb91c0d 100755
--- a/xmake/plugins/lua/xmake.lua
+++ b/xmake/plugins/lua/xmake.lua
@@ -33,8 +33,8 @@ task("lua")
import("core.base.option")
-- list all scripts?
- print("scripts:")
if option.get("list") then
+ print("scripts:")
local files = os.match(path.join(os.scriptdir(), "scripts/*.lua"))
for _, file in ipairs(files) do
print(" " .. path.basename(file))
@@ -50,7 +50,6 @@ task("lua")
-- import script
import("scripts." .. name).main(option.get("arguments"))
-
end)
-- set menu
diff --git a/xmake/plugins/macro/macros/package.lua b/xmake/plugins/macro/macros/package.lua
index deb6e5c86..922a52b1f 100755
--- a/xmake/plugins/macro/macros/package.lua
+++ b/xmake/plugins/macro/macros/package.lua
@@ -21,6 +21,8 @@
--
-- imports
+import("core.project.config")
+import("core.project.project")
import("core.platform.platform")
-- package all
@@ -45,4 +47,49 @@ function main(argv)
os.exec("xmake f -p %s -a %s %s", plat, arch, args)
os.exec("xmake p")
end
+
+ -- package universal for iphoneos, watchos ...
+ if plat:startswith("iphone") or plat:startswith("watch") then
+
+ -- load configure
+ config.load()
+
+ -- load project
+ project.load()
+
+ -- the outputdir directory
+ local outputdir = config.get("buildir")
+
+ -- package all targets
+ for _, target in pairs(project.targets()) do
+
+ -- get all modes
+ local modedirs = os.match(format("%s/%s.pkg/lib/*", outputdir, target:name()), true)
+ for _, modedir in ipairs(modedirs) do
+
+ -- get mode
+ local mode = path.basename(modedir)
+
+ -- make lipo arguments
+ local lipoargs = nil
+ for _, arch in ipairs(platform.archs(plat)) do
+ local archfile = format("%s/%s.pkg/lib/%s/%s/%s/%s", outputdir, target:name(), mode, plat, arch, path.filename(target:targetfile()))
+ if os.isfile(archfile) then
+ lipoargs = format("%s -arch %s %s", lipoargs or "", arch, archfile)
+ end
+ end
+ if lipoargs then
+
+ -- make full lipo arguments
+ lipoargs = format("-create %s -output %s/%s.pkg/lib/%s/%s/universal/%s", lipoargs, outputdir, target:name(), mode, plat, path.filename(target:targetfile()))
+
+ -- make universal directory
+ os.mkdir(format("%s/%s.pkg/lib/%s/%s/universal", outputdir, target:name(), mode, plat))
+
+ -- package all archs
+ os.exec("xmake l lipo \" %s\"", lipoargs)
+ end
+ end
+ end
+ end
end