From d3c6cfe5fbaa95c72e4579ca884e3ddedd83e1fd Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 5 Apr 2020 14:46:14 +0800 Subject: add objc/framework template --- tests/projects/objc/application/xmake.lua | 1 + tests/projects/objc/bundle/xmake.lua | 1 + tests/projects/objc/framework/xmake.lua | 1 + xmake/modules/detect/tools/find_codesign.lua | 2 +- xmake/rules/xcode/application/xmake.lua | 2 +- .../objc/framework/project/src/Info.plist | 24 ++++++++++++++++++++++ xmake/templates/objc/framework/project/src/test.h | 3 +++ xmake/templates/objc/framework/project/src/test.m | 6 ++++++ xmake/templates/objc/framework/project/xmake.lua | 10 +++++++++ xmake/templates/objc/framework/template.lua | 2 ++ 10 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 xmake/templates/objc/framework/project/src/Info.plist create mode 100644 xmake/templates/objc/framework/project/src/test.h create mode 100644 xmake/templates/objc/framework/project/src/test.m create mode 100644 xmake/templates/objc/framework/project/xmake.lua create mode 100644 xmake/templates/objc/framework/template.lua 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: xxx@gmail.com (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: xxx@gmail.com (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: xxx@gmail.com (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 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright + Copyright © 2020 tboox. All rights reserved. + + 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_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: xxx@gmail.com (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") -- cgit v1.3.1