-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix MacCatalyst .framework build #84858
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -401,10 +401,12 @@ function(strip_symbols targetName outputFilename) | |
|
|
||
| set(strip_command ${STRIP} -no_code_signature_warning -S ${strip_source_file}) | ||
|
|
||
| # codesign release build | ||
| string(TOLOWER "${CMAKE_BUILD_TYPE}" LOWERCASE_CMAKE_BUILD_TYPE) | ||
| if (LOWERCASE_CMAKE_BUILD_TYPE STREQUAL release) | ||
| set(strip_command ${strip_command} && codesign -f -s - ${strip_source_file}) | ||
| if (CLR_CMAKE_TARGET_OSX) | ||
| # codesign release build | ||
| string(TOLOWER "${CMAKE_BUILD_TYPE}" LOWERCASE_CMAKE_BUILD_TYPE) | ||
| if (LOWERCASE_CMAKE_BUILD_TYPE STREQUAL release) | ||
| set(strip_command ${strip_command} && codesign -f -s - ${strip_source_file}) | ||
| endif () | ||
| endif () | ||
|
|
||
| execute_process( | ||
|
|
@@ -421,46 +423,51 @@ function(strip_symbols targetName outputFilename) | |
| TARGET ${targetName} | ||
| POST_BUILD | ||
| VERBATIM | ||
| COMMAND sh -c "echo Stripping symbols from $(basename '${strip_source_file}') into $(basename '${strip_destination_file}')" | ||
|
||
| COMMAND ${DSYMUTIL} ${DSYMUTIL_OPTS} ${strip_source_file} | ||
| COMMAND ${strip_command} | ||
| COMMAND sh -c "echo Stripping symbols from $(basename '${strip_source_file}') into $(basename '${strip_destination_file}')" | ||
| ) | ||
| else (CLR_CMAKE_TARGET_APPLE) | ||
|
|
||
| add_custom_command( | ||
| TARGET ${targetName} | ||
| POST_BUILD | ||
| VERBATIM | ||
| COMMAND sh -c "echo Stripping symbols from $(basename '${strip_source_file}') into $(basename '${strip_destination_file}')" | ||
| COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file} | ||
| COMMAND ${CMAKE_OBJCOPY} --strip-debug --strip-unneeded ${strip_source_file} | ||
| COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file} | ||
| COMMAND sh -c "echo Stripping symbols from $(basename '${strip_source_file}') into $(basename '${strip_destination_file}')" | ||
| ) | ||
| endif (CLR_CMAKE_TARGET_APPLE) | ||
| endif(CLR_CMAKE_HOST_UNIX) | ||
| endfunction() | ||
|
|
||
| function(install_with_stripped_symbols targetName kind destination) | ||
| get_property(target_is_framework TARGET ${targetName} PROPERTY "FRAMEWORK") | ||
| if(NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) | ||
| strip_symbols(${targetName} symbol_file) | ||
| if (NOT "${symbol_file}" STREQUAL "") | ||
| if (NOT "${symbol_file}" STREQUAL "" AND NOT target_is_framework) | ||
| install_symbol_file(${symbol_file} ${destination} ${ARGN}) | ||
| endif() | ||
| endif() | ||
|
|
||
| if (CLR_CMAKE_TARGET_APPLE AND ("${kind}" STREQUAL "TARGETS")) | ||
| # We want to avoid the kind=TARGET install behaviors which corrupt code signatures on osx-arm64 | ||
| set(kind PROGRAMS) | ||
| endif() | ||
|
|
||
| if ("${kind}" STREQUAL "TARGETS") | ||
| set(install_source ${targetName}) | ||
| elseif("${kind}" STREQUAL "PROGRAMS") | ||
| set(install_source $<TARGET_FILE:${targetName}>) | ||
| if (target_is_framework) | ||
| install(TARGETS ${targetName} FRAMEWORK DESTINATION ${destination} ${ARGN}) | ||
| else() | ||
| message(FATAL_ERROR "The `kind` argument has to be either TARGETS or PROGRAMS, ${kind} was provided instead") | ||
| if (CLR_CMAKE_TARGET_APPLE AND ("${kind}" STREQUAL "TARGETS")) | ||
| # We want to avoid the kind=TARGET install behaviors which corrupt code signatures on osx-arm64 | ||
| set(kind PROGRAMS) | ||
| endif() | ||
|
|
||
| if ("${kind}" STREQUAL "TARGETS") | ||
| set(install_source ${targetName}) | ||
| elseif("${kind}" STREQUAL "PROGRAMS") | ||
| set(install_source $<TARGET_FILE:${targetName}>) | ||
| else() | ||
| message(FATAL_ERROR "The `kind` argument has to be either TARGETS or PROGRAMS, ${kind} was provided instead") | ||
| endif() | ||
| install(${kind} ${install_source} DESTINATION ${destination} ${ARGN}) | ||
| endif() | ||
| install(${kind} ${install_source} DESTINATION ${destination} ${ARGN}) | ||
| endfunction() | ||
|
|
||
| function(install_symbol_file symbol_file destination_path) | ||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps just:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only other targets are iOS/tvOS and it doesn't make much sense to codesign there either since that will be done during the app build. we've also not done this in the mono.proj version before you change so I think it's fine to limit it to OSX.