| author | |
| committer | |
| log | beef9fdf42726d8cfe3017ff3017767fb615ef08 |
| tree | fe5362aba6974cb9a878740172c9fd688543b5ef |
| parent | f9ebe0daa2aacb582ca94c1970ec02cc8c39fd75 |
relied on setting sysroot in configure phase
let's examine this use case more carefully next time before reinstating
this test.3 files changed, 0 insertions(+), 77 deletions(-)
test/standalone/build.zig.zon-3| ... | ... | @@ -153,9 +153,6 @@ |
| 153 | 153 | .compiler_rt_panic = .{ |
| 154 | 154 | .path = "compiler_rt_panic", |
| 155 | 155 | }, |
| 156 | .ios = .{ | |
| 157 | .path = "ios", | |
| 158 | }, | |
| 159 | 156 | .depend_on_main_mod = .{ |
| 160 | 157 | .path = "depend_on_main_mod", |
| 161 | 158 | }, |
test/standalone/ios/build.zig deleted-40| ... | ... | @@ -1,40 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | pub const requires_symlinks = true; | |
| 4 | pub const requires_ios_sdk = true; | |
| 5 | ||
| 6 | pub fn build(b: *std.Build) void { | |
| 7 | const test_step = b.step("test", "Test it"); | |
| 8 | b.default_step = test_step; | |
| 9 | ||
| 10 | const optimize: std.builtin.OptimizeMode = .Debug; | |
| 11 | const target = b.resolveTargetQuery(.{ | |
| 12 | .cpu_arch = .aarch64, | |
| 13 | .os_tag = .ios, | |
| 14 | }); | |
| 15 | ||
| 16 | const exe = b.addExecutable(.{ | |
| 17 | .name = "main", | |
| 18 | .root_module = b.createModule(.{ | |
| 19 | .root_source_file = null, | |
| 20 | .optimize = optimize, | |
| 21 | .target = target, | |
| 22 | .link_libc = true, | |
| 23 | }), | |
| 24 | }); | |
| 25 | ||
| 26 | const io = b.graph.io; | |
| 27 | ||
| 28 | if (std.zig.system.darwin.getSdk(b.allocator, io, &target.result)) |sdk| { | |
| 29 | b.sysroot = sdk; | |
| 30 | exe.root_module.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) }); | |
| 31 | exe.root_module.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) }); | |
| 32 | exe.root_module.addLibraryPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/lib" }) }); | |
| 33 | } else { | |
| 34 | exe.step.dependOn(&b.addFail("no iOS SDK found").step); | |
| 35 | } | |
| 36 | ||
| 37 | exe.root_module.addCSourceFile(.{ .file = b.path("main.m"), .flags = &.{} }); | |
| 38 | exe.root_module.linkFramework("Foundation", .{}); | |
| 39 | exe.root_module.linkFramework("UIKit", .{}); | |
| 40 | } |
test/standalone/ios/main.m deleted-34| ... | ... | @@ -1,34 +0,0 @@ |
| 1 | #import <UIKit/UIKit.h> | |
| 2 | ||
| 3 | @interface AppDelegate : UIResponder <UIApplicationDelegate> | |
| 4 | @property (strong, nonatomic) UIWindow *window; | |
| 5 | @end | |
| 6 | ||
| 7 | int main() { | |
| 8 | @autoreleasepool { | |
| 9 | return UIApplicationMain(0, nil, nil, NSStringFromClass([AppDelegate class])); | |
| 10 | } | |
| 11 | } | |
| 12 | ||
| 13 | @implementation AppDelegate | |
| 14 | ||
| 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(id)options { | |
| 16 | CGRect mainScreenBounds = [[UIScreen mainScreen] bounds]; | |
| 17 | self.window = [[UIWindow alloc] initWithFrame:mainScreenBounds]; | |
| 18 | UIViewController *viewController = [[UIViewController alloc] init]; | |
| 19 | viewController.view.frame = mainScreenBounds; | |
| 20 | ||
| 21 | NSString* msg = @"Hello world"; | |
| 22 | ||
| 23 | UILabel *label = [[UILabel alloc] initWithFrame:mainScreenBounds]; | |
| 24 | [label setText:msg]; | |
| 25 | [viewController.view addSubview: label]; | |
| 26 | ||
| 27 | self.window.rootViewController = viewController; | |
| 28 | ||
| 29 | [self.window makeKeyAndVisible]; | |
| 30 | ||
| 31 | return YES; | |
| 32 | } | |
| 33 | ||
| 34 | @end |