Changeset View
Changeset View
Standalone View
Standalone View
plugins/cmake/cmakeimportjsonjob.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 78 | foreach(const QJsonValue& value, document.array()) { | |||
---|---|---|---|---|---|
89 | PathResolutionResult result = resolver.processOutput(entry[KEY_COMMAND].toString(), entry[KEY_DIRECTORY].toString()); | 89 | PathResolutionResult result = resolver.processOutput(entry[KEY_COMMAND].toString(), entry[KEY_DIRECTORY].toString()); | ||
90 | 90 | | |||
91 | auto convert = [rt](const Path &path) { return rt->pathInHost(path); }; | 91 | auto convert = [rt](const Path &path) { return rt->pathInHost(path); }; | ||
92 | 92 | | |||
93 | CMakeFile ret; | 93 | CMakeFile ret; | ||
94 | ret.includes = kTransform<Path::List>(result.paths, convert); | 94 | ret.includes = kTransform<Path::List>(result.paths, convert); | ||
95 | ret.frameworkDirectories = kTransform<Path::List>(result.frameworkDirectories, convert); | 95 | ret.frameworkDirectories = kTransform<Path::List>(result.frameworkDirectories, convert); | ||
96 | ret.defines = result.defines; | 96 | ret.defines = result.defines; | ||
97 | const Path path(rt->pathInHost(Path(entry[KEY_FILE].toString()))); | 97 | const Path path(rt->pathInHost(Path((QFileInfo(entry[KEY_FILE].toString()).canonicalFilePath())))); | ||
98 | qCDebug(CMAKE) << "entering..." << path << entry[KEY_FILE]; | 98 | qCDebug(CMAKE) << "entering..." << path << entry[KEY_FILE]; | ||
99 | data.files[path] = ret; | 99 | data.files[path] = ret; | ||
100 | } | 100 | } | ||
101 | 101 | | |||
102 | data.isValid = true; | 102 | data.isValid = true; | ||
103 | return data; | 103 | return data; | ||
104 | } | 104 | } | ||
105 | 105 | | |||
Show All 31 Lines | |||||
137 | { | 137 | { | ||
138 | auto commandsFile = CMake::commandsFile(project()); | 138 | auto commandsFile = CMake::commandsFile(project()); | ||
139 | if (!QFileInfo::exists(commandsFile.toLocalFile())) { | 139 | if (!QFileInfo::exists(commandsFile.toLocalFile())) { | ||
140 | qCWarning(CMAKE) << "Could not import CMake project" << project()->path() << "('compile_commands.json' missing)"; | 140 | qCWarning(CMAKE) << "Could not import CMake project" << project()->path() << "('compile_commands.json' missing)"; | ||
141 | emitResult(); | 141 | emitResult(); | ||
142 | return; | 142 | return; | ||
143 | } | 143 | } | ||
144 | 144 | | |||
145 | const Path currentBuildDir = CMake::currentBuildDir(m_project); | 145 | const Path currentBuildDir = CMake::currentBuildDir(m_project, true); | ||
146 | Q_ASSERT (!currentBuildDir.isEmpty()); | 146 | Q_ASSERT (!currentBuildDir.isEmpty()); | ||
147 | 147 | | |||
148 | const Path targetsFilePath = CMake::targetDirectoriesFile(m_project); | 148 | const Path targetsFilePath = CMake::targetDirectoriesFile(m_project); | ||
149 | const QString sourceDir = m_project->path().toLocalFile(); | 149 | const QString sourceDir = m_project->path().toLocalFile(); | ||
150 | auto rt = ICore::self()->runtimeController()->currentRuntime(); | 150 | auto rt = ICore::self()->runtimeController()->currentRuntime(); | ||
151 | 151 | | |||
152 | auto future = QtConcurrent::run(import, commandsFile, targetsFilePath, sourceDir, rt->pathInRuntime(currentBuildDir)); | 152 | auto future = QtConcurrent::run(import, commandsFile, targetsFilePath, sourceDir, rt->pathInRuntime(currentBuildDir)); | ||
153 | m_futureWatcher.setFuture(future); | 153 | m_futureWatcher.setFuture(future); | ||
Show All 33 Lines |