diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 172 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.h | 11 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 12 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 2 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 42 |
8 files changed, 232 insertions, 29 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7624680..8290ba3 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 7) -set(CMake_VERSION_PATCH 20170125) +set(CMake_VERSION_PATCH 20170127) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index c868a14..e23b1b9 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -62,6 +62,13 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct( } else if ((pos = dependence.find('>')) != std::string::npos) { Compare.Type = CompareGreater; Compare.Value = dependence.substr(pos + 1); + } else if ((pos = dependence.find('-')) != std::string::npos) { + Compare.Type = CompareNone; + Compare.Value = dependence.substr(pos + 1); + } + size_t dashPos = dependence.find('-'); + if (dashPos != std::string::npos) { + pos = dashPos; } Name = pos == std::string::npos ? dependence : dependence.substr(0, pos); } @@ -74,6 +81,10 @@ std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const std::string result = Name; + if (Compare.Type != CompareNone || !Compare.Value.empty()) { + result += "-"; + } + if (Compare.Type == CompareLessOrEqual) { result += "<="; } else if (Compare.Type == CompareGreaterOrEqual) { @@ -154,11 +165,14 @@ void cmCPackIFWPackage::DefaultConfiguration() Script = ""; Licenses.clear(); UserInterfaces.clear(); + Translations.clear(); SortingPriority = ""; + UpdateText = ""; Default = ""; Essential = ""; Virtual = ""; ForcedInstallation = ""; + RequiresAdminRights = ""; } // Defaul configuration (all in one package) @@ -245,24 +259,6 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) } } - // QtIFW dependencies - if (const char* option = this->GetOption(prefix + "DEPENDS")) { - std::vector<std::string> deps; - cmSystemTools::ExpandListArgument(option, deps); - for (std::vector<std::string>::iterator dit = deps.begin(); - dit != deps.end(); ++dit) { - DependenceStruct dep(*dit); - if (!Generator->Packages.count(dep.Name)) { - bool hasDep = Generator->DependentPackages.count(dep.Name) > 0; - DependenceStruct& depRef = Generator->DependentPackages[dep.Name]; - if (!hasDep) { - depRef = dep; - } - AlienDependencies.insert(&depRef); - } - } - } - // Licenses if (const char* option = this->GetOption(prefix + "LICENSES")) { Licenses.clear(); @@ -280,6 +276,11 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) // Priority if (const char* option = this->GetOption(prefix + "PRIORITY")) { SortingPriority = option; + cmCPackLogger( + cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set " + << "for component \"" << component->Name << "\", but there option is " + << "deprecated. Please use \"SORTING_PRIORITY\" option instead." + << std::endl); } // Default @@ -352,6 +353,12 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) // Priority if (const char* option = this->GetOption(prefix + "PRIORITY")) { SortingPriority = option; + cmCPackLogger( + cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set " + << "for component group \"" << group->Name + << "\", but there option is " + << "deprecated. Please use \"SORTING_PRIORITY\" option instead." + << std::endl); } return ConfigureFromPrefix(prefix); @@ -420,6 +427,79 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) ReleaseDate = value; } + // Sorting priority + option = prefix + "SORTING_PRIORITY"; + if (IsSetToEmpty(option)) { + SortingPriority.clear(); + } else if (const char* value = GetOption(option)) { + SortingPriority = value; + } + + // Update text + option = prefix + "UPDATE_TEXT"; + if (IsSetToEmpty(option)) { + UpdateText.clear(); + } else if (const char* value = GetOption(option)) { + UpdateText = value; + } + + // Translations + option = prefix + "TRANSLATIONS"; + if (IsSetToEmpty(option)) { + Translations.clear(); + } else if (const char* value = this->GetOption(option)) { + Translations.clear(); + cmSystemTools::ExpandListArgument(value, Translations); + } + + // QtIFW dependencies + std::vector<std::string> deps; + option = prefix + "DEPENDS"; + if (const char* value = this->GetOption(option)) { + cmSystemTools::ExpandListArgument(value, deps); + } + option = prefix + "DEPENDENCIES"; + if (const char* value = this->GetOption(option)) { + cmSystemTools::ExpandListArgument(value, deps); + } + for (std::vector<std::string>::iterator dit = deps.begin(); + dit != deps.end(); ++dit) { + DependenceStruct dep(*dit); + if (Generator->Packages.count(dep.Name)) { + cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name]; + dep.Name = depPkg.Name; + } + bool hasDep = Generator->DependentPackages.count(dep.Name) > 0; + DependenceStruct& depRef = Generator->DependentPackages[dep.Name]; + if (!hasDep) { + depRef = dep; + } + AlienDependencies.insert(&depRef); + } + + // Automatic dependency on + option = prefix + "AUTO_DEPEND_ON"; + if (IsSetToEmpty(option)) { + AlienAutoDependOn.clear(); + } else if (const char* value = this->GetOption(option)) { + std::vector<std::string> depsOn; + cmSystemTools::ExpandListArgument(value, depsOn); + for (std::vector<std::string>::iterator dit = depsOn.begin(); + dit != depsOn.end(); ++dit) { + DependenceStruct dep(*dit); + if (Generator->Packages.count(dep.Name)) { + cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name]; + dep.Name = depPkg.Name; + } + bool hasDep = Generator->DependentPackages.count(dep.Name) > 0; + DependenceStruct& depRef = Generator->DependentPackages[dep.Name]; + if (!hasDep) { + depRef = dep; + } + AlienAutoDependOn.insert(&depRef); + } + } + // Visibility option = prefix + "VIRTUAL"; if (IsSetToEmpty(option)) { @@ -455,6 +535,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) ForcedInstallation = "false"; } + // Requires admin rights + option = prefix + "REQUIRES_ADMIN_RIGHTS"; + if (IsSetToEmpty(option)) { + RequiresAdminRights.clear(); + } else if (IsOn(option)) { + RequiresAdminRights = "true"; + } else if (IsSetToOff(option)) { + RequiresAdminRights = "false"; + } + return 1; } @@ -481,6 +571,12 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.Element("DisplayName", DisplayName); xout.Element("Description", Description); + + // Update text + if (!UpdateText.empty()) { + xout.Element("UpdateText", UpdateText); + } + xout.Element("Name", Name); xout.Element("Version", Version); @@ -515,6 +611,23 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.EndElement(); } + // Translations (copy to meta dir) + std::vector<std::string> translations = Translations; + for (size_t i = 0; i < translations.size(); i++) { + std::string name = cmSystemTools::GetFilenameName(translations[i]); + std::string path = Directory + "/meta/" + name; + cmsys::SystemTools::CopyFileIfDifferent(translations[i].data(), + path.data()); + translations[i] = name; + } + if (!translations.empty()) { + xout.StartElement("Translations"); + for (size_t i = 0; i < translations.size(); i++) { + xout.Element("Translation", translations[i]); + } + xout.EndElement(); + } + // Dependencies std::set<DependenceStruct> compDepSet; for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin(); @@ -538,6 +651,25 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.Element("Dependencies", dependencies.str()); } + // Automatic dependency on + std::set<DependenceStruct> compAutoDepSet; + for (std::set<DependenceStruct*>::iterator ait = AlienAutoDependOn.begin(); + ait != AlienAutoDependOn.end(); ++ait) { + compAutoDepSet.insert(*(*ait)); + } + // Write automatic dependency on + if (!compAutoDepSet.empty()) { + std::ostringstream dependencies; + std::set<DependenceStruct>::iterator it = compAutoDepSet.begin(); + dependencies << it->NameWithCompare(); + ++it; + while (it != compAutoDepSet.end()) { + dependencies << "," << it->NameWithCompare(); + ++it; + } + xout.Element("AutoDependOn", dependencies.str()); + } + // Licenses (copy to meta dir) std::vector<std::string> licenses = Licenses; for (size_t i = 1; i < licenses.size(); i += 2) { @@ -561,6 +693,10 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.Element("ForcedInstallation", ForcedInstallation); } + if (!RequiresAdminRights.empty()) { + xout.Element("RequiresAdminRights", RequiresAdminRights); + } + if (!Virtual.empty()) { xout.Element("Virtual", Virtual); } else if (!Default.empty()) { diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 76ed540..bd1d6c5 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -92,9 +92,15 @@ public: /// List of pages to load std::vector<std::string> UserInterfaces; + /// List of translation files to load + std::vector<std::string> Translations; + /// Priority of the component in the tree std::string SortingPriority; + /// Description added to the component description + std::string UpdateText; + /// Set to true to preselect the component in the installer std::string Default; @@ -107,6 +113,9 @@ public: /// Determines that the package must always be installed std::string ForcedInstallation; + /// Package needs to be installed with elevated permissions + std::string RequiresAdminRights; + public: // Internal implementation @@ -139,6 +148,8 @@ public: std::set<cmCPackIFWPackage*> Dependencies; // Collection of unresolved dependencies std::set<DependenceStruct*> AlienDependencies; + // Collection of unresolved automatic dependency on + std::set<DependenceStruct*> AlienAutoDependOn; // Patch to package directory std::string Directory; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index a062e64..620e237 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -607,9 +607,13 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterDynamicOptions.push_back("-E"); this->MemoryTesterDynamicOptions.push_back("env"); std::string envVar; - std::string extraOptions = ":" + - this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions"); + std::string extraOptions; std::string suppressionsOption; + if (!this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions") + .empty()) { + extraOptions = ":" + + this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions"); + } if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") .empty()) { suppressionsOption = ":suppressions=" + @@ -631,8 +635,10 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() cmCTestMemCheckHandler::UB_SANITIZER) { envVar = "UBSAN_OPTIONS"; } + // Quote log_path with single quotes; see + // https://bugs.chromium.org/p/chromium/issues/detail?id=467936 std::string outputFile = - envVar + "=log_path=\"" + this->MemoryTesterOutputFile + "\""; + envVar + "=log_path='" + this->MemoryTesterOutputFile + "'"; this->MemoryTesterEnvironmentVariable = outputFile + suppressionsOption + extraOptions; break; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 379ae16..866c132 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -631,7 +631,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( const char* iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); std::string const tidy_prop = lang + "_CLANG_TIDY"; const char* tidy = this->GeneratorTarget->GetProperty(tidy_prop); - if ((iwyu && *iwyu) || (tidy && *tidy)) { + std::string const cpplint_prop = lang + "_CPPLINT"; + const char* cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); + if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint)) { std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_iwyu"; if (iwyu && *iwyu) { run_iwyu += " --iwyu="; @@ -640,6 +642,12 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( if (tidy && *tidy) { run_iwyu += " --tidy="; run_iwyu += this->LocalGenerator->EscapeForShell(tidy); + } + if (cpplint && *cpplint) { + run_iwyu += " --cpplint="; + run_iwyu += this->LocalGenerator->EscapeForShell(cpplint); + } + if ((tidy && *tidy) || (cpplint && *cpplint)) { run_iwyu += " --source="; run_iwyu += sourceFile; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 8ad2efe..0b33b19 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -600,7 +600,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) const char* iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); std::string const tidy_prop = lang + "_CLANG_TIDY"; const char* tidy = this->GeneratorTarget->GetProperty(tidy_prop); - if ((iwyu && *iwyu) || (tidy && *tidy)) { + std::string const cpplint_prop = lang + "_CPPLINT"; + const char* cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); + if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint)) { std::string run_iwyu = this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); run_iwyu += " -E __run_iwyu"; @@ -611,6 +613,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) if (tidy && *tidy) { run_iwyu += " --tidy="; run_iwyu += this->GetLocalGenerator()->EscapeForShell(tidy); + } + if (cpplint && *cpplint) { + run_iwyu += " --cpplint="; + run_iwyu += this->GetLocalGenerator()->EscapeForShell(cpplint); + } + if ((tidy && *tidy) || (cpplint && *cpplint)) { run_iwyu += " --source=$in"; } run_iwyu += " -- "; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d825e5c..8c62c48 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -255,6 +255,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("MACOSX_RPATH", CM_NULLPTR); this->SetPropertyDefault("C_CLANG_TIDY", CM_NULLPTR); this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR); + this->SetPropertyDefault("C_CPPLINT", CM_NULLPTR); this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", CM_NULLPTR); this->SetPropertyDefault("LINK_WHAT_YOU_USE", CM_NULLPTR); this->SetPropertyDefault("C_STANDARD", CM_NULLPTR); @@ -262,6 +263,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("C_EXTENSIONS", CM_NULLPTR); this->SetPropertyDefault("CXX_CLANG_TIDY", CM_NULLPTR); this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", CM_NULLPTR); + this->SetPropertyDefault("CXX_CPPLINT", CM_NULLPTR); this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", CM_NULLPTR); this->SetPropertyDefault("CXX_STANDARD", CM_NULLPTR); this->SetPropertyDefault("CXX_STANDARD_REQUIRED", CM_NULLPTR); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5b12a75..823b38f 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -276,7 +276,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) if (args[1] == "__run_iwyu") { if (args.size() < 3) { std::cerr << "__run_iwyu Usage: -E __run_iwyu [--iwyu=/path/iwyu]" - " [--tidy=/path/tidy] -- compile command\n"; + " [--cpplint=/path/cpplint] [--tidy=/path/tidy]" + " -- compile command\n"; return 1; } bool doing_options = true; @@ -285,6 +286,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) std::string tidy; std::string sourceFile; std::string lwyu; + std::string cpplint; for (std::string::size_type cc = 2; cc < args.size(); cc++) { std::string const& arg = args[cc]; if (arg == "--") { @@ -297,6 +299,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) sourceFile = arg.substr(9); } else if (doing_options && cmHasLiteralPrefix(arg, "--lwyu=")) { lwyu = arg.substr(7); + } else if (doing_options && cmHasLiteralPrefix(arg, "--cpplint=")) { + cpplint = arg.substr(10); } else if (doing_options) { std::cerr << "__run_iwyu given unknown argument: " << arg << "\n"; return 1; @@ -304,12 +308,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) orig_cmd.push_back(arg); } } - if (tidy.empty() && iwyu.empty() && lwyu.empty()) { - std::cerr << "__run_iwyu missing --tidy= or --iwyu=\n"; + if (tidy.empty() && iwyu.empty() && lwyu.empty() && cpplint.empty()) { + std::cerr << "__run_iwyu missing --cpplint=, --iwyu=, --lwyu=, and/or" + " --tidy=\n"; return 1; } - if (!tidy.empty() && sourceFile.empty()) { - std::cerr << "__run_iwyu --tidy= requires --source=\n"; + if ((!cpplint.empty() || !tidy.empty()) && sourceFile.empty()) { + std::cerr << "__run_iwyu --cpplint= and/or __run_iwyu --tidy=" + " require --source=\n"; return 1; } if (orig_cmd.empty() && lwyu.empty()) { @@ -403,6 +409,32 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) std::cerr << "Warning: " << stdOut; } } + + if (!cpplint.empty()) { + // Construct the cpplint command line. + std::vector<std::string> cpplint_cmd; + cmSystemTools::ExpandListArgument(cpplint, cpplint_cmd, true); + cpplint_cmd.push_back(sourceFile); + + // Run the cpplint command line. Capture its output. + std::string stdOut; + if (!cmSystemTools::RunSingleCommand(cpplint_cmd, &stdOut, &stdOut, + &ret, CM_NULLPTR, + cmSystemTools::OUTPUT_NONE)) { + std::cerr << "Error running '" << cpplint_cmd[0] << "': " << stdOut + << "\n"; + return 1; + } + + // Output the output from cpplint to stderr + std::cerr << stdOut; + + // If cpplint exited with an error do the same. + if (ret != 0) { + return ret; + } + } + ret = 0; // Now run the real compiler command and return its result value. if (lwyu.empty() && |