2022-05-30 19:04:54 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <utils/environmentfwd.h>
|
|
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
class Environment;
|
|
|
|
|
class FilePath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace CMakeProjectManager::Internal {
|
|
|
|
|
|
2022-09-26 18:59:04 +02:00
|
|
|
namespace PresetsDetails {
|
|
|
|
|
class ConfigurePreset;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-30 19:04:54 +02:00
|
|
|
namespace CMakePresets::Macros {
|
|
|
|
|
/**
|
|
|
|
|
* Expands the CMakePresets Macros using Utils::Environment as target and source for parent environment values.
|
|
|
|
|
* $penv{PATH} is taken from Utils::Environment
|
|
|
|
|
*/
|
2022-09-05 20:09:12 +02:00
|
|
|
template<class PresetType>
|
|
|
|
|
void expand(const PresetType &preset,
|
2022-05-30 19:04:54 +02:00
|
|
|
Utils::Environment &env,
|
|
|
|
|
const Utils::FilePath &sourceDirectory);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Expands the CMakePresets Macros using Utils::Environment as target
|
|
|
|
|
* $penv{PATH} is replaced with Qt Creator macros ${PATH}
|
|
|
|
|
*/
|
2022-09-05 20:09:12 +02:00
|
|
|
template<class PresetType>
|
|
|
|
|
void expand(const PresetType &preset,
|
2022-05-30 19:04:54 +02:00
|
|
|
Utils::EnvironmentItems &envItems,
|
|
|
|
|
const Utils::FilePath &sourceDirectory);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Expands the CMakePresets macros inside the @value QString parameter.
|
|
|
|
|
*/
|
2022-09-05 20:09:12 +02:00
|
|
|
template<class PresetType>
|
|
|
|
|
void expand(const PresetType &preset,
|
2022-05-30 19:04:54 +02:00
|
|
|
const Utils::Environment &env,
|
|
|
|
|
const Utils::FilePath &sourceDirectory,
|
|
|
|
|
QString &value);
|
|
|
|
|
|
2022-09-26 18:59:04 +02:00
|
|
|
/**
|
|
|
|
|
* Updates the cacheVariables parameter of the configurePreset with the expandned toolchainFile parameter.
|
|
|
|
|
* Including macro expansion and relative paths resolving.
|
|
|
|
|
*/
|
|
|
|
|
void updateToolchainFile(PresetsDetails::ConfigurePreset &configurePreset,
|
|
|
|
|
const Utils::Environment &env,
|
|
|
|
|
const Utils::FilePath &sourceDirectory,
|
|
|
|
|
const Utils::FilePath &buildDirectory);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Expands the condition values and then evaluates the condition object of the preset and returns
|
|
|
|
|
* the boolean result.
|
|
|
|
|
*/
|
|
|
|
|
template<class PresetType>
|
|
|
|
|
bool evaluatePresetCondition(const PresetType &preset, const Utils::FilePath &sourceDirectory);
|
|
|
|
|
|
2022-05-30 19:04:54 +02:00
|
|
|
} // namespace CMakePresets::Macros
|
|
|
|
|
|
|
|
|
|
} // namespace CMakeProjectManager::Internal
|