summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-23 23:46:07 +0800
committerruki <[email protected]>2020-04-23 16:36:46 +0800
commit18cc36cae0dd5938574fe395a5d0745a39c5685c (patch)
tree59d99f1d12fdce147ed14fa8823b5d2c1a0137e8
parent976084c2a96e63e481cf101ba2013130a6ff44b3 (diff)
improve xcode.xxx rules
-rw-r--r--xmake/rules/xcode/application/build.lua8
-rw-r--r--xmake/rules/xcode/application/load.lua5
-rw-r--r--xmake/rules/xcode/bundle/xmake.lua9
3 files changed, 16 insertions, 6 deletions
diff --git a/xmake/rules/xcode/application/build.lua b/xmake/rules/xcode/application/build.lua
index 3ff16dcb0..6c5b69e9d 100644
--- a/xmake/rules/xcode/application/build.lua
+++ b/xmake/rules/xcode/application/build.lua
@@ -29,6 +29,7 @@ function main (target, opt)
-- get app and resources directory
local bundledir = path.absolute(target:data("xcode.bundle.rootdir"))
+ local contentsdir = path.absolute(target:data("xcode.bundle.contentsdir"))
local resourcesdir = path.absolute(target:data("xcode.bundle.resourcesdir"))
-- need re-compile it?
@@ -46,6 +47,13 @@ function main (target, opt)
cprint("${color.build.target}generating.xcode.$(mode) %s", path.filename(bundledir))
end
+ -- copy target file
+ if is_plat("macosx") then
+ os.vcp(target:targetfile(), path.join(contentsdir, "MacOS", path.filename(target:targetfile())))
+ else
+ os.vcp(target:targetfile(), path.join(contentsdir, path.filename(target:targetfile())))
+ end
+
-- copy PkgInfo to the contents directory
os.cp(path.join(os.programdir(), "scripts", "PkgInfo"), resourcesdir)
diff --git a/xmake/rules/xcode/application/load.lua b/xmake/rules/xcode/application/load.lua
index ddac69126..b98c4e257 100644
--- a/xmake/rules/xcode/application/load.lua
+++ b/xmake/rules/xcode/application/load.lua
@@ -39,11 +39,6 @@ function main (target)
-- set target directory for app
target:set("kind", "binary")
target:set("filename", target:basename())
- if is_plat("macosx") then
- target:set("targetdir", path.join(contentsdir, "MacOS"))
- else
- target:set("targetdir", bundledir)
- end
-- set install directory
if is_plat("macosx") and not target:get("installdir") then
diff --git a/xmake/rules/xcode/bundle/xmake.lua b/xmake/rules/xcode/bundle/xmake.lua
index 709feb51d..3fc54c783 100644
--- a/xmake/rules/xcode/bundle/xmake.lua
+++ b/xmake/rules/xcode/bundle/xmake.lua
@@ -44,7 +44,6 @@ rule("xcode.bundle")
-- set target info for bundle
target:set("filename", target:basename())
- target:set("targetdir", path.join(contentsdir, "MacOS"))
-- generate binary as bundle, we cannot set `-shared` or `-dynamiclib`
target:set("kind", "binary")
@@ -64,6 +63,7 @@ rule("xcode.bundle")
-- get bundle and resources directory
local bundledir = path.absolute(target:data("xcode.bundle.rootdir"))
+ local contentsdir = path.absolute(target:data("xcode.bundle.contentsdir"))
local resourcesdir = path.absolute(target:data("xcode.bundle.resourcesdir"))
-- need re-generate it?
@@ -81,6 +81,13 @@ rule("xcode.bundle")
cprint("${color.build.target}generating.xcode.$(mode) %s", path.filename(bundledir))
end
+ -- copy target file
+ if is_plat("macosx") then
+ os.vcp(target:targetfile(), path.join(contentsdir, "MacOS", path.filename(target:targetfile())))
+ else
+ os.vcp(target:targetfile(), path.join(contentsdir, path.filename(target:targetfile())))
+ end
+
-- copy resource files
local srcfiles, dstfiles = target:installfiles(resourcesdir)
if srcfiles and dstfiles then