forked from qt-creator/qt-creator
CMake/iOS: Set up CMake configuration
For Qt6/iOS we need to use the Xcode generator, and set CMAKE_OSX_SYSROOT, CMAKE_OSX_ARCHITECTURES, and the Qt toolchain file with CMAKE_TOOLCHAIN_FILE. We also may not automatically add the CMAKE_SYSROOT and CMAKE_C(XX)_COMPILER_TARGET variables, since this is handled differently for iOS targets. With this building, running and debugging on the simulator works, if the CMake project correctly sets up a MACOSX_BUNDLE_GUI_IDENTIFIER, MACOSX_BUNDLE_BUNDLE_VERSION, MACOSX_BUNDLE_SHORT_VERSION_STRING and MACOSX_BUNDLE_LONG_VERSION_STRING. For the device build the signing and provisioning details are still missing. Task-number: QTCREATORBUG-23574 Change-Id: I12be0d102b57d834d7cae06c87842638f693c087 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -32,14 +32,15 @@
|
||||
#include "cmaketoolmanager.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <ios/iosconstants.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectexplorersettings.h>
|
||||
#include <projectexplorer/task.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <app/app_version.h>
|
||||
|
||||
@@ -66,6 +67,13 @@ namespace CMakeProjectManager {
|
||||
// CMakeKitAspect:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
static bool isIos(const Kit *k)
|
||||
{
|
||||
const Utils::Id deviceType = DeviceTypeKitAspect::deviceTypeId(k);
|
||||
return deviceType == Ios::Constants::IOS_DEVICE_TYPE
|
||||
|| deviceType == Ios::Constants::IOS_SIMULATOR_TYPE;
|
||||
}
|
||||
|
||||
static Utils::Id defaultCMakeToolId()
|
||||
{
|
||||
CMakeTool *defaultTool = CMakeToolManager::defaultCMakeTool();
|
||||
@@ -635,6 +643,9 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
|
||||
if (!tool)
|
||||
return QVariant();
|
||||
|
||||
if (isIos(k))
|
||||
return GeneratorInfo("Xcode").toVariant();
|
||||
|
||||
const QList<CMakeTool::Generator> known = tool->supportedGenerators();
|
||||
auto it = std::find_if(known.constBegin(), known.constEnd(), [](const CMakeTool::Generator &g) {
|
||||
return g.matches("Ninja");
|
||||
@@ -765,7 +776,7 @@ void CMakeGeneratorKitAspect::fix(Kit *k)
|
||||
dv.fromVariant(defaultValue(k));
|
||||
setGeneratorInfo(k, dv);
|
||||
} else {
|
||||
const GeneratorInfo dv(info.generator,
|
||||
const GeneratorInfo dv(isIos(k) ? QString("Xcode") : info.generator,
|
||||
info.extraGenerator,
|
||||
it->supportsPlatform ? info.platform : QString(),
|
||||
it->supportsToolset ? info.toolset : QString());
|
||||
|
||||
Reference in New Issue
Block a user