Skip to content

[build] re-enable setting soname for Android shared libraries #30956

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 1 commit into from
Apr 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1324,14 +1324,8 @@ function(add_swift_target_library name)
list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
endif()
# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
if(SWIFTLIB_SHARED)
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
elseif(${sdk} STREQUAL ANDROID)
list(APPEND swiftlib_link_flags_all "-shared")
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")
endif()
if(SWIFTLIB_SHARED AND sdk IN_LIST SWIFT_APPLE_PLATFORMS)
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
endif()

set(sdk_supported_archs
Expand Down Expand Up @@ -1472,6 +1466,13 @@ function(add_swift_target_library name)

list(APPEND swiftlib_c_compile_flags_all "-DSWIFT_TARGET_LIBRARY_NAME=${name}")

# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
if(SWIFTLIB_SHARED AND ${sdk} STREQUAL ANDROID)
list(APPEND swiftlib_link_flags_all "-shared")
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")
endif()

# Add this library variant.
_add_swift_target_library_single(
${variant_name}
Expand Down