CMake: Implement missing iOS-related configure options

Detect an iOS build when either an -sdk option is passed
or when -xplatform macx-ios-clang is passed as a target
mkspec.

Now that CMake 3.17 is released, change the default behavior of the
iOS build to configure with simulator_and_device set to ON, like it
is with qmake.

Update the documentation regarding iOS configuration.

Change-Id: I91aaf706610b8d3c69f1ad4ba9dadee2b1e5db97
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-10-08 19:32:16 +02:00
parent e57ccd45ca
commit 5b90b650a4
4 changed files with 16 additions and 12 deletions

View File

@ -69,14 +69,10 @@ function(qt_auto_detect_ios)
# If the variable is explicitly provided, assume simulator_and_device to be off.
if(QT_UIKIT_SDK)
set(simulator_and_device OFF)
elseif(QT_FORCE_SIMULATOR_AND_DEVICE)
# TODO: Once we get simulator_and_device support in upstream CMake, only then allow
# usage of simulator_and_device without forcing.
set(simulator_and_device ON)
else()
# If QT_UIKIT_SDK is not provided, default to simulator.
set(simulator_and_device OFF)
set(QT_UIKIT_SDK "iphonesimulator" CACHE "STRING" "Chosen uikit SDK.")
# Default to simulator_and_device when an explicit sdk is not requested.
# Requires CMake 3.17.0+.
set(simulator_and_device ON)
endif()
message(STATUS "simulator_and_device set to: \"${simulator_and_device}\".")

View File

@ -601,6 +601,11 @@ endif()
translate_string_input(android-javac-source QT_ANDROID_JAVAC_SOURCE)
translate_string_input(android-javac-target QT_ANDROID_JAVAC_TARGET)
translate_string_input(sdk QT_UIKIT_SDK)
if(DEFINED INPUT_sdk OR (DEFINED INPUT_xplatform AND INPUT_xplatform STREQUAL "macx-ios-clang"))
push("-DCMAKE_SYSTEM_NAME=iOS")
endif()
drop_input(make)
drop_input(nomake)

View File

@ -178,11 +178,11 @@ In order to cross-compile Qt to iOS, you need a host macOS build.
When running cmake in qtbase, pass
``-DCMAKE_SYSTEM_NAME=iOS -DQT_HOST_PATH=/path/to/your/host/build -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH``
If you don't supply the configuration argument ``-DQT_UIKIT_SDK=...``, it will default to
``iphonesimulator``. To target another SDK / device type, use one of the following values:
If you don't supply the configuration argument ``-DQT_UIKIT_SDK=...``, CMake will build a
multi-arch simulator_and_device iOS build.
To target another SDK / device type, use one of the following values:
* iphonesimulator: ``-DQT_UIKIT_SDK=iphonesimulator``
* iphoneos: ``-DQT_UIKIT_SDK=iphoneos``
* simulator_and_device: ``-DQT_FORCE_SIMULATOR_AND_DEVICE=ON -DQT_UIKIT_SDK=``
Depending on what value you pass to ``-DQT_UIKIT_SDK=`` a list of target architectures is chosen
by default:

View File

@ -41,7 +41,8 @@ The effort of this is tracked in QTBUG-85373 and QTBUG-85349.
| -static | -DBUILD_SHARED_LIBS=OFF | |
| -framework | -DFEATURE_framework=ON | |
| -platform <target> | -DQT_QMAKE_TARGET_MKSPEC=<mkspec> | |
| -xplatform <target> | -DQT_QMAKE_TARGET_MKSPEC=<mkspec> | Only used for generating qmake-compatibility files. |
| -xplatform <target> | -DQT_QMAKE_TARGET_MKSPEC=<mkspec> | Used for generating qmake-compatibility files. |
| | | If passed 'macx-ios-clang', will configure an iOS build. |
| -device <name> | equivalent to -xplatform devices/<name> | |
| -device-option <key=value> | -DQT_QMAKE_DEVICE_OPTIONS=key1=value1;key2=value2 | Only used for generation qmake-compatibility files. |
| | | The device options are written into mkspecs/qdevice.pri. |
@ -88,7 +89,9 @@ The effort of this is tracked in QTBUG-85373 and QTBUG-85349.
| -I <string> | -DQT_EXTRA_INCLUDEPATHS=<string1>;<string2> | |
| -L <string> | -DQT_EXTRA_LIBDIRS=<string1>;<string2> | |
| -F <string> | -DQT_EXTRA_FRAMEWORKPATHS=<string1>;<string2> | |
| -sdk <sdk> | | |
| -sdk <sdk> | -DQT_UIKIT_SDK=<value> | Should be provided a value like 'iphoneos' or 'iphonesimulator' |
| | | If no value is provided, a simulator_and_device build is |
| | | assumed. |
| -android-sdk <path> | -DANDROID_SDK_ROOT=<path> | |
| -android-ndk <path> | -DCMAKE_TOOLCHAIN_PATH=<toolchain file in NDK> | |
| -android-ndk-platform android-23 | -DCMAKE_ANDROID_NATIVE_API_LEVEL=23 | |