forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/13.0'
Conflicts: src/plugins/cmakeprojectmanager/cmaketool.cpp src/plugins/python/pythonutils.cpp src/plugins/qtsupport/baseqtversion.cpp Change-Id: Ia3e35c763ff9475d17ad922718b54152209893b8
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
|
||||
#include <qtsupport/qtkitaspect.h>
|
||||
@@ -723,8 +724,14 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
|
||||
if (!configurePreset.cmakeExecutable) {
|
||||
const CMakeTool *cmakeTool = CMakeToolManager::defaultCMakeTool();
|
||||
if (cmakeTool)
|
||||
if (cmakeTool) {
|
||||
configurePreset.cmakeExecutable = cmakeTool->cmakeExecutable().toString();
|
||||
} else {
|
||||
configurePreset.cmakeExecutable = QString();
|
||||
TaskHub::addTask(
|
||||
BuildSystemTask(Task::TaskType::Error, Tr::tr("<No CMake Tool available>")));
|
||||
TaskHub::requestPopup();
|
||||
}
|
||||
} else {
|
||||
QString cmakeExecutable = configurePreset.cmakeExecutable.value();
|
||||
CMakePresets::Macros::expand(configurePreset, env, projectDirectory(), cmakeExecutable);
|
||||
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
CMakeTool cmake(m_autodetected ? CMakeTool::AutoDetection
|
||||
: CMakeTool::ManualDetection, m_id);
|
||||
cmake.setFilePath(m_executable);
|
||||
m_isSupported = cmake.hasFileApi(true);
|
||||
m_isSupported = cmake.hasFileApi();
|
||||
|
||||
m_tooltip = Tr::tr("Version: %1").arg(cmake.versionDisplay());
|
||||
m_tooltip += "<br>" + Tr::tr("Supports fileApi: %1").arg(m_isSupported ? Tr::tr("yes") : Tr::tr("no"));
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/persistentcachestore.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
@@ -155,13 +154,13 @@ FilePath CMakeTool::filePath() const
|
||||
return m_executable;
|
||||
}
|
||||
|
||||
bool CMakeTool::isValid(bool ignoreCache) const
|
||||
bool CMakeTool::isValid() const
|
||||
{
|
||||
if (!m_id.isValid() || !m_introspection)
|
||||
return false;
|
||||
|
||||
if (!m_introspection->m_didAttemptToRun)
|
||||
readInformation(ignoreCache);
|
||||
readInformation();
|
||||
|
||||
return m_introspection->m_haveCapabilitites && !m_introspection->m_fileApis.isEmpty();
|
||||
}
|
||||
@@ -324,9 +323,9 @@ CMakeKeywords CMakeTool::keywords()
|
||||
return m_introspection->m_keywords;
|
||||
}
|
||||
|
||||
bool CMakeTool::hasFileApi(bool ignoreCache) const
|
||||
bool CMakeTool::hasFileApi() const
|
||||
{
|
||||
return isValid(ignoreCache) ? !m_introspection->m_fileApis.isEmpty() : false;
|
||||
return isValid() ? !m_introspection->m_fileApis.isEmpty() : false;
|
||||
}
|
||||
|
||||
CMakeTool::Version CMakeTool::version() const
|
||||
@@ -438,7 +437,7 @@ void CMakeTool::openCMakeHelpUrl(const CMakeTool *tool, const QString &linkUrl)
|
||||
Core::HelpManager::showHelpUrl(linkUrl.arg(documentationUrl(version, online)));
|
||||
}
|
||||
|
||||
void CMakeTool::readInformation(bool ignoreCache) const
|
||||
void CMakeTool::readInformation() const
|
||||
{
|
||||
QTC_ASSERT(m_introspection, return );
|
||||
if (!m_introspection->m_haveCapabilitites && m_introspection->m_didAttemptToRun)
|
||||
@@ -446,7 +445,7 @@ void CMakeTool::readInformation(bool ignoreCache) const
|
||||
|
||||
m_introspection->m_didAttemptToRun = true;
|
||||
|
||||
fetchFromCapabilities(ignoreCache);
|
||||
fetchFromCapabilities();
|
||||
}
|
||||
|
||||
|
||||
@@ -625,17 +624,8 @@ QStringList CMakeTool::parseSyntaxHighlightingXml()
|
||||
return moduleFunctions;
|
||||
}
|
||||
|
||||
void CMakeTool::fetchFromCapabilities(bool ignoreCache) const
|
||||
void CMakeTool::fetchFromCapabilities() const
|
||||
{
|
||||
expected_str<Utils::Store> cache = PersistentCacheStore::byKey(
|
||||
keyFromString("CMake_" + cmakeExecutable().toUserOutput()));
|
||||
|
||||
if (cache && !ignoreCache) {
|
||||
m_introspection->m_haveCapabilitites = true;
|
||||
parseFromCapabilities(cache->value("CleanedStdOut").toString());
|
||||
return;
|
||||
}
|
||||
|
||||
Process cmake;
|
||||
runCMake(cmake, {"-E", "capabilities"});
|
||||
|
||||
@@ -646,12 +636,6 @@ void CMakeTool::fetchFromCapabilities(bool ignoreCache) const
|
||||
qCCritical(cmakeToolLog) << "Fetching capabilities failed: " << cmake.allOutput() << cmake.error();
|
||||
m_introspection->m_haveCapabilitites = false;
|
||||
}
|
||||
|
||||
Store newData{{"CleanedStdOut", cmake.cleanedStdOut()}};
|
||||
const auto result
|
||||
= PersistentCacheStore::write(keyFromString("CMake_" + cmakeExecutable().toUserOutput()),
|
||||
newData);
|
||||
QTC_ASSERT_EXPECTED(result, return);
|
||||
}
|
||||
|
||||
static int getVersion(const QVariantMap &obj, const QString &value)
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
|
||||
static Utils::Id createId();
|
||||
|
||||
bool isValid(bool ignoreCache = false) const;
|
||||
bool isValid() const;
|
||||
|
||||
Utils::Id id() const { return m_id; }
|
||||
Utils::Store toMap () const;
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
bool autoCreateBuildDirectory() const;
|
||||
QList<Generator> supportedGenerators() const;
|
||||
CMakeKeywords keywords();
|
||||
bool hasFileApi(bool ignoreCache = false) const;
|
||||
bool hasFileApi() const;
|
||||
Version version() const;
|
||||
QString versionDisplay() const;
|
||||
|
||||
@@ -113,14 +113,14 @@ public:
|
||||
static void openCMakeHelpUrl(const CMakeTool *tool, const QString &linkUrl);
|
||||
|
||||
private:
|
||||
void readInformation(bool ignoreCache = false) const;
|
||||
void readInformation() const;
|
||||
|
||||
void runCMake(Utils::Process &proc, const QStringList &args, int timeoutS = 1) const;
|
||||
void parseFunctionDetailsOutput(const QString &output);
|
||||
QStringList parseVariableOutput(const QString &output);
|
||||
QStringList parseSyntaxHighlightingXml();
|
||||
|
||||
void fetchFromCapabilities(bool ignoreCache = false) const;
|
||||
void fetchFromCapabilities() const;
|
||||
void parseFromCapabilities(const QString &input) const;
|
||||
|
||||
// Note: New items here need also be handled in CMakeToolItemModel::apply()
|
||||
|
||||
@@ -301,9 +301,14 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
||||
continue;
|
||||
|
||||
const FilePath buildDir = relativeLibs ? buildDirectory : currentBuildDir;
|
||||
std::optional<QString> dllName;
|
||||
FilePath tmp = buildDir.resolvePath(part);
|
||||
if (f.role == "libraries")
|
||||
tmp = tmp.parentDir();
|
||||
|
||||
std::optional<QString> dllName;
|
||||
if (buildDir.osType() == OsTypeWindows && (f.role == "libraries")) {
|
||||
part = FilePath::fromUserInput(part).fileName();
|
||||
|
||||
// Skip object libraries on Windows. This case can happen with static qml plugins
|
||||
if (part.endsWith(".obj") || part.endsWith(".o"))
|
||||
continue;
|
||||
@@ -312,15 +317,17 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
||||
for (const QString &suffix :
|
||||
{QString(".lib"), QString(".dll.a"), QString(".a")}) {
|
||||
if (part.endsWith(suffix) && !dllName)
|
||||
dllName = FilePath::fromUserInput(
|
||||
part.chopped(suffix.length()).append(".dll"))
|
||||
.fileName();
|
||||
dllName = part.chopped(suffix.length()).append(".dll");
|
||||
}
|
||||
}
|
||||
|
||||
FilePath tmp = buildDir.resolvePath(part);
|
||||
if (f.role == "libraries")
|
||||
tmp = tmp.parentDir();
|
||||
// MinGW has libQt6Core.a -> Qt6Core.dll
|
||||
const QString mingwPrefix("lib");
|
||||
const QString mingwSuffix(".a");
|
||||
if (part.startsWith(mingwPrefix) && part.endsWith(mingwSuffix))
|
||||
dllName = part.chopped(mingwSuffix.length())
|
||||
.sliced(mingwPrefix.length())
|
||||
.append(".dll");
|
||||
}
|
||||
|
||||
if (!tmp.isEmpty() && tmp.isDir()) {
|
||||
// f.role is libraryPath or frameworkPath
|
||||
@@ -349,6 +356,7 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
||||
}
|
||||
}
|
||||
ct.libraryDirectories = filteredUnique(librarySeachPaths);
|
||||
qCInfo(cmakeLogger) << "libraryDirectories for target" << ct.title << ":" << ct.libraryDirectories;
|
||||
}
|
||||
return ct;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user