summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-05 14:46:14 +0800
committerruki <[email protected]>2020-04-05 14:46:14 +0800
commitd3c6cfe5fbaa95c72e4579ca884e3ddedd83e1fd (patch)
tree323782c80ff4782ce28315e585a01c33a411b942
parent79ff6aed24ebfda2ecd4628b2237b75a003e347a (diff)
add objc/framework template
-rw-r--r--tests/projects/objc/application/xmake.lua1
-rw-r--r--tests/projects/objc/bundle/xmake.lua1
-rw-r--r--tests/projects/objc/framework/xmake.lua1
-rw-r--r--xmake/modules/detect/tools/find_codesign.lua2
-rw-r--r--xmake/rules/xcode/application/xmake.lua2
-rw-r--r--xmake/templates/objc/framework/project/src/Info.plist24
-rw-r--r--xmake/templates/objc/framework/project/src/test.h3
-rw-r--r--xmake/templates/objc/framework/project/src/test.m6
-rw-r--r--xmake/templates/objc/framework/project/xmake.lua10
-rw-r--r--xmake/templates/objc/framework/template.lua2
10 files changed, 50 insertions, 2 deletions
diff --git a/tests/projects/objc/application/xmake.lua b/tests/projects/objc/application/xmake.lua
index 12f773a1d..c9a6c4b1c 100644
--- a/tests/projects/objc/application/xmake.lua
+++ b/tests/projects/objc/application/xmake.lua
@@ -4,3 +4,4 @@ target("test")
add_rules("xcode.application")
add_files("src/main.m")
add_installfiles("src/Info.plist")
+ --set_values("xcode.codesign_identity", "Apple Development: [email protected] (T3NA4MRVPU)")
diff --git a/tests/projects/objc/bundle/xmake.lua b/tests/projects/objc/bundle/xmake.lua
index f184201e5..a469eedc9 100644
--- a/tests/projects/objc/bundle/xmake.lua
+++ b/tests/projects/objc/bundle/xmake.lua
@@ -4,4 +4,5 @@ target("test")
add_rules("xcode.bundle")
add_files("src/test.m")
add_installfiles("src/Info.plist")
+ --set_values("xcode.codesign_identity", "Apple Development: [email protected] (T3NA4MRVPU)")
diff --git a/tests/projects/objc/framework/xmake.lua b/tests/projects/objc/framework/xmake.lua
index 530fa53f8..db5ad4044 100644
--- a/tests/projects/objc/framework/xmake.lua
+++ b/tests/projects/objc/framework/xmake.lua
@@ -5,6 +5,7 @@ target("test")
add_files("src/test.m")
add_headerfiles("src/*.h")
add_installfiles("src/Info.plist")
+ --set_values("xcode.codesign_identity", "Apple Development: [email protected] (T3NA4MRVPU)")
target("demo")
set_kind("binary")
diff --git a/xmake/modules/detect/tools/find_codesign.lua b/xmake/modules/detect/tools/find_codesign.lua
index 2dc5d0b75..54967ecda 100644
--- a/xmake/modules/detect/tools/find_codesign.lua
+++ b/xmake/modules/detect/tools/find_codesign.lua
@@ -45,7 +45,7 @@ function main(opt)
-- init options
opt = opt or {}
opt.check = function (program)
- os.execv(program, {"-d", "/bin/echo"})
+ os.runv(program, {"-d", "/bin/echo"})
end
-- find program
diff --git a/xmake/rules/xcode/application/xmake.lua b/xmake/rules/xcode/application/xmake.lua
index 2378775b3..0cd4ae2bd 100644
--- a/xmake/rules/xcode/application/xmake.lua
+++ b/xmake/rules/xcode/application/xmake.lua
@@ -18,7 +18,7 @@
-- @file xmake.lua
--
--- define rule: xcode application
+-- define rule: xcode application (TODO developing)
rule("xcode.application")
-- we must set kind before target.on_load(), may we will use target in on_load()
diff --git a/xmake/templates/objc/framework/project/src/Info.plist b/xmake/templates/objc/framework/project/src/Info.plist
new file mode 100644
index 000000000..20608314e
--- /dev/null
+++ b/xmake/templates/objc/framework/project/src/Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>$(CURRENT_PROJECT_VERSION)</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2020 tboox. All rights reserved.</string>
+</dict>
+</plist>
diff --git a/xmake/templates/objc/framework/project/src/test.h b/xmake/templates/objc/framework/project/src/test.h
new file mode 100644
index 000000000..d882546d1
--- /dev/null
+++ b/xmake/templates/objc/framework/project/src/test.h
@@ -0,0 +1,3 @@
+#import <Foundation/Foundation.h>
+
+FOUNDATION_EXPORT int add(int a, int b);
diff --git a/xmake/templates/objc/framework/project/src/test.m b/xmake/templates/objc/framework/project/src/test.m
new file mode 100644
index 000000000..84422f6a7
--- /dev/null
+++ b/xmake/templates/objc/framework/project/src/test.m
@@ -0,0 +1,6 @@
+#include "test.h"
+
+int add(int a, int b)
+{
+ return a + b;
+}
diff --git a/xmake/templates/objc/framework/project/xmake.lua b/xmake/templates/objc/framework/project/xmake.lua
new file mode 100644
index 000000000..3c52738aa
--- /dev/null
+++ b/xmake/templates/objc/framework/project/xmake.lua
@@ -0,0 +1,10 @@
+add_rules("mode.debug", "mode.release")
+
+target("${TARGETNAME}")
+ add_rules("xcode.framework")
+ add_files("src/*.m")
+ add_headerfiles("src/*.h")
+ add_installfiles("src/Info.plist")
+ --set_values("xcode.codesign_identity", "Apple Development: [email protected] (T3NA4MRVPU)")
+
+${FAQ}
diff --git a/xmake/templates/objc/framework/template.lua b/xmake/templates/objc/framework/template.lua
new file mode 100644
index 000000000..aad04ec61
--- /dev/null
+++ b/xmake/templates/objc/framework/template.lua
@@ -0,0 +1,2 @@
+template("framework")
+ add_configfiles("xmake.lua")