@@ -172,6 +172,7 @@ KNOWN_SETTINGS=(
172
172
swift-enable-ast-verifier " 1" " If enabled, and the assertions are enabled, the built Swift compiler will run the AST verifier every time it is invoked"
173
173
swift-enable-target-linux " 1" " Enable compiler support for targeting Linux"
174
174
swift-enable-target-freebsd " 1" " Enable compiler support for targeting FreeBSD"
175
+ swift-enable-target-android " 1" " Enable compiler support for targeting Android"
175
176
swift-runtime-enable-dtrace " 0" " Enable runtime dtrace support"
176
177
swift-runtime-enable-leak-checker " 0" " Enable leaks checking routines in the runtime"
177
178
use-gold-linker " " " Enable using the gold linker"
@@ -404,6 +405,39 @@ function set_deployment_target_based_options() {
404
405
)
405
406
fi
406
407
408
+ ;;
409
+ android-* )
410
+ case ${deployment_target} in
411
+ android-armv7)
412
+ llvm_host_triple=" arm-linux-androideabi"
413
+ llvm_target_arch=" ARM"
414
+ cmark_cmake_options=(
415
+ -DCMAKE_C_FLAGS=" $( cmark_c_flags $deployment_target ) "
416
+ -DCMAKE_CXX_FLAGS=" $( cmark_c_flags $deployment_target ) "
417
+ -DCMAKE_SYSROOT:PATH=" FIXME THE SYSROOT"
418
+ )
419
+ swift_cmake_options=(
420
+ -DSWIFT_HOST_VARIANT_ARCH=" armv7"
421
+ )
422
+ ;;
423
+ * )
424
+ echo " Unknown deployment target"
425
+ exit 1
426
+ ;;
427
+ esac
428
+ native_llvm_build=$( build_directory linux-x86_64 llvm)
429
+ llvm_cmake_options=(
430
+ -DCMAKE_OSX_SYSROOT:PATH=" FIXME THE SYSROOT"
431
+ -DLLVM_HOST_TRIPLE:STRING=" ${llvm_host_triple} "
432
+ )
433
+
434
+ if [[ " ${llvm_target_arch} " ]] ; then
435
+ llvm_cmake_options=(
436
+ " ${llvm_cmake_options[@]} "
437
+ -DLLVM_TARGET_ARCH=" ${llvm_target_arch} "
438
+ )
439
+ fi
440
+
407
441
;;
408
442
* )
409
443
echo " Unknown compiler deployment target: $deployment_target "
@@ -771,7 +805,8 @@ for t in ${CROSS_COMPILE_TOOLS_DEPLOYMENT_TARGETS} ; do
771
805
iphonesimulator-i386 | iphonesimulator-x86_64 | \
772
806
iphoneos-arm64 | iphoneos-armv7 | \
773
807
appletvos-arm64 | appletvsimulator-x86_64 | \
774
- watchos-armv7k | watchsimulator-i386)
808
+ watchos-armv7k | watchsimulator-i386 | \
809
+ android-armv7 )
775
810
CROSS_TOOLS_DEPLOYMENT_TARGETS=(
776
811
" ${CROSS_TOOLS_DEPLOYMENT_TARGETS[@]} "
777
812
" ${t} "
@@ -810,6 +845,7 @@ case "$(uname -s)" in
810
845
Linux)
811
846
STDLIB_DEPLOYMENT_TARGETS=(
812
847
" linux-x86_64"
848
+ " android-armv7"
813
849
)
814
850
;;
815
851
@@ -954,6 +990,10 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do
954
990
build_for_this_target=$( not $SKIP_BUILD_WATCHOS_SIMULATOR )
955
991
test_this_target=$( not $SKIP_TEST_WATCHOS_SIMULATOR )
956
992
;;
993
+ android-* )
994
+ build_for_this_target=1
995
+ test_this_target=1
996
+ ;;
957
997
* )
958
998
echo " Unknown compiler deployment target: $deployment_target "
959
999
exit 1
@@ -1184,6 +1224,9 @@ function common_cross_c_flags() {
1184
1224
watchos-armv7k)
1185
1225
echo " -arch armv7k -mwatchos-version-min=${DARWIN_DEPLOYMENT_VERSION_WATCHOS} "
1186
1226
;;
1227
+ android-armv7)
1228
+ echo " -arch armv7"
1229
+ ;;
1187
1230
esac
1188
1231
}
1189
1232
@@ -1844,7 +1887,7 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do
1844
1887
linux-* | freebsd-* | macosx-* )
1845
1888
# OK, we can run tests directly.
1846
1889
;;
1847
- iphoneos-* | iphonesimulator-* | appletvos-* | appletvsimulator-* | watchos-* | watchsimulator-* )
1890
+ iphoneos-* | iphonesimulator-* | appletvos-* | appletvsimulator-* | watchos-* | watchsimulator-* | android- * )
1848
1891
# FIXME: remove this
1849
1892
# echo "Don't know how to run tests for $deployment_target"
1850
1893
continue
0 commit comments