diff --git a/app/kdevelopui.rc b/app/kdevelopui.rc --- a/app/kdevelopui.rc +++ b/app/kdevelopui.rc @@ -1,5 +1,5 @@ - - + + @@ -34,6 +34,7 @@ + Examine Core File @@ -54,6 +55,9 @@ + + + @@ -179,6 +183,7 @@ + @@ -189,6 +194,7 @@ + diff --git a/languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp b/languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp --- a/languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp +++ b/languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -120,6 +122,16 @@ return QString(); } +Path::List runtimePathsInHost(const Path::List& runtimePaths) +{ + Path::List ret; + ret.reserve(runtimePaths.count()); + const auto rt = ICore::self()->runtimeController()->currentRuntime(); + for(const auto& runtimePath: runtimePaths) + ret += rt->pathInHost(runtimePath); + return ret; +} + } K_PLUGIN_FACTORY_WITH_JSON(DefinesAndIncludesManagerFactory, "kdevdefinesandincludesmanager.json", registerPlugin(); ) @@ -214,7 +226,7 @@ includes += m_noProjectIPM->includesAndDefines(item->path().path()).first; - return includes; + return runtimePathsInHost(includes); } Path::List DefinesAndIncludesManager::frameworkDirectories( ProjectBaseItem* item, Type type ) const @@ -240,7 +252,7 @@ } } - return frameworkDirectories; + return runtimePathsInHost(frameworkDirectories); } bool DefinesAndIncludesManager::unregisterProvider(IDefinesAndIncludesManager::Provider* provider) @@ -273,13 +285,13 @@ Path::List DefinesAndIncludesManager::includes(const QString& path) const { - return m_settings->provider()->includes(nullptr) - + m_noProjectIPM->includesAndDefines(path).first; + return runtimePathsInHost(m_settings->provider()->includes(nullptr) + + m_noProjectIPM->includesAndDefines(path).first); } Path::List DefinesAndIncludesManager::frameworkDirectories(const QString& /* path */) const { - return m_settings->provider()->frameworkDirectories(nullptr); + return runtimePathsInHost(m_settings->provider()->frameworkDirectories(nullptr)); } void DefinesAndIncludesManager::openConfigurationDialog(const QString& pathToFile) @@ -299,7 +311,7 @@ includes += provider->includesInBackground(path); } - return includes; + return runtimePathsInHost(includes); } Path::List DefinesAndIncludesManager::frameworkDirectoriesInBackground(const QString& path) const @@ -310,7 +322,7 @@ fwDirs += provider->frameworkDirectoriesInBackground(path); } - return fwDirs; + return runtimePathsInHost(fwDirs); } Defines DefinesAndIncludesManager::definesInBackground(const QString& path) const diff --git a/projectmanagers/cmake/cmakemanager.h b/projectmanagers/cmake/cmakemanager.h --- a/projectmanagers/cmake/cmakemanager.h +++ b/projectmanagers/cmake/cmakemanager.h @@ -56,6 +56,7 @@ class ParseJob; class ContextMenuExtension; class Context; + class IRuntime; } class CMakeFolderItem; @@ -150,6 +151,7 @@ // void filesystemBuffererTimeout(); private: + void reloadProjects(); CMakeFile fileInformation(KDevelop::ProjectBaseItem* item) const; void folderAdded(KDevelop::ProjectFolderItem* folder); diff --git a/projectmanagers/cmake/cmakemanager.cpp b/projectmanagers/cmake/cmakemanager.cpp --- a/projectmanagers/cmake/cmakemanager.cpp +++ b/projectmanagers/cmake/cmakemanager.cpp @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include #include #include @@ -91,6 +93,7 @@ new CodeCompletion(this, new CMakeCodeCompletionModel(this), name()); connect(ICore::self()->projectController(), &IProjectController::projectClosing, this, &CMakeManager::projectClosing); + connect(ICore::self()->runtimeController(), &IRuntimeController::currentRuntimeChanged, this, &CMakeManager::reloadProjects); connect(this, &KDevelop::AbstractFileManagerPlugin::folderAdded, this, &CMakeManager::folderAdded); // m_fileSystemChangeTimer = new QTimer(this); @@ -945,4 +948,12 @@ return nullptr; } +void CMakeManager::reloadProjects() +{ + for(IProject* project: m_projects.keys()) { + CMake::checkForNeedingConfigure(project); + reload(project->projectItem()); + } +} + #include "cmakemanager.moc" diff --git a/projectmanagers/cmake/cmakeserver.cpp b/projectmanagers/cmake/cmakeserver.cpp --- a/projectmanagers/cmake/cmakeserver.cpp +++ b/projectmanagers/cmake/cmakeserver.cpp @@ -21,6 +21,11 @@ #include "cmakeserver.h" #include "cmakeprojectdata.h" #include "cmakeutils.h" + +#include +#include +#include + #include #include #include @@ -69,7 +74,9 @@ m_localSocket->connectToServer(path, QIODevice::ReadWrite); }); }); - m_process.start(CMake::findExecutable(), {"-E", "server", "--experimental", "--pipe=" + path}); + m_process.setProgram(CMake::findExecutable()); + m_process.setArguments({"-E", "server", "--experimental", "--pipe=" + path}); + KDevelop::ICore::self()->runtimeController()->currentRuntime()->startProcess(&m_process); } CMakeServer::~CMakeServer() diff --git a/projectmanagers/cmake/cmakeutils.cpp b/projectmanagers/cmake/cmakeutils.cpp --- a/projectmanagers/cmake/cmakeutils.cpp +++ b/projectmanagers/cmake/cmakeutils.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include @@ -182,8 +184,9 @@ ///NOTE: when you change this, update @c defaultConfigure in cmakemanagertest.cpp bool checkForNeedingConfigure( KDevelop::IProject* project ) { + const QString currentRuntime = ICore::self()->runtimeController()->currentRuntime()->name(); const KDevelop::Path builddir = currentBuildDir(project); - const bool isValid = builddir.isValid(); + const bool isValid = (buildDirRuntime(project, -1) == currentRuntime || buildDirRuntime(project, -1).isEmpty()) && builddir.isValid(); if( !isValid ) { @@ -228,16 +231,19 @@ CMake::setCurrentCMakeExecutable(project, bd.cmakeExecutable()); CMake::setCurrentEnvironment( project, QString() ); } + setBuildDirRuntime( project, currentRuntime ); return true; } else if( !QFile::exists( KDevelop::Path(builddir, QStringLiteral("CMakeCache.txt")).toLocalFile() ) || //TODO: maybe we could use the builder for that? !(QFile::exists( KDevelop::Path(builddir, QStringLiteral("Makefile")).toLocalFile() ) || QFile::exists( KDevelop::Path(builddir, QStringLiteral("build.ninja")).toLocalFile() ) ) ) { // User entered information already, but cmake hasn't actually been run yet. + setBuildDirRuntime( project, currentRuntime ); return true; } + setBuildDirRuntime( project, currentRuntime ); return false; }