Commit cec4b86f authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'server-codemodel-install-dest'

296eb9ad

 cmake-server: Add target install destinations to codemodel
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1382
parents 74705612 296eb9ad
Pipeline #78436 passed with stage
in 0 seconds
......@@ -458,6 +458,8 @@ Each project object can have the following keys:
"name"
contains the (sub-)projects name.
"hasInstallRule"
true if the project contains any install rules, false otherwise.
"sourceDirectory"
contains the current source directory
"buildDirectory"
......@@ -481,6 +483,10 @@ Each target object can have the following keys:
contains the current source directory.
"buildDirectory"
contains the current build directory.
"hasInstallRule"
true if the target contains any install rules, false otherwise.
"installPaths"
full path to the destination directories defined by target install rules.
"artifacts"
with a list of build artifacts. The list is sorted with the most
important artifacts first (e.g. a .DLL file is listed before a
......
......@@ -665,6 +665,10 @@ public:
{
return this->InstallGenerators;
}
const std::vector<cmInstallGenerator*>& GetInstallGenerators() const
{
return this->InstallGenerators;
}
void AddTestGenerator(cmTestGenerator* g)
{
......
......@@ -88,6 +88,8 @@ static const std::string kWARN_UNUSED_CLI_KEY = "warnUnusedCli";
static const std::string kWARN_UNUSED_KEY = "warnUnused";
static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories";
static const std::string kWATCHED_FILES_KEY = "watchedFiles";
static const std::string kHAS_INSTALL_RULE = "hasInstallRule";
static const std::string kINSTALL_PATHS = "installPaths";
static const std::string kTARGET_CROSS_REFERENCES_KEY = "crossReferences";
static const std::string kLINE_NUMBER_KEY = "line";
......
......@@ -8,6 +8,8 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmInstallGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmLinkLineComputer.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
......@@ -30,6 +32,7 @@
#include <functional>
#include <limits>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
......@@ -252,7 +255,7 @@ bool cmServerProtocol::DoActivate(const cmServerRequest& /*request*/,
std::pair<int, int> cmServerProtocol1::ProtocolVersion() const
{
return std::make_pair(1, 1);
return std::make_pair(1, 2);
}
static void setErrorMessage(std::string* errorMessage, const std::string& text)
......@@ -797,6 +800,34 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
result[kFULL_NAME_KEY] = target->GetFullName(config);
if (target->Target->GetHaveInstallRule()) {
result[kHAS_INSTALL_RULE] = true;
Json::Value installPaths = Json::arrayValue;
auto targetGenerators = target->Makefile->GetInstallGenerators();
for (auto installGenerator : targetGenerators) {
auto installTargetGenerator =
dynamic_cast<cmInstallTargetGenerator*>(installGenerator);
if (installTargetGenerator != nullptr &&
installTargetGenerator->GetTarget()->Target == target->Target) {
auto dest = installTargetGenerator->GetDestination(config);
std::string installPath;
if (!dest.empty() && cmSystemTools::FileIsFullPath(dest.c_str())) {
installPath = dest;
} else {
std::string installPrefix =
target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
installPath = installPrefix + '/' + dest;
}
installPaths.append(installPath);
}
}
result[kINSTALL_PATHS] = installPaths;
}
Json::Value crossRefs = Json::objectValue;
crossRefs[kBACKTRACE_KEY] = DumpBacktrace(target->Target->GetBacktrace());
......@@ -933,6 +964,7 @@ static Json::Value DumpProjectList(const cmake* cm, std::string const& config)
// Project structure information:
const cmMakefile* mf = lg->GetMakefile();
pObj[kHAS_INSTALL_RULE] = mf->GetInstallGenerators().empty() == false;
pObj[kSOURCE_DIRECTORY_KEY] = mf->GetCurrentSourceDirectory();
pObj[kBUILD_DIRECTORY_KEY] = mf->GetCurrentBinaryDirectory();
pObj[kTARGETS_KEY] = DumpTargetsList(projectIt.second, config);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment