@@ -187,8 +187,6 @@ set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING
187187 "Path to the directory that contains the Android NDK tools that are executable on the build machine" )
188188set (SWIFT_ANDROID_NDK_GCC_VERSION "" CACHE STRING
189189 "The GCC version to use when building for Android. Currently only 4.9 is supported." )
190- set (SWIFT_ANDROID_SDK_PATH "" CACHE STRING
191- "Path to the directory that contains the Android SDK tools that will be passed to the swiftc frontend" )
192190set (SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
193191 "Path on an Android device where build products will be pushed. These are used when running the test suite against the device" )
194192
@@ -354,7 +352,7 @@ endfunction()
354352# Print out path and version of any installed commands.
355353# We migth be using the wrong version of a command, so record them all.
356354function (print_versions)
357- find_version("cmake " "--version" TRUE )
355+ find_version("${CMAKE_COMMAND} " "--version" TRUE )
358356
359357 message (STATUS "Finding version for: ${CMAKE_COMMAND} " )
360358 message (STATUS "Found version: ${CMAKE_VERSION} " )
@@ -594,7 +592,7 @@ else()
594592 set (SWIFT_HOST_VARIANT_ARCH_default "x86_64" )
595593 elseif ("${CMAKE_SYSTEM_PROCESSOR} " STREQUAL "IA64" )
596594 set (SWIFT_HOST_VARIANT_ARCH_default "itanium" )
597- elseif ("${CMAKE_SYSTEM_PROCESSOR} " STREQUAL " x86" )
595+ elseif ("${CMAKE_SYSTEM_PROCESSOR} " MATCHES "( x86|i686) " )
598596 set (SWIFT_HOST_VARIANT_ARCH_default "i686" )
599597 else ()
600598 message (FATAL_ERROR "Unrecognized architecture on host system: ${CMAKE_SYSTEM_PROCESSOR} " )
@@ -637,7 +635,6 @@ endif()
637635# To fix it, we would need to append the architecture to the SDKs,
638636# for example: 'OSX-x86_64;IOS-armv7;...etc'.
639637# We could easily do that - we have all of that information in build-script-impl.
640- # Also, we would need to be provided with the sysroot for each SDK (see SWIFT_ANDROID_SDK_PATH/SWIFT_SDK_ANDROID_PATH).
641638# Darwin targets cheat and use `xcrun`.
642639
643640if ("${SWIFT_HOST_VARIANT_SDK} " STREQUAL "LINUX" )
@@ -650,6 +647,8 @@ if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
650647 if ("${SWIFT_HOST_TRIPLE} " STREQUAL "" )
651648 if ("${SWIFT_HOST_VARIANT_ARCH} " STREQUAL "x86_64" )
652649 set (SWIFT_HOST_TRIPLE "x86_64-unknown-linux-gnu" )
650+ elseif ("${SWIFT_HOST_VARIANT_ARCH} " STREQUAL "i686" )
651+ set (SWIFT_HOST_TRIPLE "i686-unknown-linux-gnu" )
653652 elseif ("${SWIFT_HOST_VARIANT_ARCH} " STREQUAL "aarch64" )
654653 set (SWIFT_HOST_TRIPLE "aarch64-unknown-linux-gnu" )
655654 elseif ("${SWIFT_HOST_VARIANT_ARCH} " MATCHES "(powerpc64|powerpc64le)" )
@@ -726,7 +725,7 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" MATCHES "(OSX|IOS*|TVOS*|WATCHOS*)")
726725 COMMAND "xcodebuild" "-version"
727726 OUTPUT_VARIABLE xcode_version
728727 OUTPUT_STRIP_TRAILING_WHITESPACE)
729- string (REPLACE "\n " ", " xcode_version ${xcode_version} )
728+ string (REPLACE "\n " ", " xcode_version " ${xcode_version} " )
730729 message (STATUS "${xcode_version} " )
731730 message (STATUS "" )
732731
@@ -760,22 +759,29 @@ endif()
760759# Should we cross-compile the standard library for Android?
761760is_sdk_requested(ANDROID swift_build_android)
762761if (swift_build_android AND NOT "${SWIFT_ANDROID_NDK_PATH} " STREQUAL "" )
763-
764- configure_sdk_unix(ANDROID "Android" "android" "android" "armv7" "armv7-none-linux-androideabi" "${SWIFT_ANDROID_SDK_PATH} " )
765-
766- if (NOT ("${CMAKE_SYSTEM_NAME} " STREQUAL "Darwin" OR "${CMAKE_SYSTEM_NAME} " STREQUAL "Linux" ))
762+ if (NOT ("${CMAKE_HOST_SYSTEM_NAME} " STREQUAL "Darwin" OR "${CMAKE_HOST_SYSTEM_NAME} " STREQUAL "Linux" ))
767763 message (FATAL_ERROR "A Darwin or Linux host is required to build the Swift runtime for Android" )
768- elseif (("${CMAKE_SYSTEM_NAME} " STREQUAL "Darwin" AND NOT swift_build_osx) OR
769- ("${CMAKE_SYSTEM_NAME} " STREQUAL "Linux" AND NOT swift_build_linux))
764+ endif ()
765+
766+ if (("${CMAKE_SYSTEM_NAME} " STREQUAL "Darwin" AND NOT swift_build_osx) OR
767+ ("${CMAKE_SYSTEM_NAME} " STREQUAL "Linux" AND NOT swift_build_linux))
770768 set (SWIFT_PRIMARY_VARIANT_SDK_default "ANDROID" )
771769 set (SWIFT_PRIMARY_VARIANT_ARCH_default "armv7" )
772770 endif ()
771+
772+ if ("${SWIFT_SDK_ANDROID_ARCHITECTURES} " STREQUAL "" )
773+ set (SWIFT_SDK_ANDROID_ARCHITECTURES armv7;aarch)
774+ endif ()
775+ configure_sdk_unix(ANDROID "Android" "android" "android" "${SWIFT_SDK_ANDROID_ARCHITECTURES} " "" "" )
773776endif ()
774777
775778# Should we cross-compile the standard library for Windows?
776779is_sdk_requested(WINDOWS swift_build_windows)
777780if (swift_build_windows AND NOT "${CMAKE_SYSTEM_NAME} " STREQUAL "Windows" )
778- configure_sdk_windows(WINDOWS "Windows" "msvc" "aarch64;armv7;i686;x86_64" )
781+ if ("${SWIFT_SDK_WINDOWS_ARCHITECTURES} " STREQUAL "" )
782+ set (SWIFT_SDK_WINDOWS_ARCHITECTURES aarch64;armv7;i686;x86_64)
783+ endif ()
784+ configure_sdk_windows(WINDOWS "Windows" "msvc" "${SWIFT_SDK_WINDOWS_ARCHITECTURES} " )
779785endif ()
780786
781787if ("${SWIFT_SDKS} " STREQUAL "" )
@@ -860,17 +866,18 @@ function(swift_icu_variables_set sdk arch result)
860866 endif ()
861867endfunction ()
862868
863- # ICU is provided through CoreFoundation on Darwin. On other hosts, assume that
864- # we are compiling for the build as the host. In such a case, if the ICU
869+ # ICU is provided through CoreFoundation on Darwin. On other hosts, if the ICU
865870# unicode and i18n include and library paths are not defined, perform a standard
866871# package lookup. Otherwise, rely on the paths specified by the user. These
867872# need to be defined when cross-compiling.
868873if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
869- swift_icu_variables_set("${SWIFT_HOST_VARIANT_SDK_default} "
870- "${SWIFT_HOST_VARIANT_ARCH_default} "
871- ICU_CONFIGURED)
872- if ("${SWIFT_PATH_TO_LIBICU_BUILD} " STREQUAL "" AND NOT ${ICU_CONFIGURED} )
873- find_package (ICU REQUIRED COMPONENTS uc i18n)
874+ if (SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
875+ swift_icu_variables_set("${SWIFT_PRIMARY_VARIANT_SDK} "
876+ "${SWIFT_PRIMARY_VARIANT_ARCH} "
877+ ICU_CONFIGURED)
878+ if ("${SWIFT_PATH_TO_LIBICU_BUILD} " STREQUAL "" AND NOT ${ICU_CONFIGURED} )
879+ find_package (ICU REQUIRED COMPONENTS uc i18n)
880+ endif ()
874881 endif ()
875882endif ()
876883
@@ -898,6 +905,11 @@ cmake_pop_check_state()
898905
899906check_symbol_exists(wait4 "sys/wait.h" HAVE_WAIT4)
900907
908+ check_symbol_exists(proc_pid_rusage "libproc.h" HAVE_PROC_PID_RUSAGE)
909+ if (HAVE_PROC_PID_RUSAGE)
910+ list (APPEND CMAKE_REQUIRED_LIBRARIES proc)
911+ endif ()
912+
901913if (LLVM_ENABLE_DOXYGEN)
902914 message (STATUS "Doxygen: enabled" )
903915endif ()
0 commit comments