forked from qt-creator/qt-creator
CMake/qmake: Fix target triple for iOS targets
Neither cmake nor qmake know the full iOS compiler command line, so we have to construct the target triple for the code model ourselves. Fixes: QTCREATORBUG-28278 Change-Id: I6cac06f340e9388de5c86509a8df4ac00eef87cd Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -5,10 +5,12 @@
|
||||
|
||||
#include "abi.h"
|
||||
#include "buildconfiguration.h"
|
||||
#include "buildsystem.h"
|
||||
#include "kitinformation.h"
|
||||
#include "project.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <ios/iosconstants.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -191,4 +193,28 @@ ProjectUpdateInfo::ProjectUpdateInfo(Project *project,
|
||||
}
|
||||
}
|
||||
|
||||
// We do not get the -target flag from qmake or cmake on macOS; see QTCREATORBUG-28278.
|
||||
void addTargetFlagForIos(QStringList &cFlags, QStringList &cxxFlags, const BuildSystem *bs,
|
||||
const std::function<QString ()> &getDeploymentTarget)
|
||||
{
|
||||
const Utils::Id deviceType = DeviceTypeKitAspect::deviceTypeId(bs->target()->kit());
|
||||
if (deviceType != Ios::Constants::IOS_DEVICE_TYPE
|
||||
&& deviceType != Ios::Constants::IOS_SIMULATOR_TYPE) {
|
||||
return;
|
||||
}
|
||||
const bool isSim = deviceType == Ios::Constants::IOS_SIMULATOR_TYPE;
|
||||
QString targetTriple(QLatin1String(isSim ? "x86_64" : "arm64"));
|
||||
targetTriple.append("-apple-ios").append(getDeploymentTarget());
|
||||
if (isSim)
|
||||
targetTriple.append("-simulator");
|
||||
const auto addTargetFlag = [&targetTriple](QStringList &flags) {
|
||||
if (!flags.contains("-target") && !Utils::contains(flags,
|
||||
[](const QString &flag) { return flag.startsWith("--target="); })) {
|
||||
flags << "-target" << targetTriple;
|
||||
}
|
||||
};
|
||||
addTargetFlag(cxxFlags);
|
||||
addTargetFlag(cFlags);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -21,9 +21,17 @@
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class BuildSystem;
|
||||
class Kit;
|
||||
class Project;
|
||||
|
||||
void PROJECTEXPLORER_EXPORT addTargetFlagForIos(
|
||||
QStringList &cFlags,
|
||||
QStringList &cxxFlags,
|
||||
const BuildSystem *bs,
|
||||
const std::function<QString()> &getDeploymentTarget
|
||||
);
|
||||
|
||||
class PROJECTEXPLORER_EXPORT RawProjectPartFlags
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user