Skip to content

Commit 1c58315

Browse files
authored
Merge pull request #3840 from lplarson/adhoc-sign-dylibs
2 parents 302a875 + 4c421c5 commit 1c58315

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,13 @@ function(add_swift_library name)
14371437
"${UNIVERSAL_LIBRARY_NAME}"
14381438
${THIN_INPUT_TARGETS})
14391439

1440+
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND SWIFTLIB_SHARED)
1441+
# Ad-hoc sign stdlib dylibs
1442+
add_custom_command(TARGET "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}"
1443+
POST_BUILD
1444+
COMMAND "codesign" "-f" "-s" "-" "${UNIVERSAL_LIBRARY_NAME}")
1445+
endif()
1446+
14401447
# Cache universal libraries for dependency purposes
14411448
set(UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}
14421449
${UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}}

test/Interpreter/objc_runtime_visible.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: rm -rf %t && mkdir -p %t
22

33
// RUN: %clang %target-cc-options -isysroot %sdk -fobjc-arc %S/Inputs/objc_runtime_visible.m -fmodules -nodefaultlibs -lc -dynamiclib -o %t/libobjc_runtime_visible.dylib -install_name @executable_path/libobjc_runtime_visible.dylib
4+
// RUN: codesign -f -s - %t/libobjc_runtime_visible.dylib
45
// RUN: nm -g %t/libobjc_runtime_visible.dylib | FileCheck %s
56
// RUN: %target-build-swift -import-objc-header %S/Inputs/objc_runtime_visible.h %t/libobjc_runtime_visible.dylib %s -o %t/main
67
// RUN: %target-run %t/main %t/libobjc_runtime_visible.dylib

0 commit comments

Comments
 (0)