summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-10-08 19:32:16 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-10-12 13:35:57 +0200
commit5b90b650a414c8088854e7ca84663aaa0f3528af (patch)
tree2ea74777201c2b163be50da3bb160a4336c9866e /cmake
parente57ccd45cad98bd92638937de1218c5a7b9f7baa (diff)
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>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtAutoDetect.cmake10
-rw-r--r--cmake/QtProcessConfigureArgs.cmake5
-rw-r--r--cmake/README.md6
-rw-r--r--cmake/configure-cmake-mapping.md7
4 files changed, 16 insertions, 12 deletions
diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake
index 5a575d2de3..cd5b3406cf 100644
--- a/cmake/QtAutoDetect.cmake
+++ b/cmake/QtAutoDetect.cmake
@@ -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}\".")
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake
index 402ca52b24..455f98224d 100644
--- a/cmake/QtProcessConfigureArgs.cmake
+++ b/cmake/QtProcessConfigureArgs.cmake
@@ -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)
diff --git a/cmake/README.md b/cmake/README.md
index e8bff0ab2b..504c7bedfc 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -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:
diff --git a/cmake/configure-cmake-mapping.md b/cmake/configure-cmake-mapping.md
index 6f7b7af71a..487f9c7354 100644
--- a/cmake/configure-cmake-mapping.md
+++ b/cmake/configure-cmake-mapping.md
@@ -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 | |