Skip to content

Changes for Android build of Foundation #4662

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

Closed
wants to merge 3 commits into from
Closed
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
14 changes: 12 additions & 2 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,17 @@ for host in "${ALL_HOSTS[@]}"; do
# However, we only have the triple and sysroot for the host.
# Also, we will need to tell it which linker to use.
FOUNDATION_BUILD_ARGS=()
if [[ $(is_cross_tools_host ${host}) ]]; then
FOUNDATION_CFLAGS="CFLAGS=${CFLAGS}"
FOUNDATION_SFLAGS="SWIFTCFLAGS=${SWIFTCFLAGS}"
FOUNDATION_LDFLAGS="LDFLAGS=${LDFLAGS}"
if [[ "${ANDROID_NDK}" != "" ]]; then
FOUNDATION_CFLAGS="CFLAGS=-DDEPLOYMENT_ENABLE_LIBDISPATCH --sysroot=${ANDROID_NDK}/platforms/android-${ANDROID_API_LEVEL}/arch-arm -I${ANDROID_ICU_UC}/include -I\${SDKROOT}/lib/swift"
FOUNDATION_SFLAGS="SWIFTCFLAGS=-DDEPLOYMENT_ENABLE_LIBDISPATCH -I${ANDROID_NDK}/platforms/android-${ANDROID_API_LEVEL}/arch-arm/usr/include"
FOUNDATION_LDFLAGS="LDFLAGS=-fuse-ld=gold --sysroot=${ANDROID_NDK}/platforms/android-21/arch-arm -L${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x -L${ANDROID_ICU_UC} -L\${SDKROOT}/lib/swift/android -ldispatch"
FOUNDATION_BUILD_ARGS+=(
"--target=armv7-none-linux-androideabi"
)
elif [[ $(is_cross_tools_host ${host}) ]]; then
FOUNDATION_BUILD_ARGS+=(
"--target=${SWIFT_HOST_TRIPLE}"
)
Expand All @@ -2273,7 +2283,7 @@ for host in "${ALL_HOSTS[@]}"; do

with_pushd "${FOUNDATION_SOURCE_DIR}" \
call env SWIFTC="${SWIFTC_BIN}" CLANG="${LLVM_BIN}"/clang SWIFT="${SWIFT_BIN}" \
SDKROOT="${SWIFT_BUILD_PATH}" BUILD_DIR="${build_dir}" DSTROOT="$(get_host_install_destdir ${host})" PREFIX="$(get_host_install_prefix ${host})" ./configure "${FOUNDATION_BUILD_TYPE}" ${FOUNDATION_BUILD_ARGS[@]} -DXCTEST_BUILD_DIR=${XCTEST_BUILD_DIR} $LIBDISPATCH_BUILD_ARGS
SDKROOT="${SWIFT_BUILD_PATH}" BUILD_DIR="${build_dir}" DSTROOT="$(get_host_install_destdir ${host})" PREFIX="$(get_host_install_prefix ${host})" "$FOUNDATION_CFLAGS" "$FOUNDATION_SFLAGS" "$FOUNDATION_LDFLAGS" ./configure "${FOUNDATION_BUILD_TYPE}" ${FOUNDATION_BUILD_ARGS[@]} -DXCTEST_BUILD_DIR=${XCTEST_BUILD_DIR} $LIBDISPATCH_BUILD_ARGS
with_pushd "${FOUNDATION_SOURCE_DIR}" \
call ${NINJA_BIN}

Expand Down