Remove armv7 from target architectures when building for iOS >= 11.
- iOS 11+ requires a 64-bit architecture, so only arm64 is supported.
Change-Id: Ieb2ead13ba8722c6c0777b78f59f667331ad670c
diff --git a/cmake/iOS.cmake b/cmake/iOS.cmake
index 8d34d61..4221e9e 100644
--- a/cmake/iOS.cmake
+++ b/cmake/iOS.cmake
@@ -120,8 +120,6 @@
else()
message(FATAL_ERROR "Invalid IOS_PLATFORM: ${IOS_PLATFORM}")
endif()
-message(STATUS "Configuring iOS build for platform: ${IOS_PLATFORM}, "
- "architecture(s): ${IOS_ARCH}")
# If user did not specify the SDK root to use, then query xcodebuild for it.
if (NOT CMAKE_OSX_SYSROOT)
@@ -190,6 +188,29 @@
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
+# Specify minimum version of deployment target.
+# Unless specified, the latest SDK version is used by default.
+set(IOS_DEPLOYMENT_TARGET "${IOS_SDK_VERSION}"
+ CACHE STRING "Minimum iOS version to build for." )
+message(STATUS "Building for minimum iOS version: ${IOS_DEPLOYMENT_TARGET}"
+ " (SDK version: ${IOS_SDK_VERSION})")
+if (NOT IOS_DEPLOYMENT_TARGET VERSION_LESS 11.0)
+ # iOS 11+ does not support 32-bit architectures (armv7).
+ foreach(ARCH ${IOS_ARCH})
+ if (ARCH MATCHES "armv7*")
+ message(STATUS "Removing iOS architecture: ${ARCH} from build as it is "
+ "not supported by the minimum iOS version to build for: "
+ "${IOS_DEPLOYMENT_TARGET} (iOS >= 11 requires 64-bit).")
+ else()
+ list(APPEND VALID_IOS_ARCH_FOR_SDK_VERSION ${ARCH})
+ endif()
+ endforeach()
+ set(IOS_ARCH ${VALID_IOS_ARCH_FOR_SDK_VERSION})
+endif()
+
+message(STATUS "Configuring iOS build for platform: ${IOS_PLATFORM}, "
+ "architecture(s): ${IOS_ARCH}")
+
# Standard settings.
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_VERSION ${IOS_SDK_VERSION})
@@ -222,13 +243,6 @@
set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
-# Specify minimum version of deployment target.
-# Unless specified, the latest SDK version is used by default.
-set(IOS_DEPLOYMENT_TARGET "${IOS_SDK_VERSION}"
- CACHE STRING "Minimum iOS version to build for." )
-message(STATUS "Building for minimum iOS version: ${IOS_DEPLOYMENT_TARGET}"
- " (SDK version: ${IOS_SDK_VERSION})")
-
# Note that only Xcode 7+ supports the newer more specific:
# -m${XCODE_IOS_PLATFORM}-version-min flags, older versions of Xcode use:
# -m(ios/ios-simulator)-version-min instead.
diff --git a/docs/source/installation.rst b/docs/source/installation.rst
index 27979ce..c762bb6 100644
--- a/docs/source/installation.rst
+++ b/docs/source/installation.rst
@@ -520,6 +520,11 @@
to merge them into one static library. See ``cmake/iOS.cmake`` for
more options.
+.. NOTE::
+
+ iOS version 11.0+ requires a 64-bit architecture, so you cannot
+ build for armv7/armv7s with iOS 11.0+ (only arm64 is supported).
+
After building, you will get a ``libceres.a`` library, which you will
need to add to your Xcode project.