From 6a67eb4ca0b1b8f375b0aa190fb85bca8477b595 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 5 Apr 2020 22:42:54 +0800 Subject: update macapp tests --- tests/projects/objc/macapp/src/AppDelegate.h | 15 + tests/projects/objc/macapp/src/AppDelegate.m | 27 + .../AppIcon.appiconset/Contents.json | 58 ++ .../objc/macapp/src/Assets.xcassets/Contents.json | 6 + .../objc/macapp/src/Base.lproj/Main.storyboard | 717 +++++++++++++++++++++ tests/projects/objc/macapp/src/ViewController.h | 15 + tests/projects/objc/macapp/src/ViewController.m | 27 + tests/projects/objc/macapp/src/main.m | 20 +- tests/projects/objc/macapp/src/test.entitlements | 10 + tests/projects/objc/macapp/xmake.lua | 2 +- xmake/rules/xcode/application/xmake.lua | 7 + 11 files changed, 896 insertions(+), 8 deletions(-) create mode 100644 tests/projects/objc/macapp/src/AppDelegate.h create mode 100644 tests/projects/objc/macapp/src/AppDelegate.m create mode 100644 tests/projects/objc/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 tests/projects/objc/macapp/src/Assets.xcassets/Contents.json create mode 100644 tests/projects/objc/macapp/src/Base.lproj/Main.storyboard create mode 100644 tests/projects/objc/macapp/src/ViewController.h create mode 100644 tests/projects/objc/macapp/src/ViewController.m create mode 100644 tests/projects/objc/macapp/src/test.entitlements diff --git a/tests/projects/objc/macapp/src/AppDelegate.h b/tests/projects/objc/macapp/src/AppDelegate.h new file mode 100644 index 000000000..5f5ba059e --- /dev/null +++ b/tests/projects/objc/macapp/src/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// test3 +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import + +@interface AppDelegate : NSObject + + +@end + diff --git a/tests/projects/objc/macapp/src/AppDelegate.m b/tests/projects/objc/macapp/src/AppDelegate.m new file mode 100644 index 000000000..da967d2ef --- /dev/null +++ b/tests/projects/objc/macapp/src/AppDelegate.m @@ -0,0 +1,27 @@ +// +// AppDelegate.m +// test3 +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + + +@end diff --git a/tests/projects/objc/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json b/tests/projects/objc/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..2db2b1c7c --- /dev/null +++ b/tests/projects/objc/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/tests/projects/objc/macapp/src/Assets.xcassets/Contents.json b/tests/projects/objc/macapp/src/Assets.xcassets/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/tests/projects/objc/macapp/src/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/tests/projects/objc/macapp/src/Base.lproj/Main.storyboard b/tests/projects/objc/macapp/src/Base.lproj/Main.storyboard new file mode 100644 index 000000000..7a6d659a5 --- /dev/null +++ b/tests/projects/objc/macapp/src/Base.lproj/Main.storyboard @@ -0,0 +1,717 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/projects/objc/macapp/src/ViewController.h b/tests/projects/objc/macapp/src/ViewController.h new file mode 100644 index 000000000..a974fc934 --- /dev/null +++ b/tests/projects/objc/macapp/src/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// test3 +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import + +@interface ViewController : NSViewController + + +@end + diff --git a/tests/projects/objc/macapp/src/ViewController.m b/tests/projects/objc/macapp/src/ViewController.m new file mode 100644 index 000000000..bccdf6189 --- /dev/null +++ b/tests/projects/objc/macapp/src/ViewController.m @@ -0,0 +1,27 @@ +// +// ViewController.m +// test3 +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import "ViewController.h" + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Do any additional setup after loading the view. +} + + +- (void)setRepresentedObject:(id)representedObject { + [super setRepresentedObject:representedObject]; + + // Update the view, if already loaded. +} + + +@end diff --git a/tests/projects/objc/macapp/src/main.m b/tests/projects/objc/macapp/src/main.m index 47ac6bdc2..ae3706f51 100644 --- a/tests/projects/objc/macapp/src/main.m +++ b/tests/projects/objc/macapp/src/main.m @@ -1,10 +1,16 @@ -#import +// +// main.m +// test3 +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// -int main(int argc, char** argv) -{ - @autoreleasepool - { - NSLog(@"hello xmake!"); +#import + +int main(int argc, const char * argv[]) { + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. } - return 0; + return NSApplicationMain(argc, argv); } diff --git a/tests/projects/objc/macapp/src/test.entitlements b/tests/projects/objc/macapp/src/test.entitlements new file mode 100644 index 000000000..f2ef3ae02 --- /dev/null +++ b/tests/projects/objc/macapp/src/test.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/tests/projects/objc/macapp/xmake.lua b/tests/projects/objc/macapp/xmake.lua index 12f773a1d..bf1b1fef8 100644 --- a/tests/projects/objc/macapp/xmake.lua +++ b/tests/projects/objc/macapp/xmake.lua @@ -2,5 +2,5 @@ add_rules("mode.debug", "mode.release") target("test") add_rules("xcode.application") - add_files("src/main.m") + add_files("src/*.m") add_installfiles("src/Info.plist") diff --git a/xmake/rules/xcode/application/xmake.lua b/xmake/rules/xcode/application/xmake.lua index 724018da2..781ece19f 100644 --- a/xmake/rules/xcode/application/xmake.lua +++ b/xmake/rules/xcode/application/xmake.lua @@ -38,6 +38,13 @@ rule("xcode.application") target:set("targetdir", appdir) end + -- add frameworks + if is_plat("macosx") then + target:add("frameworks", "AppKit") + else + target:add("frameworks", "UIKit") + end + -- register clean files for `xmake clean` target:add("cleanfiles", appdir) end) -- cgit v1.3.1