Skip to content

Add support for building swift host libraries and tools for android host #23742

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 3 commits into from
Apr 3, 2019

Conversation

bulbazord
Copy link
Contributor

I'd like to be able to build android host tools and libraries on android.

cc @compnerd @drodriguez

…ctories

add_sourcekit_default_compiler_flags was invoking
_add_variant_link_flags and getting link flags but not actually using
the link_libraries or library_search_directories. In android builds,
this means that the correct libc++ is not being linked against.
…ectories

The CMake variables ${sdk} and ${arch} are only set if
_add_variant_link_flags is invoked from add_swift_target_library calling
_add_swift_library_single. If you get to _add_swift_library_single from
add_swift_host_library, those variables will not be set and subsequent
linking will not find ICU libraries. This was an issue when building
swift host libraries on Android.
CMakeLists.txt Outdated
@@ -746,7 +757,9 @@ endif()

# Should we cross-compile the standard library for Android?
is_sdk_requested(ANDROID swift_build_android)
if(swift_build_android AND NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
if(swift_build_android
AND NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nicer if we sink the if (NOT ${SWIFT_ANDROID_NDK_PATH} STREQUAL "") into the case, as an always thing.

if(swift_build_android AND NOT ${SWIFT_HOST_VARIANT_SDK} STREQUAL ANDROID)
  if("${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
    message(FATAL_ERROR "SWIFT_ANDROID_NDK_PATH must be set to the Android NDK path")
  endif()

@@ -467,12 +467,14 @@ function(_add_variant_link_flags)
endif()

if(NOT "${SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_UC}" STREQUAL "")
get_filename_component(SWIFT_${sdk}_${arch}_ICU_UC_LIBDIR "${SWIFT_${sdk}_${arch}_ICU_UC}" DIRECTORY)
list(APPEND library_search_directories "${SWIFT_${sdk}_${arch}_ICU_UC_LIBDIR}")
get_filename_component(SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_UC_LIBDIR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WTF???!!!

@compnerd
Copy link
Member

compnerd commented Apr 2, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 2, 2019

Build failed
Swift Test Linux Platform
Git Sha - 8a28136cd56d3cdd679c18cdfc7a67e607fa2150

@compnerd
Copy link
Member

compnerd commented Apr 3, 2019

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit fa7f8c4 into swiftlang:master Apr 3, 2019
@finagolfin
Copy link
Member

Umm, why was this merged when there's a more comprehensive Android pull, #23208, that's been waiting for weeks now?

@drodriguez
Copy link
Contributor

@buttaface: I will answer you in the other thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants