-
Couldn't load subscription status.
- Fork 5.2k
[iOS] Remove cmake build dependency for library mode #89869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0b3bc33
[Android] Add NdkToolFinder task
0b80740
Feedback
c24527e
Ws issue
86a49ae
Merge remote-tracking branch 'upstream/main' into add-ndk-mobile-buil…
dfae990
cmake-less android library build first pass
53aa40f
Change Android library mode to use the native toolchain as opposed to…
12a8d43
Merge remote-tracking branch 'upstream/main' into cmake-less-libbuild
21ee15c
Fix conflict
59dc916
Remove xml descriptor reference
564ebbd
Merge remote-tracking branch 'upstream/main' into cmake-less-libbuild
9b5dd00
Fix incorrect arm triple
9e0fb8f
[iOS] Remove cmake build dependency for library mode
cda91c6
Merge remote-tracking branch 'upstream/main' into ios-cmake-less-libb…
450d891
Revert android fun test addition
0e21af6
Fix missing prototype error on the aot functional tests
41a6af1
Feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/tasks/AppleAppBuilder/Templates/CMakeLists-librarymode.txt.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| cmake_minimum_required(VERSION 3.16) | ||
|
|
||
| project(%ProjectName%) | ||
| enable_language(OBJC ASM) | ||
|
|
||
| set(APP_RESOURCES | ||
| %AppResources% | ||
| lib%ProjectName%.dylib | ||
| ) | ||
|
|
||
| add_executable( | ||
| %ProjectName% | ||
| %MainSource% | ||
| ${APP_RESOURCES} | ||
| ) | ||
|
|
||
| if(NOT %UseNativeAOTRuntime%) | ||
| target_sources( | ||
| %ProjectName% | ||
| PRIVATE | ||
| runtime.m) | ||
| endif() | ||
|
|
||
| %Defines% | ||
|
|
||
| if(NOT %UseNativeAOTRuntime%) | ||
| include_directories("%MonoInclude%") | ||
| endif() | ||
|
|
||
| #set_target_properties(%ProjectName% %AotTargetsList% PROPERTIES | ||
| # XCODE_ATTRIBUTE_SUPPORTS_MACCATALYST "YES" | ||
| #) | ||
|
|
||
| set_target_properties(%ProjectName% PROPERTIES | ||
| MACOSX_BUNDLE TRUE | ||
| MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist | ||
| XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" | ||
| XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING "NO" | ||
| XCODE_EMIT_EFFECTIVE_PLATFORM_NAME "YES" | ||
| XCODE_EMBED_FRAMEWORKS "%DYLIB_PATH%" | ||
| XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks" | ||
| RESOURCE "${APP_RESOURCES}" | ||
| ) | ||
|
|
||
| set(HARDENED_RUNTIME | ||
| %HardenedRuntime% | ||
| ) | ||
|
|
||
| set(HARDENED_RUNTIME_USE_ENTITLEMENTS_FILE | ||
| %HardenedRuntimeUseEntitlementsFile% | ||
| ) | ||
|
|
||
| if("${HARDENED_RUNTIME}") | ||
| set_target_properties(%ProjectName% PROPERTIES XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES") | ||
| if("${HARDENED_RUNTIME_USE_ENTITLEMENTS_FILE}") | ||
| set_target_properties(%ProjectName% PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "app.entitlements") | ||
| add_custom_command( | ||
| TARGET %ProjectName% POST_BUILD | ||
| COMMAND if test \"$CODE_SIGN_IDENTITY\"\; then codesign -fs \"$CODE_SIGN_IDENTITY\" $CODESIGNING_FOLDER_PATH/Contents/Resources/*.dylib\; fi | ||
| ) | ||
| endif() | ||
| endif() | ||
|
|
||
| # FIXME: `XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING` should not be NO | ||
|
|
||
| target_link_libraries( | ||
| %ProjectName% | ||
| PRIVATE | ||
| "-framework Foundation" | ||
| "-framework Security" | ||
| "-framework UIKit" | ||
| "-lz" | ||
| "-lc++" | ||
| "-liconv" | ||
| %NativeLibrariesToLink% | ||
| %APP_LINK_LIBRARIES% | ||
| ) | ||
|
|
||
| set_target_properties( | ||
| %ProjectName% | ||
| PROPERTIES LINK_FLAGS | ||
| %EXTRA_LINKER_ARGS% | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
| #include <mono/utils/mono-publib.h> | ||
| #include <mono/utils/mono-logger.h> | ||
| #include <mono/metadata/assembly.h> | ||
| #include <mono/metadata/appdomain.h> | ||
| #include <mono/metadata/class.h> | ||
| #include <mono/metadata/mono-debug.h> | ||
| #include <mono/metadata/mono-gc.h> | ||
| #include <mono/metadata/exception.h> | ||
| #include <mono/metadata/object.h> | ||
| #include <mono/jit/jit.h> | ||
| #include <mono/jit/mono-private-unstable.h> | ||
| #include <TargetConditionals.h> | ||
| #import <os/log.h> | ||
| #include <sys/stat.h> | ||
| #include <sys/mman.h> | ||
| #include <stdlib.h> | ||
| #include <stdio.h> | ||
|
|
||
| #import "util.h" | ||
|
|
||
| static char *bundle_path; | ||
|
|
||
| int SayHello (void); | ||
|
|
||
| int invoke_netlibrary_entrypoints (void) | ||
| { | ||
| return SayHello (); | ||
| } | ||
|
|
||
| const char * | ||
| get_bundle_path (void) | ||
| { | ||
| if (bundle_path) | ||
| return bundle_path; | ||
| NSBundle* main_bundle = [NSBundle mainBundle]; | ||
| NSString* path = [main_bundle bundlePath]; | ||
|
|
||
| #if TARGET_OS_MACCATALYST | ||
| path = [path stringByAppendingString:@"/Contents/Resources"]; | ||
| #endif | ||
|
|
||
| bundle_path = strdup ([path UTF8String]); | ||
|
|
||
| return bundle_path; | ||
| } | ||
|
|
||
| void | ||
| mono_ios_runtime_init (void) | ||
| { | ||
| #if INVARIANT_GLOBALIZATION | ||
| setenv ("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1", TRUE); | ||
| #endif | ||
|
|
||
| #if HYBRID_GLOBALIZATION | ||
| setenv ("DOTNET_SYSTEM_GLOBALIZATION_HYBRID", "1", TRUE); | ||
| #endif | ||
|
|
||
| #if ENABLE_RUNTIME_LOGGING | ||
| setenv ("MONO_LOG_LEVEL", "debug", TRUE); | ||
| setenv ("MONO_LOG_MASK", "all", TRUE); | ||
| #endif | ||
|
|
||
| // build using DiagnosticPorts property in AppleAppBuilder | ||
| // or set DOTNET_DiagnosticPorts env via mlaunch, xharness when undefined. | ||
| // NOTE, using DOTNET_DiagnosticPorts requires app build using AppleAppBuilder and RuntimeComponents=diagnostics_tracing | ||
| #ifdef DIAGNOSTIC_PORTS | ||
| setenv ("DOTNET_DiagnosticPorts", DIAGNOSTIC_PORTS, true); | ||
| #endif | ||
|
|
||
| // When not bundling, this will make sure the runtime can access all the assemblies | ||
steveisok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const char* bundle = get_bundle_path (); | ||
| chdir (bundle); | ||
|
|
||
| int res = invoke_netlibrary_entrypoints (); | ||
|
|
||
| exit (res); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.