forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/9.0'
Conflicts: src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp src/plugins/qmldesigner/qmldesignerprojectmanager.cpp src/plugins/qmldesigner/qmldesignerprojectmanager.h Change-Id: Ib029a830ee99190bc4ea2ad75d9300bfa86b42d9
This commit is contained in:
@@ -530,6 +530,11 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) :
|
||||
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options");
|
||||
});
|
||||
|
||||
if (HostOsInfo::isMacHost())
|
||||
m_configurationStates->setDrawBase(false);
|
||||
m_configurationStates->setExpanding(false);
|
||||
m_reconfigureButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
|
||||
updateSelection();
|
||||
updateConfigurationStateSelection();
|
||||
}
|
||||
@@ -1236,6 +1241,7 @@ static void addCMakeConfigurePresetToInitialArguments(QStringList &initialArgume
|
||||
env,
|
||||
project->projectDirectory(),
|
||||
buildDirectory);
|
||||
CMakePresets::Macros::updateInstallDir(configurePreset, env, project->projectDirectory());
|
||||
|
||||
// Merge the presets cache variables
|
||||
CMakeConfig cache;
|
||||
|
||||
@@ -838,7 +838,7 @@ FileApiData FileApiParser::parseData(QFutureInterface<std::shared_ptr<FileApiQtc
|
||||
|
||||
const auto cancelCheck = [&fi, &errorMessage]() -> bool {
|
||||
if (fi.isCanceled()) {
|
||||
errorMessage = Tr::tr("CMake parsing was cancelled.");
|
||||
errorMessage = Tr::tr("CMake parsing was canceled.");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -99,13 +99,33 @@ static QString expandMacroEnv(const QString ¯oPrefix,
|
||||
return result;
|
||||
}
|
||||
|
||||
static QHash<QString, QString> getEnvCombined(
|
||||
const std::optional<QHash<QString, QString>> &optPresetEnv, const Utils::Environment &env)
|
||||
{
|
||||
QHash<QString, QString> result;
|
||||
|
||||
for (auto it = env.constBegin(); it != env.constEnd(); ++it) {
|
||||
if (it.value().second)
|
||||
result.insert(it.key().name, it.value().first);
|
||||
}
|
||||
|
||||
if (!optPresetEnv)
|
||||
return result;
|
||||
|
||||
QHash<QString, QString> presetEnv = optPresetEnv.value();
|
||||
for (auto it = presetEnv.constKeyValueBegin(); it != presetEnv.constKeyValueEnd(); ++it) {
|
||||
result[it->first] = it->second;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class PresetType>
|
||||
void expand(const PresetType &preset,
|
||||
Utils::Environment &env,
|
||||
const Utils::FilePath &sourceDirectory)
|
||||
{
|
||||
const QHash<QString, QString> presetEnv = preset.environment ? preset.environment.value()
|
||||
: QHash<QString, QString>();
|
||||
const QHash<QString, QString> presetEnv = getEnvCombined(preset.environment, env);
|
||||
for (auto it = presetEnv.constKeyValueBegin(); it != presetEnv.constKeyValueEnd(); ++it) {
|
||||
const QString key = it->first;
|
||||
QString value = it->second;
|
||||
@@ -143,14 +163,15 @@ void expand(const PresetType &preset,
|
||||
{
|
||||
const QHash<QString, QString> presetEnv = preset.environment ? preset.environment.value()
|
||||
: QHash<QString, QString>();
|
||||
|
||||
for (auto it = presetEnv.constKeyValueBegin(); it != presetEnv.constKeyValueEnd(); ++it) {
|
||||
const QString key = it->first;
|
||||
QString value = it->second;
|
||||
|
||||
expandAllButEnv(preset, sourceDirectory, value);
|
||||
value = expandMacroEnv("env", value, [presetEnv](const QString ¯oName) {
|
||||
return presetEnv.value(macroName);
|
||||
if (presetEnv.contains(macroName))
|
||||
return presetEnv.value(macroName);
|
||||
return QString("${%1}").arg(macroName);
|
||||
});
|
||||
|
||||
auto operation = Utils::EnvironmentItem::Operation::SetEnabled;
|
||||
@@ -178,9 +199,7 @@ void expand(const PresetType &preset,
|
||||
{
|
||||
expandAllButEnv(preset, sourceDirectory, value);
|
||||
|
||||
const QHash<QString, QString> presetEnv = preset.environment ? preset.environment.value()
|
||||
: QHash<QString, QString>();
|
||||
|
||||
const QHash<QString, QString> presetEnv = getEnvCombined(preset.environment, env);
|
||||
value = expandMacroEnv("env", value, [presetEnv](const QString ¯oName) {
|
||||
return presetEnv.value(macroName);
|
||||
});
|
||||
@@ -234,6 +253,44 @@ void updateToolchainFile(
|
||||
configurePreset.cacheVariables = cache;
|
||||
}
|
||||
|
||||
void updateInstallDir(PresetsDetails::ConfigurePreset &configurePreset,
|
||||
const Utils::Environment &env,
|
||||
const Utils::FilePath &sourceDirectory)
|
||||
{
|
||||
if (!configurePreset.installDir)
|
||||
return;
|
||||
|
||||
QString installDirString = configurePreset.installDir.value();
|
||||
CMakePresets::Macros::expand(configurePreset, env, sourceDirectory, installDirString);
|
||||
|
||||
// Resolve the relative path first to source and afterwards to build directory
|
||||
Utils::FilePath installDir = Utils::FilePath::fromString(installDirString);
|
||||
if (installDir.isRelativePath()) {
|
||||
Utils::FilePath probePath = sourceDirectory.resolvePath(installDir);
|
||||
if (probePath != sourceDirectory) {
|
||||
installDir = probePath;
|
||||
}
|
||||
}
|
||||
installDirString = installDir.cleanPath().toString();
|
||||
|
||||
// installDir takes precedence to CMAKE_INSTALL_PREFIX
|
||||
CMakeConfig cache = configurePreset.cacheVariables ? configurePreset.cacheVariables.value()
|
||||
: CMakeConfig();
|
||||
|
||||
auto it = std::find_if(cache.begin(), cache.end(), [](const CMakeConfigItem &item) {
|
||||
return item.key == "CMAKE_INSTALL_PREFIX";
|
||||
});
|
||||
if (it != cache.end())
|
||||
it->value = installDirString.toUtf8();
|
||||
else
|
||||
cache << CMakeConfigItem("CMAKE_INSTALL_PREFIX",
|
||||
CMakeConfigItem::PATH,
|
||||
installDirString.toUtf8());
|
||||
|
||||
configurePreset.cacheVariables = cache;
|
||||
}
|
||||
|
||||
|
||||
template<class PresetType>
|
||||
void expandConditionValues(const PresetType &preset,
|
||||
const Utils::Environment &env,
|
||||
|
||||
@@ -53,6 +53,13 @@ void updateToolchainFile(PresetsDetails::ConfigurePreset &configurePreset,
|
||||
const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory);
|
||||
|
||||
/**
|
||||
* Updates the cacheVariables parameter of the configurePreset with the expanded installDir parameter.
|
||||
* Including macro expansion and relative paths resolving.
|
||||
*/
|
||||
void updateInstallDir(PresetsDetails::ConfigurePreset &configurePreset,
|
||||
const Utils::Environment &env,
|
||||
const Utils::FilePath &sourceDirectory);
|
||||
/**
|
||||
* Expands the condition values and then evaluates the condition object of the preset and returns
|
||||
* the boolean result.
|
||||
|
||||
@@ -177,6 +177,8 @@ bool parseConfigurePresets(const QJsonValue &jsonValue,
|
||||
preset.generator = object.value("generator").toString();
|
||||
if (object.contains("binaryDir"))
|
||||
preset.binaryDir = object.value("binaryDir").toString();
|
||||
if (object.contains("installDir"))
|
||||
preset.installDir = object.value("installDir").toString();
|
||||
if (object.contains("toolchainFile"))
|
||||
preset.toolchainFile = object.value("toolchainFile").toString();
|
||||
if (object.contains("cmakeExecutable"))
|
||||
@@ -462,6 +464,9 @@ void PresetsDetails::ConfigurePreset::inheritFrom(const ConfigurePreset &other)
|
||||
if (!binaryDir && other.binaryDir)
|
||||
binaryDir = other.binaryDir;
|
||||
|
||||
if (!installDir && other.installDir)
|
||||
installDir = other.installDir;
|
||||
|
||||
if (!cmakeExecutable && other.cmakeExecutable)
|
||||
cmakeExecutable = other.cmakeExecutable;
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ public:
|
||||
std::optional<ValueStrategyPair> toolset;
|
||||
std::optional<QString> toolchainFile;
|
||||
std::optional<QString> binaryDir;
|
||||
std::optional<QString> installDir;
|
||||
std::optional<QString> cmakeExecutable;
|
||||
std::optional<CMakeConfig> cacheVariables;
|
||||
std::optional<QHash<QString, QString>> environment;
|
||||
|
||||
Reference in New Issue
Block a user