summaryrefslogtreecommitdiff
path: root/xmake/rules/objc++
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-04 13:01:11 +0800
committerruki <[email protected]>2020-04-04 13:04:06 +0800
commitdadee422f340ce6e96a7adbd64aa3941a2d31707 (patch)
tree899503fb7a2625eaaf12945259d809c3af684735 /xmake/rules/objc++
parentcc80eac1312bc54f4d6564f2a517a86aeccf5e8d (diff)
improve objc/objc++ build rules
Diffstat (limited to 'xmake/rules/objc++')
-rw-r--r--xmake/rules/objc++/xmake.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/xmake/rules/objc++/xmake.lua b/xmake/rules/objc++/xmake.lua
index 248745b86..61cb590bc 100644
--- a/xmake/rules/objc++/xmake.lua
+++ b/xmake/rules/objc++/xmake.lua
@@ -22,12 +22,32 @@
rule("objc.build")
set_sourcekinds("mm")
add_deps("c.build.pcheader")
+ after_load(function (target)
+ if target:values("objc.build.arc") ~= false then
+ target:add("mflags", "-fobjc-arc")
+ else
+ target:add("mflags", "-fno-objc-arc")
+ end
+ if is_plat("macosx", "iphoneos", "watchos") then
+ target:add("frameworks", "Foundation", "CoreFoundation")
+ end
+ end)
on_build_files("private.action.build.object", {batch = true})
-- define rule: objc++.build
rule("objc++.build")
set_sourcekinds("mxx")
add_deps("c++.build.pcheader")
+ after_load(function (target)
+ if target:values("objc++.build.arc") ~= false then
+ target:add("mxxflags", "-fobjc-arc")
+ else
+ target:add("mxxflags", "-fno-objc-arc")
+ end
+ if is_plat("macosx", "iphoneos", "watchos") then
+ target:add("frameworks", "Foundation", "CoreFoundation")
+ end
+ end)
on_build_files("private.action.build.object", {batch = true})
-- define rule: objc