diff options
Diffstat (limited to 'Source/cmServerProtocol.cxx')
-rw-r--r-- | Source/cmServerProtocol.cxx | 69 |
1 files changed, 11 insertions, 58 deletions
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index cfac513..ad66467 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -11,7 +11,6 @@ #include "cmInstallGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmLinkLineComputer.h" -#include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmProperty.h" @@ -692,6 +691,8 @@ static Json::Value DumpSourceFilesList( std::vector<cmSourceFile*> files; target->GetSourceFiles(files, config); + cmGeneratorExpressionInterpreter genexInterpreter( + target->GetLocalGenerator(), target, config); std::unordered_map<LanguageData, std::vector<std::string>> fileGroups; for (cmSourceFile* file : files) { @@ -703,21 +704,23 @@ static Json::Value DumpSourceFilesList( std::string compileFlags = ld.Flags; if (const char* cflags = file->GetProperty("COMPILE_FLAGS")) { - cmGeneratorExpression ge; - auto cge = ge.Parse(cflags); - const char* processed = - cge->Evaluate(target->GetLocalGenerator(), config); - lg->AppendFlags(compileFlags, processed); + lg->AppendFlags(compileFlags, genexInterpreter.Evaluate(cflags)); } fileData.Flags = compileFlags; fileData.IncludePathList = ld.IncludePathList; std::set<std::string> defines; - lg->AppendDefines(defines, file->GetProperty("COMPILE_DEFINITIONS")); + if (const char* defs = file->GetProperty("COMPILE_DEFINITIONS")) { + lg->AppendDefines(defines, genexInterpreter.Evaluate(defs)); + } + const std::string defPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); - lg->AppendDefines(defines, file->GetProperty(defPropName)); + if (const char* config_defs = file->GetProperty(defPropName)) { + lg->AppendDefines(defines, genexInterpreter.Evaluate(config_defs)); + } + defines.insert(ld.Defines.begin(), ld.Defines.end()); fileData.SetDefines(defines); @@ -740,37 +743,6 @@ static Json::Value DumpSourceFilesList( return result; } -static Json::Value DumpBacktrace(const cmListFileBacktrace& backtrace) -{ - Json::Value result = Json::arrayValue; - - cmListFileBacktrace backtraceCopy = backtrace; - while (!backtraceCopy.Top().FilePath.empty()) { - Json::Value entry = Json::objectValue; - entry[kPATH_KEY] = backtraceCopy.Top().FilePath; - if (backtraceCopy.Top().Line) { - entry[kLINE_NUMBER_KEY] = static_cast<int>(backtraceCopy.Top().Line); - } - if (!backtraceCopy.Top().Name.empty()) { - entry[kNAME_KEY] = backtraceCopy.Top().Name; - } - result.append(entry); - backtraceCopy = backtraceCopy.Pop(); - } - return result; -} - -static void DumpBacktraceRange(Json::Value& result, const std::string& type, - cmBacktraceRange range) -{ - for (auto const& bt : range) { - Json::Value obj = Json::objectValue; - obj[kTYPE_KEY] = type; - obj[kBACKTRACE_KEY] = DumpBacktrace(bt); - result.append(obj); - } -} - static Json::Value DumpCTestInfo(cmTest* testInfo) { Json::Value result = Json::objectValue; @@ -795,9 +767,6 @@ static Json::Value DumpCTestInfo(cmTest* testInfo) } result[kPROPERTIES_KEY] = properties; - // Need backtrace to figure out where this test was originally added - result[kBACKTRACE_KEY] = DumpBacktrace(testInfo->GetBacktrace()); - return result; } @@ -929,22 +898,6 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, result[kINSTALL_PATHS] = installPaths; } - Json::Value crossRefs = Json::objectValue; - crossRefs[kBACKTRACE_KEY] = DumpBacktrace(target->Target->GetBacktrace()); - - Json::Value statements = Json::arrayValue; - DumpBacktraceRange(statements, "target_compile_definitions", - target->Target->GetCompileDefinitionsBacktraces()); - DumpBacktraceRange(statements, "target_include_directories", - target->Target->GetIncludeDirectoriesBacktraces()); - DumpBacktraceRange(statements, "target_compile_options", - target->Target->GetCompileOptionsBacktraces()); - DumpBacktraceRange(statements, "target_link_libraries", - target->Target->GetLinkImplementationBacktraces()); - - crossRefs[kRELATED_STATEMENTS_KEY] = std::move(statements); - result[kTARGET_CROSS_REFERENCES_KEY] = std::move(crossRefs); - if (target->HaveWellDefinedOutputFiles()) { Json::Value artifacts = Json::arrayValue; artifacts.append( |