Skip to content

Commit

Permalink
[CI] Add a step in CI to ensure darwin-framework-tool can be built on…
Browse files Browse the repository at this point in the history
… iOS. (#36062)

* [darwin-framework-tool] Add a step in CI to ensure darwin-framework-tool can be built on iOS

* [darwin-framework-tool] Build fixes
  • Loading branch information
vivien-apple authored Oct 14, 2024
1 parent 0474070 commit 650e69b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/darwin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ jobs:
platform: darwin
bootstrap-log-name: bootstrap-logs-darwin-${{ matrix.build_variant }}

- name: Build iOS Darwin Framework Tool Build Debug
working-directory: src/darwin/Framework
run: xcodebuild -target "darwin-framework-tool" -sdk iphoneos -configuration Debug AD_HOC_CODE_SIGNING_ALLOWED=YES

- name: Run macOS Darwin Framework Tool Build Debug
working-directory: src/darwin/Framework
run: xcodebuild -target "darwin-framework-tool" -sdk macosx -configuration Debug
Expand Down
5 changes: 5 additions & 0 deletions examples/darwin-framework-tool/commands/memory/LeaksTool.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ @implementation LeaksTool

- (BOOL)runWithArguments:(NSArray<NSString *> * _Nullable)arguments
{
#if TARGET_OS_OSX
pid_t pid = getpid();
__auto_type * pidString = [NSString stringWithFormat:@"%d", pid];

Expand Down Expand Up @@ -59,6 +60,10 @@ - (BOOL)runWithArguments:(NSArray<NSString *> * _Nullable)arguments
NSLog(@"%@", output);

return YES;
#else
NSLog(@"Running leaks as a task is supported on this platform.");
return NO;
#endif // TARGET_OS_OSX
}

@end
Expand Down
4 changes: 4 additions & 0 deletions examples/darwin-framework-tool/debug/LeakChecker.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ @implementation LeakChecker

- (BOOL)hasMemoryLeaks
{
#if TARGET_OS_OSX
pid_t pid = getpid();
auto * pidString = [NSString stringWithFormat:@"%d", pid];

Expand All @@ -51,6 +52,9 @@ - (BOOL)hasMemoryLeaks
NSLog(@"%@", output);
return YES;
}
#else
NSLog(@"Running leaks as a task is supported on this platform.");
#endif // TARGET_OS_OSX

return NO;
}
Expand Down
10 changes: 10 additions & 0 deletions src/darwin/Framework/Matter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2242,7 +2242,12 @@
"$(CONFIGURATION_TEMP_DIR)/Matter.build/out/obj/src/app/lib",
);
OTHER_CFLAGS = "-DLWS_PLAT_UNIX";
"OTHER_CFLAGS[sdk=iphoneos*]" = (
"-DLWS_PLAT_UNIX",
"-DLWS_DETECTED_PLAT_IOS",
);
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
Expand Down Expand Up @@ -2315,7 +2320,12 @@
"$(CONFIGURATION_TEMP_DIR)/Matter.build/out/obj/src/app/lib",
);
OTHER_CFLAGS = "-DLWS_PLAT_UNIX";
"OTHER_CFLAGS[sdk=iphoneos*]" = (
"-DLWS_PLAT_UNIX",
"-DLWS_DETECTED_PLAT_IOS",
);
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
Expand Down
4 changes: 4 additions & 0 deletions third_party/libwebsockets/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ source_set("libwebsockets") {
]

cflags = [ "-DLWS_PLAT_UNIX" ]

if (target_os == "ios") {
cflags += [ "-DLWS_DETECTED_PLAT_IOS" ]
}
}

public_configs = [ ":libwebsockets_config" ]
Expand Down

0 comments on commit 650e69b

Please sign in to comment.