diff options
Diffstat (limited to 'Source')
31 files changed, 1137 insertions, 105 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c01c490..46bdec6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -337,6 +337,8 @@ IF (WIN32) cmGlobalVisualStudio11Generator.cxx cmGlobalVisualStudio11Win64Generator.h cmGlobalVisualStudio11Win64Generator.cxx + cmGlobalVisualStudio11ARMGenerator.h + cmGlobalVisualStudio11ARMGenerator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmGlobalWatcomWMakeGenerator.cxx @@ -423,6 +425,9 @@ SET(CTEST_SRCS cmCTest.cxx CTest/cmCTestConfigureHandler.cxx CTest/cmCTestCoverageCommand.cxx CTest/cmCTestCoverageHandler.cxx + CTest/cmParseMumpsCoverage.cxx + CTest/cmParseCacheCoverage.cxx + CTest/cmParseGTMCoverage.cxx CTest/cmParsePHPCoverage.cxx CTest/cmCTestEmptyBinaryDirectoryCommand.cxx CTest/cmCTestGenericHandler.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d47696b..b02b3a8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_PATCH 8) -SET(CMake_VERSION_TWEAK 20120514) +SET(CMake_VERSION_TWEAK 20120524) #SET(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 87a3b9e..0177653 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -409,8 +409,11 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( std::string>(targetFile,inFileRelative)); } /* If it is not a symlink then do a plain copy */ - else if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(), - filePath.c_str()) ) + else if (!( + cmSystemTools::CopyFileIfDifferent(inFile.c_str(),filePath.c_str()) + && + cmSystemTools::CopyFileTime(inFile.c_str(),filePath.c_str()) + ) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: " << inFile.c_str() << " -> " << filePath.c_str() << std::endl); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 15c02b4..81d3669 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmCTestCoverageHandler.h" #include "cmParsePHPCoverage.h" +#include "cmParseGTMCoverage.h" +#include "cmParseCacheCoverage.h" #include "cmCTest.h" #include "cmake.h" #include "cmMakefile.h" @@ -373,21 +375,29 @@ int cmCTestCoverageHandler::ProcessHandler() } int file_count = 0; file_count += this->HandleGCovCoverage(&cont); + error = cont.Error; if ( file_count < 0 ) { return error; } file_count += this->HandleTracePyCoverage(&cont); + error = cont.Error; if ( file_count < 0 ) { return error; } file_count += this->HandlePHPCoverage(&cont); + error = cont.Error; if ( file_count < 0 ) { return error; } + file_count += this->HandleMumpsCoverage(&cont); error = cont.Error; + if ( file_count < 0 ) + { + return error; + } std::set<std::string> uncovered = this->FindUncoveredFiles(&cont); @@ -751,6 +761,46 @@ int cmCTestCoverageHandler::HandlePHPCoverage( } return static_cast<int>(cont->TotalCoverage.size()); } +//---------------------------------------------------------------------- +int cmCTestCoverageHandler::HandleMumpsCoverage( + cmCTestCoverageHandlerContainer* cont) +{ + // try gtm coverage + cmParseGTMCoverage cov(*cont, this->CTest); + std::string coverageFile = this->CTest->GetBinaryDir() + + "/gtm_coverage.mcov"; + if(cmSystemTools::FileExists(coverageFile.c_str())) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Parsing Cache Coverage: " << coverageFile + << std::endl); + cov.ReadCoverageFile(coverageFile.c_str()); + return static_cast<int>(cont->TotalCoverage.size()); + } + else + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find foobar GTM coverage file: " << coverageFile + << std::endl); + } + cmParseCacheCoverage ccov(*cont, this->CTest); + coverageFile = this->CTest->GetBinaryDir() + + "/cache_coverage.cmcov"; + if(cmSystemTools::FileExists(coverageFile.c_str())) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Parsing Cache Coverage: " << coverageFile + << std::endl); + ccov.ReadCoverageFile(coverageFile.c_str()); + } + else + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find Cache coverage file: " << coverageFile + << std::endl); + } + return static_cast<int>(cont->TotalCoverage.size()); +} struct cmCTestCoverageHandlerLocale { @@ -1806,7 +1856,7 @@ int cmCTestCoverageHandler::HandleBullseyeCoverage( cmCTestCoverageHandlerContainer* cont) { const char* covfile = cmSystemTools::GetEnv("COVFILE"); - if(!covfile) + if(!covfile || strlen(covfile) == 0) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " COVFILE environment variable not found, not running " diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index d3e8503..92b0b22 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -70,6 +70,8 @@ private: //! Handle coverage using xdebug php coverage int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont); + //! Handle coverage for mumps + int HandleMumpsCoverage(cmCTestCoverageHandlerContainer* cont); //! Handle coverage using Bullseye int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont); diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx new file mode 100644 index 0000000..137f344 --- /dev/null +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -0,0 +1,220 @@ +#include "cmStandardIncludes.h" +#include <stdio.h> +#include <stdlib.h> +#include "cmSystemTools.h" +#include "cmParseCacheCoverage.h" +#include <cmsys/Directory.hxx> +#include <cmsys/Glob.hxx> + + +cmParseCacheCoverage::cmParseCacheCoverage( + cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest) + :cmParseMumpsCoverage(cont, ctest) +{ +} + + +bool cmParseCacheCoverage::LoadCoverageData(const char* d) +{ + // load all the .mcov files in the specified directory + cmsys::Directory dir; + if(!dir.Load(d)) + { + return false; + } + size_t numf; + unsigned int i; + numf = dir.GetNumberOfFiles(); + for (i = 0; i < numf; i++) + { + std::string file = dir.GetFile(i); + if(file != "." && file != ".." + && !cmSystemTools::FileIsDirectory(file.c_str())) + { + std::string path = d; + path += "/"; + path += file; + if(cmSystemTools::GetFilenameLastExtension(path) == ".cmcov") + { + if(!this->ReadCMCovFile(path.c_str())) + { + return false; + } + } + } + } + return true; +} + +// not currently used, but leave it in case we want it in the future +void cmParseCacheCoverage::RemoveUnCoveredFiles() +{ + // loop over the coverage data computed and remove all files + // that only have -1 or 0 for the lines. + cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator ci = + this->Coverage.TotalCoverage.begin(); + while(ci != this->Coverage.TotalCoverage.end()) + { + cmCTestCoverageHandlerContainer::SingleFileCoverageVector& v = + ci->second; + bool nothing = true; + for(cmCTestCoverageHandlerContainer::SingleFileCoverageVector::iterator i= + v.begin(); i != v.end(); ++i) + { + if(*i > 0) + { + nothing = false; + break; + } + } + if(nothing) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "No coverage found in: " << ci->first + << std::endl); + this->Coverage.TotalCoverage.erase(ci++); + } + else + { + ++ci; + } + } +} + +bool cmParseCacheCoverage::SplitString(std::vector<std::string>& args, + std::string const& line) +{ + std::string::size_type pos1 = 0; + std::string::size_type pos2 = line.find(',', 0); + if(pos2 == std::string::npos) + { + return false; + } + std::string arg; + while(pos2 != std::string::npos) + { + arg = line.substr(pos1, pos2-pos1); + args.push_back(arg); + pos1 = pos2+1; + pos2 = line.find(',',pos1); + } + arg = line.substr(pos1); + args.push_back(arg); + return true; +} + +bool cmParseCacheCoverage::ReadCMCovFile(const char* file) +{ + std::ifstream in(file); + if(!in) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Can not open : " + << file << "\n"); + return false; + } + std::string line; + std::vector<std::string> separateLine; + if(!cmSystemTools::GetLineFromStream(in, line)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Empty file : " + << file << " referenced in this line of cmcov data:\n" + "[" << line << "]\n"); + return false; + } + separateLine.clear(); + this->SplitString(separateLine, line); + if(separateLine.size() !=4 || separateLine[0] != "Routine" + || separateLine[1] != "Line" || separateLine[2] != "RtnLine" + || separateLine[3] != "Code") + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Bad first line of cmcov file : " + << file << " line:\n" + "[" << line << "]\n"); + } + std::string routine; + std::string filepath; + while(cmSystemTools::GetLineFromStream(in, line)) + { + // clear out line argument vector + separateLine.clear(); + // parse the comma separated line + this->SplitString(separateLine, line); + // might have more because code could have a quoted , in it + // but we only care about the first 3 args anyway + if(separateLine.size() < 4) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Bad line of cmcov file expected at least 4 found: " + << separateLine.size() << " " + << file << " line:\n" + "[" << line << "]\n"); + for(std::string::size_type i = 0; i < separateLine.size(); ++i) + { + cmCTestLog(this->CTest, ERROR_MESSAGE,"" + << separateLine[1] << " "); + } + cmCTestLog(this->CTest, ERROR_MESSAGE, "\n"); + return false; + } + // if we do not have a routine yet, then it should be + // the first argument in the vector + if(routine.size() == 0) + { + routine = separateLine[0]; + // Find the full path to the file + if(!this->FindMumpsFile(routine, filepath)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Could not find mumps file for routine: " + << routine << "\n"); + filepath = ""; + continue; // move to next line + } + } + // if we have a routine name, check for end of routine + else + { + // Totals in arg 0 marks the end of a routine + if(separateLine[0].substr(0, 6) == "Totals") + { + routine = ""; // at the end of this routine + filepath = ""; + continue; // move to next line + } + } + // if the file path was not found for the routine + // move to next line. We should have already warned + // after the call to FindMumpsFile that we did not find + // it, so don't report again to cut down on output + if(filepath.size() == 0) + { + continue; + } + // now we are ready to set the coverage from the line of data + cmCTestCoverageHandlerContainer::SingleFileCoverageVector& + coverageVector = this->Coverage.TotalCoverage[filepath]; + std::string::size_type linenumber = atoi(separateLine[1].c_str()) -1; + int count = atoi(separateLine[2].c_str()); + if(linenumber > coverageVector.size()) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Parse error line is greater than number of lines in file: " + << linenumber << " " << filepath << "\n"); + continue; // skip setting count to avoid crash + } + // now add to count for linenumber + // for some reason the cache coverage adds extra lines to the + // end of the file in some cases. Since they do not exist, we will + // mark them as non executable + while(linenumber >= coverageVector.size()) + { + coverageVector.push_back(-1); + } + coverageVector[linenumber] += count; + } + return true; +} diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h new file mode 100644 index 0000000..114eb92 --- /dev/null +++ b/Source/CTest/cmParseCacheCoverage.h @@ -0,0 +1,42 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmParseCacheCoverage_h +#define cmParseCacheCoverage_h + +#include "cmParseMumpsCoverage.h" + +/** \class cmParseCacheCoverage + * \brief Parse Cache coverage information + * + * This class is used to parse Cache coverage information for + * mumps. + */ +class cmParseCacheCoverage : public cmParseMumpsCoverage +{ +public: + cmParseCacheCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest); +protected: + // implement virtual from parent + bool LoadCoverageData(const char* dir); + // remove files with no coverage + void RemoveUnCoveredFiles(); + // Read a single mcov file + bool ReadCMCovFile(const char* f); + // split a string based on , + bool SplitString(std::vector<std::string>& args, + std::string const& line); +}; + + +#endif diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx new file mode 100644 index 0000000..5dfcfe5 --- /dev/null +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -0,0 +1,272 @@ +#include "cmStandardIncludes.h" +#include <stdio.h> +#include <stdlib.h> +#include "cmSystemTools.h" +#include "cmParseGTMCoverage.h" +#include <cmsys/Directory.hxx> +#include <cmsys/Glob.hxx> + + +cmParseGTMCoverage::cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest) + :cmParseMumpsCoverage(cont, ctest) +{ +} + + +bool cmParseGTMCoverage::LoadCoverageData(const char* d) +{ + // load all the .mcov files in the specified directory + cmsys::Directory dir; + if(!dir.Load(d)) + { + return false; + } + size_t numf; + unsigned int i; + numf = dir.GetNumberOfFiles(); + for (i = 0; i < numf; i++) + { + std::string file = dir.GetFile(i); + if(file != "." && file != ".." + && !cmSystemTools::FileIsDirectory(file.c_str())) + { + std::string path = d; + path += "/"; + path += file; + if(cmSystemTools::GetFilenameLastExtension(path) == ".mcov") + { + if(!this->ReadMCovFile(path.c_str())) + { + return false; + } + } + } + } + return true; +} + +bool cmParseGTMCoverage::ReadMCovFile(const char* file) +{ + std::ifstream in(file); + if(!in) + { + return false; + } + std::string line; + std::string lastfunction; + std::string lastroutine; + std::string lastpath; + int lastoffset = 0; + while( cmSystemTools::GetLineFromStream(in, line)) + { + // only look at lines that have coverage data + if(line.find("^ZZCOVERAGE") == line.npos) + { + continue; + } + std::string filepath; + std::string function; + std::string routine; + int linenumber = 0; + int count = 0; + this->ParseMCOVLine(line, routine, function, linenumber, count); + // skip this one + if(routine == "RSEL") + { + continue; + } + // no need to search the file if we just did it + if(function == lastfunction && lastroutine == routine) + { + if(lastpath.size()) + { + this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber] + += count; + } + else + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Can not find mumps file : " + << lastroutine << + " referenced in this line of mcov data:\n" + "[" << line << "]\n"); + } + continue; + } + // Find the full path to the file + bool found = this->FindMumpsFile(routine, filepath); + if(found) + { + int lineoffset; + if(this->FindFunctionInMumpsFile(filepath, + function, + lineoffset)) + { + cmCTestCoverageHandlerContainer::SingleFileCoverageVector& + coverageVector = this->Coverage.TotalCoverage[filepath]; + coverageVector[lineoffset + linenumber] += count; + } + lastoffset = lineoffset; + } + else + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Can not find mumps file : " + << routine << " referenced in this line of mcov data:\n" + "[" << line << "]\n"); + } + lastfunction = function; + lastroutine = routine; + lastpath = filepath; + } + return true; +} + +bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath, + std::string const& function, + int& lineoffset) +{ + std::ifstream in(filepath.c_str()); + if(!in) + { + return false; + } + std::string line; + int linenum = 0; + while( cmSystemTools::GetLineFromStream(in, line)) + { + std::string::size_type pos = line.find(function.c_str()); + if(pos == 0) + { + char nextchar = line[function.size()]; + if(nextchar == ' ' || nextchar == '(') + { + lineoffset = linenum; + return true; + } + } + if(pos == 1) + { + char prevchar = line[0]; + char nextchar = line[function.size()+1]; + if(prevchar == '%' && (nextchar == ' ' || nextchar == '(')) + { + lineoffset = linenum; + return true; + } + } + linenum++; // move to next line count + } + lineoffset = 0; + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Could not find entry point : " + << function << " in " << filepath << "\n"); + return false; +} + +bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line, + std::string& routine, + std::string& function, + int& linenumber, + int& count) +{ + // this method parses lines from the .mcov file + // each line has ^COVERAGE(...) in it, and there + // are several varients of coverage lines: + // + // ^COVERAGE("DIC11","PR1",0)="2:0:0:0" + // ( file , entry, line ) = "number_executed:timing_info" + // ^COVERAGE("%RSEL","SRC")="1:0:0:0" + // ( file , entry ) = "number_executed:timing_info" + // ^COVERAGE("%RSEL","init",8,"FOR_LOOP",1)=1 + // ( file , entry, line, IGNORE ) =number_executed + std::vector<cmStdString> args; + std::string::size_type pos = line.find('(', 0); + // if no ( is found, then return line has no coverage + if(pos == std::string::npos) + { + return false; + } + std::string arg; + bool done = false; + // separate out all of the comma separated arguments found + // in the COVERAGE(...) line + while(line[pos] && !done) + { + // save the char we are looking at + char cur = line[pos]; + // , or ) means end of argument + if(cur == ',' || cur == ')') + { + // save the argument into the argument vector + args.push_back(arg); + // start on a new argument + arg = ""; + // if we are at the end of the ), then finish while loop + if(cur == ')') + { + done = true; + } + } + else + { + // all chars except ", (, and % get stored in the arg string + if(cur != '\"' && cur != '(' && cur != '%') + { + arg.append(1, line[pos]); + } + } + // move to next char + pos++; + } + // now parse the right hand side of the = + pos = line.find('='); + // no = found, this is an error + if(pos == line.npos) + { + return false; + } + pos++; // move past = + + // if the next positing is not a ", then this is a + // COVERAGE(..)=count line and turn the rest of the string + // past the = into an integer and set it to count + if(line[pos] != '\"') + { + count = atoi(line.substr(pos).c_str()); + } + else + { + // this means line[pos] is a ", and we have a + // COVERAGE(...)="1:0:0:0" type of line + pos++; // move past " + // find the first : past the " + std::string::size_type pos2 = line.find(':', pos); + // turn the string between the " and the first : into an integer + // and set it to count + count = atoi(line.substr(pos, pos2-pos).c_str()); + } + // less then two arguments is an error + if(args.size() < 2) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error parsing mcov line: [" << line << "]\n"); + return false; + } + routine = args[0]; // the routine is the first argument + function = args[1]; // the function in the routine is the second + // in the two argument only format + // ^COVERAGE("%RSEL","SRC"), the line offset is 0 + if(args.size() == 2) + { + linenumber = 0; + } + else + { + // this is the format for this line + // ^COVERAGE("%RSEL","SRC",count) + linenumber = atoi(args[2].c_str()); + } + return true; +} diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h new file mode 100644 index 0000000..c6d7ef9 --- /dev/null +++ b/Source/CTest/cmParseGTMCoverage.h @@ -0,0 +1,49 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmParseGTMCoverage_h +#define cmParseGTMCoverage_h + +#include "cmParseMumpsCoverage.h" + +/** \class cmParseGTMCoverage + * \brief Parse GTM coverage information + * + * This class is used to parse GTM coverage information for + * mumps. + */ +class cmParseGTMCoverage : public cmParseMumpsCoverage +{ +public: + cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest); +protected: + // implement virtual from parent + bool LoadCoverageData(const char* dir); + // Read a single mcov file + bool ReadMCovFile(const char* f); + // find out what line in a mumps file (filepath) the given entry point + // or function is. lineoffset is set by this method. + bool FindFunctionInMumpsFile(std::string const& filepath, + std::string const& function, + int& lineoffset); + // parse a line from a .mcov file, and fill in the + // routine, function, linenumber and coverage count + bool ParseMCOVLine(std::string const& line, + std::string& routine, + std::string& function, + int& linenumber, + int& count); +}; + + +#endif diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx new file mode 100644 index 0000000..37e8bd0 --- /dev/null +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -0,0 +1,165 @@ +#include "cmStandardIncludes.h" +#include <stdio.h> +#include <stdlib.h> +#include "cmSystemTools.h" +#include "cmParseGTMCoverage.h" +#include <cmsys/Directory.hxx> +#include <cmsys/Glob.hxx> + + +cmParseMumpsCoverage::cmParseMumpsCoverage( + cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest) + :Coverage(cont), CTest(ctest) +{ +} + +cmParseMumpsCoverage::~cmParseMumpsCoverage() +{ +} + +bool cmParseMumpsCoverage::ReadCoverageFile(const char* file) +{ + // Read the gtm_coverage.mcov file, that has two lines of data: + // packages:/full/path/to/Vista/Packages + // coverage_dir:/full/path/to/dir/with/*.mcov + std::ifstream in(file); + if(!in) + { + return false; + } + std::string line; + while(cmSystemTools::GetLineFromStream(in, line)) + { + std::string::size_type pos = line.find(':', 0); + std::string packages; + if(pos != std::string::npos) + { + std::string type = line.substr(0, pos); + std::string path = line.substr(pos+1); + if(type == "packages") + { + this->LoadPackages(path.c_str()); + } + else if(type == "coverage_dir") + { + this->LoadCoverageData(path.c_str()); + } + else + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Parse Error in Mumps coverage file :\n" + << file << + "\ntype: [" << type << "]\npath:[" << path << "]\n" + "input line: [" << line << "]\n"); + } + } + } + return true; +} + +void cmParseMumpsCoverage::InitializeMumpsFile(std::string& file) +{ + // initialize the coverage information for a given mumps file + std::ifstream in(file.c_str()); + if(!in) + { + return; + } + std::string line; + cmCTestCoverageHandlerContainer::SingleFileCoverageVector& + coverageVector = this->Coverage.TotalCoverage[file]; + if(!cmSystemTools::GetLineFromStream(in, line)) + { + return; + } + // first line of a .m file can never be run + coverageVector.push_back(-1); + while( cmSystemTools::GetLineFromStream(in, line) ) + { + // putting in a 0 for a line means it is executable code + // putting in a -1 for a line means it is not executable code + int val = -1; // assume line is not executable + bool found = false; + std::string::size_type i = 0; + // (1) Search for the first whitespace or semicolon character on a line. + //This will skip over labels if the line starts with one, or will simply + //be the first character on the line for non-label lines. + for(; i < line.size(); ++i) + { + if(line[i] == ' ' || line[i] == '\t' || line[i] == ';') + { + found = true; + break; + } + } + if(found) + { + // (2) If the first character found above is whitespace then continue the + // search for the first following non-whitespace character. + if(line[i] == ' ' || line[i] == '\t') + { + while(i < line.size() && (line[i] == ' ' || line[i] == '\t')) + { + i++; + } + } + // (3) If the character found is not a semicolon then the line counts for + // coverage. + if(i < line.size() && line[i] != ';') + { + val = 0; + } + } + coverageVector.push_back(val); + } +} + +bool cmParseMumpsCoverage::LoadPackages(const char* d) +{ + cmsys::Glob glob; + glob.RecurseOn(); + std::string pat = d; + pat += "/*.m"; + glob.FindFiles(pat.c_str()); + std::vector<std::string>& files = glob.GetFiles(); + std::vector<std::string>::iterator fileIt; + for ( fileIt = files.begin(); fileIt != files.end(); + ++ fileIt ) + { + std::string name = cmSystemTools::GetFilenameName(*fileIt); + this->RoutineToDirectory[name.substr(0, name.size()-2)] = *fileIt; + // initialze each file, this is left out until CDash is fixed + // to handle large numbers of files + this->InitializeMumpsFile(*fileIt); + } + return true; +} + +bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine, + std::string& filepath) +{ + std::map<cmStdString, cmStdString>::iterator i = + this->RoutineToDirectory.find(routine); + if(i != this->RoutineToDirectory.end()) + { + filepath = i->second; + return true; + } + else + { + // try some alternate names + const char* tryname[] = {"GUX", "GTM", "ONT", 0}; + for(int k=0; tryname[k] != 0; k++) + { + std::string routine2 = routine + tryname[k]; + i = this->RoutineToDirectory.find(routine2); + if(i != this->RoutineToDirectory.end()) + { + filepath = i->second; + return true; + } + } + } + return false; +} diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h new file mode 100644 index 0000000..c1effa7 --- /dev/null +++ b/Source/CTest/cmParseMumpsCoverage.h @@ -0,0 +1,52 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmParseMumpsCoverage_h +#define cmParseMumpsCoverage_h + +#include "cmStandardIncludes.h" +#include "cmCTestCoverageHandler.h" + +/** \class cmParseMumpsCoverage + * \brief Parse Mumps coverage information + * + * This class is used as the base class for Mumps coverage + * parsing. + */ +class cmParseMumpsCoverage +{ +public: + cmParseMumpsCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest); + virtual ~cmParseMumpsCoverage(); + // This is the toplevel coverage file locating the coverage files + // and the mumps source code package tree. + bool ReadCoverageFile(const char* file); +protected: + // sub classes will use this to + // load all coverage files found in the given directory + virtual bool LoadCoverageData(const char* d) = 0; + // search the package directory for mumps files and fill + // in the RoutineToDirectory map + bool LoadPackages(const char* dir); + // initialize the coverage information for a single mumps file + void InitializeMumpsFile(std::string& file); + // Find mumps file for routine + bool FindMumpsFile(std::string const& routine, + std::string& filepath); +protected: + std::map<cmStdString, cmStdString> RoutineToDirectory; + cmCTestCoverageHandlerContainer& Coverage; + cmCTest* CTest; +}; + +#endif diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h index ce5741d..d50a83c 100644 --- a/Source/CTest/cmParsePHPCoverage.h +++ b/Source/CTest/cmParsePHPCoverage.h @@ -37,9 +37,6 @@ private: bool ReadInt(std::ifstream& in, int& v); bool ReadCoverageArray(std::ifstream& in, cmStdString const&); bool ReadUntil(std::ifstream& in, char until); - typedef std::map<int, int> FileLineCoverage; - std::map<cmStdString, FileLineCoverage> FileToCoverage; - std::map<int, int> FileCoverage; cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; }; diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index fb40024..9e33d75 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -523,6 +523,16 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables That Change Behavior"); cm->DefineProperty + ("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME", cmProperty::VARIABLE, + "Default component used in install() commands.", + "If an install() command is used without the COMPONENT argument, " + "these files will be grouped into a default component. The name of this " + "default install component will be taken from this variable. " + "It defaults to \"Unspecified\". ", + false, + "Variables That Change Behavior"); + + cm->DefineProperty ("CMAKE_FIND_LIBRARY_PREFIXES", cmProperty::VARIABLE, "Prefixes to prepend when looking for libraries.", "This specifies what prefixes to add to library names when " diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 9cbd502..328706c 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -385,6 +385,11 @@ void cmGlobalNinjaGenerator::Generate() this->WriteTargetAliases(*this->BuildFileStream); this->WriteBuiltinTargets(*this->BuildFileStream); + if (cmSystemTools::GetErrorOccuredFlag()) { + this->RulesFileStream->setstate(std::ios_base::failbit); + this->BuildFileStream->setstate(std::ios_base::failbit); + } + this->CloseRulesFileStream(); this->CloseBuildFileStream(); } @@ -754,6 +759,8 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os) this->WriteTargetAll(os); this->WriteTargetRebuildManifest(os); + this->WriteTargetClean(os); + this->WriteTargetHelp(os); } void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os) @@ -820,3 +827,43 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) implicitDeps, cmNinjaDeps()); } + +void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) +{ + WriteRule(*this->RulesFileStream, + "CLEAN", + "ninja -t clean", + "Cleaning all built files...", + "Rule for cleaning all built files.", + /*depfile=*/ "", + /*restat=*/ false, + /*generator=*/ false); + WriteBuild(os, + "Clean all the built files.", + "CLEAN", + /*outputs=*/ cmNinjaDeps(1, "clean"), + /*explicitDeps=*/ cmNinjaDeps(), + /*implicitDeps=*/ cmNinjaDeps(), + /*orderOnlyDeps=*/ cmNinjaDeps(), + /*variables=*/ cmNinjaVars()); +} + +void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) +{ + WriteRule(*this->RulesFileStream, + "HELP", + "ninja -t targets", + "All primary targets available:", + "Rule for printing all primary targets available.", + /*depfile=*/ "", + /*restat=*/ false, + /*generator=*/ false); + WriteBuild(os, + "Print all primary targets available.", + "HELP", + /*outputs=*/ cmNinjaDeps(1, "help"), + /*explicitDeps=*/ cmNinjaDeps(), + /*implicitDeps=*/ cmNinjaDeps(), + /*orderOnlyDeps=*/ cmNinjaDeps(), + /*variables=*/ cmNinjaVars()); +} diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 3217581..e652972 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -273,6 +273,8 @@ private: void WriteBuiltinTargets(std::ostream& os); void WriteTargetAll(std::ostream& os); void WriteTargetRebuildManifest(std::ostream& os); + void WriteTargetClean(std::ostream& os); + void WriteTargetHelp(std::ostream& os); /// Called when we have seen the given custom command. Returns true /// if we has seen it before. diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.cxx b/Source/cmGlobalVisualStudio11ARMGenerator.cxx new file mode 100644 index 0000000..fef1aba --- /dev/null +++ b/Source/cmGlobalVisualStudio11ARMGenerator.cxx @@ -0,0 +1,32 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2011 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalVisualStudio11ARMGenerator.h" +#include "cmMakefile.h" +#include "cmake.h" + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio11ARMGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 11 ARM project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio11ARMGenerator +::AddPlatformDefinitions(cmMakefile* mf) +{ + this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf); + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "ARM"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "ARM"); +} diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.h b/Source/cmGlobalVisualStudio11ARMGenerator.h new file mode 100644 index 0000000..77e1429 --- /dev/null +++ b/Source/cmGlobalVisualStudio11ARMGenerator.h @@ -0,0 +1,37 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2011 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGlobalVisualStudio11ARMGenerator_h +#define cmGlobalVisualStudio11ARMGenerator_h + +#include "cmGlobalVisualStudio11Generator.h" + +class cmGlobalVisualStudio11ARMGenerator : + public cmGlobalVisualStudio11Generator +{ +public: + cmGlobalVisualStudio11ARMGenerator() {} + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio11ARMGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio11ARMGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 11 ARM";} + + virtual const char* GetPlatformName() const {return "ARM";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + virtual void AddPlatformDefinitions(cmMakefile* mf); +}; +#endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 998843f..522f3da 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -723,6 +723,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode = "file.xib"; } + else if(ext == "storyboard") + { + sourcecode = "file.storyboard"; + } else if(ext == "mm") { sourcecode += ".cpp.objcpp"; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 4eed477..ffc0f35 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -74,6 +74,13 @@ IsFunctionBlocked(const cmListFileFunction& lff, { this->IsBlocking = this->HasRun; this->HasRun = true; + + // if trace is enabled, print a (trivially) evaluated "else" + // statement + if(!this->IsBlocking && mf.GetCMakeInstance()->GetTrace()) + { + mf.PrintCommandTrace(this->Functions[c]); + } } else if (scopeDepth == 0 && !cmSystemTools::Strucmp (this->Functions[c].Name.c_str(),"elseif")) @@ -88,6 +95,12 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefileCall stack_manager(&mf, this->Functions[c], status); static_cast<void>(stack_manager); + // if trace is enabled, print the evaluated "elseif" statement + if(mf.GetCMakeInstance()->GetTrace()) + { + mf.PrintCommandTrace(this->Functions[c]); + } + std::string errorString; std::vector<std::string> expandedArguments; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index c656487..4016734 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -23,25 +23,25 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target, const cmInstallCommandArguments& args, bool impLib, bool forceOpt = false) { - return new cmInstallTargetGenerator(target, args.GetDestination().c_str(), - impLib, args.GetPermissions().c_str(), + return new cmInstallTargetGenerator(target, args.GetDestination().c_str(), + impLib, args.GetPermissions().c_str(), args.GetConfigurations(), args.GetComponent().c_str(), args.GetOptional() || forceOpt); } static cmInstallFilesGenerator* CreateInstallFilesGenerator( - const std::vector<std::string>& absFiles, + const std::vector<std::string>& absFiles, const cmInstallCommandArguments& args, bool programs) { - return new cmInstallFilesGenerator(absFiles, args.GetDestination().c_str(), - programs, args.GetPermissions().c_str(), + return new cmInstallFilesGenerator(absFiles, args.GetDestination().c_str(), + programs, args.GetPermissions().c_str(), args.GetConfigurations(), args.GetComponent().c_str(), args.GetRename().c_str(), args.GetOptional()); } // cmInstallCommand -bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, +bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { // Allow calling with no arguments so that arguments may be built up @@ -55,6 +55,13 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, this->Makefile->GetLocalGenerator() ->GetGlobalGenerator()->EnableInstallTarget(); + this->DefaultComponentName = this->Makefile->GetSafeDefinition( + "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); + if (this->DefaultComponentName.empty()) + { + this->DefaultComponentName = "Unspecified"; + } + // Switch among the command modes. if(args[0] == "SCRIPT") { @@ -95,7 +102,7 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, //---------------------------------------------------------------------------- bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) { - std::string component("Unspecified"); + std::string component = this->DefaultComponentName; int componentCount = 0; bool doing_script = false; bool doing_code = false; @@ -190,7 +197,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) /*struct InstallPart { - InstallPart(cmCommandArgumentsHelper* helper, const char* key, + InstallPart(cmCommandArgumentsHelper* helper, const char* key, cmCommandArgumentGroup* group); cmCAStringVector argVector; cmInstallCommandArguments args; @@ -222,7 +229,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // ARCHIVE, RUNTIME etc. (see above) // These generic args also contain the targets and the export stuff std::vector<std::string> unknownArgs; - cmInstallCommandArguments genericArgs; + cmInstallCommandArguments genericArgs(this->DefaultComponentName); cmCAStringVector targetList(&genericArgs.Parser, "TARGETS"); cmCAString exports(&genericArgs.Parser,"EXPORT", &genericArgs.ArgumentGroup); targetList.Follows(0); @@ -230,16 +237,16 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs); bool success = genericArgs.Finalize(); - cmInstallCommandArguments archiveArgs; - cmInstallCommandArguments libraryArgs; - cmInstallCommandArguments runtimeArgs; - cmInstallCommandArguments frameworkArgs; - cmInstallCommandArguments bundleArgs; - cmInstallCommandArguments privateHeaderArgs; - cmInstallCommandArguments publicHeaderArgs; - cmInstallCommandArguments resourceArgs; + cmInstallCommandArguments archiveArgs(this->DefaultComponentName); + cmInstallCommandArguments libraryArgs(this->DefaultComponentName); + cmInstallCommandArguments runtimeArgs(this->DefaultComponentName); + cmInstallCommandArguments frameworkArgs(this->DefaultComponentName); + cmInstallCommandArguments bundleArgs(this->DefaultComponentName); + cmInstallCommandArguments privateHeaderArgs(this->DefaultComponentName); + cmInstallCommandArguments publicHeaderArgs(this->DefaultComponentName); + cmInstallCommandArguments resourceArgs(this->DefaultComponentName); - // now parse the args for specific parts of the target (e.g. LIBRARY, + // now parse the args for specific parts of the target (e.g. LIBRARY, // RUNTIME, ARCHIVE etc. archiveArgs.Parse (&archiveArgVector.GetVector(), &unknownArgs); libraryArgs.Parse (&libraryArgVector.GetVector(), &unknownArgs); @@ -345,7 +352,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")); - for(std::vector<std::string>::const_iterator + for(std::vector<std::string>::const_iterator targetIt=targetList.GetVector().begin(); targetIt!=targetList.GetVector().end(); ++targetIt) @@ -422,7 +429,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) case cmTarget::SHARED_LIBRARY: { // Shared libraries are handled differently on DLL and non-DLL - // platforms. All windows platforms are DLL platforms including + // platforms. All windows platforms are DLL platforms including // cygwin. Currently no other platform is a DLL platform. if(dll_platform) { @@ -436,13 +443,13 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) if(!archiveArgs.GetDestination().empty()) { // The import library uses the ARCHIVE properties. - archiveGenerator = CreateInstallTargetGenerator(target, + archiveGenerator = CreateInstallTargetGenerator(target, archiveArgs, true); } if(!runtimeArgs.GetDestination().empty()) { // The DLL uses the RUNTIME properties. - runtimeGenerator = CreateInstallTargetGenerator(target, + runtimeGenerator = CreateInstallTargetGenerator(target, runtimeArgs, false); } if ((archiveGenerator==0) && (runtimeGenerator==0)) @@ -467,7 +474,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Use the FRAMEWORK properties. if (!frameworkArgs.GetDestination().empty()) { - frameworkGenerator = CreateInstallTargetGenerator(target, + frameworkGenerator = CreateInstallTargetGenerator(target, frameworkArgs, false); } else @@ -484,7 +491,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // The shared library uses the LIBRARY properties. if (!libraryArgs.GetDestination().empty()) { - libraryGenerator = CreateInstallTargetGenerator(target, + libraryGenerator = CreateInstallTargetGenerator(target, libraryArgs, false); libraryGenerator->SetNamelinkMode(namelinkMode); namelinkOnly = @@ -507,7 +514,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Static libraries use ARCHIVE properties. if (!archiveArgs.GetDestination().empty()) { - archiveGenerator = CreateInstallTargetGenerator(target, archiveArgs, + archiveGenerator = CreateInstallTargetGenerator(target, archiveArgs, false); } else @@ -525,7 +532,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Modules use LIBRARY properties. if (!libraryArgs.GetDestination().empty()) { - libraryGenerator = CreateInstallTargetGenerator(target, libraryArgs, + libraryGenerator = CreateInstallTargetGenerator(target, libraryArgs, false); libraryGenerator->SetNamelinkMode(namelinkMode); namelinkOnly = @@ -548,7 +555,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Application bundles use the BUNDLE properties. if (!bundleArgs.GetDestination().empty()) { - bundleGenerator = CreateInstallTargetGenerator(target, bundleArgs, + bundleGenerator = CreateInstallTargetGenerator(target, bundleArgs, false); } else if(!runtimeArgs.GetDestination().empty()) @@ -580,7 +587,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Executables use the RUNTIME properties. if (!runtimeArgs.GetDestination().empty()) { - runtimeGenerator = CreateInstallTargetGenerator(target, + runtimeGenerator = CreateInstallTargetGenerator(target, runtimeArgs, false); } else @@ -600,7 +607,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) target.IsExecutableWithExports()) { // The import library uses the ARCHIVE properties. - archiveGenerator = CreateInstallTargetGenerator(target, + archiveGenerator = CreateInstallTargetGenerator(target, archiveArgs, true, true); } } @@ -710,7 +717,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) installsRuntime = installsRuntime || runtimeGenerator != 0; installsFramework = installsFramework || frameworkGenerator != 0; installsBundle = installsBundle || bundleGenerator != 0; - installsPrivateHeader = installsPrivateHeader + installsPrivateHeader = installsPrivateHeader || privateHeaderGenerator != 0; installsPublicHeader = installsPublicHeader || publicHeaderGenerator != 0; installsResource = installsResource || resourceGenerator; @@ -729,7 +736,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) if(!exports.GetString().empty() && !namelinkOnly) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddTargetToExports(exports.GetCString(), &target, + ->AddTargetToExports(exports.GetCString(), &target, archiveGenerator, runtimeGenerator, libraryGenerator, frameworkGenerator, bundleGenerator, publicHeaderGenerator); @@ -788,7 +795,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) { // This is the FILES mode. bool programs = (args[0] == "PROGRAMS"); - cmInstallCommandArguments ica; + cmInstallCommandArguments ica(this->DefaultComponentName); cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES"); files.Follows(0); ica.ArgumentGroup.Follows(&files); @@ -803,7 +810,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) this->SetError(e.str().c_str()); return false; } - + // Check if there is something to do. if(files.GetVector().empty()) { @@ -865,7 +872,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) std::string permissions_file; std::string permissions_dir; std::vector<std::string> configurations; - std::string component = "Unspecified"; + std::string component = this->DefaultComponentName; std::string literal_args; for(unsigned int i=1; i < args.size(); ++i) { @@ -1179,7 +1186,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) { // This is the EXPORT mode. - cmInstallCommandArguments ica; + cmInstallCommandArguments ica(this->DefaultComponentName); cmCAString exp(&ica.Parser, "EXPORT"); cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup); cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 3403c38..bf9fd9e 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -337,10 +337,12 @@ private: bool HandleFilesMode(std::vector<std::string> const& args); bool HandleDirectoryMode(std::vector<std::string> const& args); bool HandleExportMode(std::vector<std::string> const& args); - bool MakeFilesFullPath(const char* modeName, + bool MakeFilesFullPath(const char* modeName, const std::vector<std::string>& relFiles, std::vector<std::string>& absFiles); bool CheckCMP0006(bool& failure); + + std::string DefaultComponentName; }; diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 13ef8ed..0ba21c7 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -23,7 +23,8 @@ const char* cmInstallCommandArguments::PermissionsTable[] = const std::string cmInstallCommandArguments::EmptyString; -cmInstallCommandArguments::cmInstallCommandArguments() +cmInstallCommandArguments::cmInstallCommandArguments( + const std::string& defaultComponent) :Parser() ,ArgumentGroup() ,Destination (&Parser, "DESTINATION" , &ArgumentGroup) @@ -35,7 +36,9 @@ cmInstallCommandArguments::cmInstallCommandArguments() ,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup) ,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup) ,GenericArguments(0) -{} +{ + this->Component.SetDefaultString(defaultComponent.c_str()); +} const std::string& cmInstallCommandArguments::GetDestination() const { @@ -130,7 +133,7 @@ bool cmInstallCommandArguments::GetNamelinkSkip() const return false; } -const std::vector<std::string>& +const std::vector<std::string>& cmInstallCommandArguments::GetConfigurations() const { if (!this->Configurations.GetVector().empty()) @@ -156,7 +159,7 @@ bool cmInstallCommandArguments::Finalize() return true; } -void cmInstallCommandArguments::Parse(const std::vector<std::string>* args, +void cmInstallCommandArguments::Parse(const std::vector<std::string>* args, std::vector<std::string>* unconsumedArgs) { this->Parser.Parse(args, unconsumedArgs); @@ -166,9 +169,9 @@ void cmInstallCommandArguments::Parse(const std::vector<std::string>* args, bool cmInstallCommandArguments::CheckPermissions() { this->PermissionsString = ""; - for(std::vector<std::string>::const_iterator - permIt = this->Permissions.GetVector().begin(); - permIt != this->Permissions.GetVector().end(); + for(std::vector<std::string>::const_iterator + permIt = this->Permissions.GetVector().begin(); + permIt != this->Permissions.GetVector().end(); ++permIt) { if (!this->CheckPermissions(*permIt, this->PermissionsString)) @@ -183,7 +186,7 @@ bool cmInstallCommandArguments::CheckPermissions( const std::string& onePermission, std::string& permissions) { // Check the permission against the table. - for(const char** valid = cmInstallCommandArguments::PermissionsTable; + for(const char** valid = cmInstallCommandArguments::PermissionsTable; *valid; ++valid) { if(onePermission == *valid) diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 16033ce..321454a 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -19,10 +19,10 @@ class cmInstallCommandArguments { public: - cmInstallCommandArguments(); - void SetGenericArguments(cmInstallCommandArguments* args) + cmInstallCommandArguments(const std::string& defaultComponent); + void SetGenericArguments(cmInstallCommandArguments* args) {this->GenericArguments = args;} - void Parse(const std::vector<std::string>* args, + void Parse(const std::vector<std::string>* args, std::vector<std::string>* unconsumedArgs); // Compute destination path.and check permissions @@ -37,14 +37,15 @@ class cmInstallCommandArguments bool GetNamelinkOnly() const; bool GetNamelinkSkip() const; - // once HandleDirectoryMode() is also switched to using + // once HandleDirectoryMode() is also switched to using // cmInstallCommandArguments then these two functions can become non-static // private member functions without arguments - static bool CheckPermissions(const std::string& onePerm, + static bool CheckPermissions(const std::string& onePerm, std::string& perm); cmCommandArgumentsHelper Parser; cmCommandArgumentGroup ArgumentGroup; private: + cmInstallCommandArguments(); // disabled cmCAString Destination; cmCAString Component; cmCAString Rename; diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 0ec3030..cc62c4b 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -34,7 +34,7 @@ bool cmInstallFilesCommand if((args.size() > 1) && (args[1] == "FILES")) { - this->IsFilesForm = true; + this->IsFilesForm = true; for(std::vector<std::string>::const_iterator s = args.begin()+2; s != args.end(); ++s) { @@ -53,45 +53,46 @@ bool cmInstallFilesCommand this->FinalArgs.push_back(*s); } } - + this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent("Unspecified"); + ->AddInstallComponent(this->Makefile->GetSafeDefinition( + "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); return true; } -void cmInstallFilesCommand::FinalPass() +void cmInstallFilesCommand::FinalPass() { // No final pass for "FILES" form of arguments. if(this->IsFilesForm) { return; } - + std::string testf; std::string ext = this->FinalArgs[0]; - + // two different options if (this->FinalArgs.size() > 1) { // now put the files into the list std::vector<std::string>::iterator s = this->FinalArgs.begin(); ++s; - // for each argument, get the files + // for each argument, get the files for (;s != this->FinalArgs.end(); ++s) { // replace any variables std::string temps = *s; if (cmSystemTools::GetFilenamePath(temps).size() > 0) { - testf = cmSystemTools::GetFilenamePath(temps) + "/" + + testf = cmSystemTools::GetFilenamePath(temps) + "/" + cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext; } else { testf = cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext; } - + // add to the result this->Files.push_back(this->FindInstallSource(testf.c_str())); } @@ -102,9 +103,9 @@ void cmInstallFilesCommand::FinalPass() std::string regex = this->FinalArgs[0].c_str(); cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), regex.c_str(), files); - + std::vector<std::string>::iterator s = files.begin(); - // for each argument, get the files + // for each argument, get the files for (;s != files.end(); ++s) { this->Files.push_back(this->FindInstallSource(s->c_str())); @@ -128,13 +129,14 @@ void cmInstallFilesCommand::CreateInstallGenerator() const // Use a file install generator. const char* no_permissions = ""; const char* no_rename = ""; - const char* no_component = "Unspecified"; + std::string no_component = this->Makefile->GetSafeDefinition( + "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); std::vector<std::string> no_configurations; this->Makefile->AddInstallGenerator( new cmInstallFilesGenerator(this->Files, destination.c_str(), false, no_permissions, no_configurations, - no_component, no_rename)); + no_component.c_str(), no_rename)); } @@ -151,7 +153,7 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const // This is a full path. return name; } - + // This is a relative path. std::string tb = this->Makefile->GetCurrentOutputDirectory(); tb += "/"; @@ -159,7 +161,7 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const std::string ts = this->Makefile->GetCurrentDirectory(); ts += "/"; ts += name; - + if(cmSystemTools::FileExists(tb.c_str())) { // The file exists in the binary tree. Use it. diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 7e6c9ce..3a0a322 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -31,26 +31,27 @@ bool cmInstallProgramsCommand for (++s;s != args.end(); ++s) { this->FinalArgs.push_back(*s); - } - + } + this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent("Unspecified"); + ->AddInstallComponent(this->Makefile->GetSafeDefinition( + "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); return true; } -void cmInstallProgramsCommand::FinalPass() +void cmInstallProgramsCommand::FinalPass() { bool files_mode = false; if(!this->FinalArgs.empty() && this->FinalArgs[0] == "FILES") { files_mode = true; } - + // two different options if (this->FinalArgs.size() > 1 || files_mode) { - // for each argument, get the programs + // for each argument, get the programs std::vector<std::string>::iterator s = this->FinalArgs.begin(); if(files_mode) { @@ -68,9 +69,9 @@ void cmInstallProgramsCommand::FinalPass() std::vector<std::string> programs; cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), this->FinalArgs[0].c_str(), programs); - + std::vector<std::string>::iterator s = programs.begin(); - // for each argument, get the programs + // for each argument, get the programs for (;s != programs.end(); ++s) { this->Files.push_back(this->FindInstallSource(s->c_str())); @@ -89,13 +90,14 @@ void cmInstallProgramsCommand::FinalPass() // Use a file install generator. const char* no_permissions = ""; const char* no_rename = ""; - const char* no_component = "Unspecified"; + std::string no_component = this->Makefile->GetSafeDefinition( + "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); std::vector<std::string> no_configurations; this->Makefile->AddInstallGenerator( new cmInstallFilesGenerator(this->Files, destination.c_str(), true, no_permissions, no_configurations, - no_component, no_rename)); + no_component.c_str(), no_rename)); } /** @@ -112,7 +114,7 @@ std::string cmInstallProgramsCommand // This is a full path. return name; } - + // This is a relative path. std::string tb = this->Makefile->GetCurrentOutputDirectory(); tb += "/"; @@ -120,7 +122,7 @@ std::string cmInstallProgramsCommand std::string ts = this->Makefile->GetCurrentDirectory(); ts += "/"; ts += name; - + if(cmSystemTools::FileExists(tb.c_str())) { // The file exists in the binary tree. Use it. diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index 27fc175..277ccea 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -58,7 +58,8 @@ bool cmInstallTargetsCommand } this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent("Unspecified"); + ->AddInstallComponent(this->Makefile->GetSafeDefinition( + "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); return true; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6362d80..8265d72 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1548,13 +1548,10 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, target.GetName()); return; } - std::string langVar = "CMAKE_"; - langVar += linkLanguage; - std::string flagsVar = langVar + "_FLAGS"; + this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); std::string sharedFlagsVar = "CMAKE_SHARED_LIBRARY_"; sharedFlagsVar += linkLanguage; sharedFlagsVar += "_FLAGS"; - flags += this->Makefile->GetSafeDefinition(flagsVar.c_str()); flags += " "; flags += this->Makefile->GetSafeDefinition(sharedFlagsVar.c_str()); flags += " "; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0a709ae..a60896f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -354,6 +354,22 @@ bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const } //---------------------------------------------------------------------------- +void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) +{ + cmOStringStream msg; + msg << lff.FilePath << "(" << lff.Line << "): "; + msg << lff.Name << "("; + for(std::vector<cmListFileArgument>::const_iterator i = + lff.Arguments.begin(); i != lff.Arguments.end(); ++i) + { + msg << i->Value; + msg << " "; + } + msg << ")"; + cmSystemTools::Message(msg.str().c_str()); +} + +//---------------------------------------------------------------------------- bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, cmExecutionStatus &status) { @@ -385,20 +401,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, || pcmd->IsScriptable())) { - // if trace is one, print out invoke information + // if trace is enabled, print out invoke information if(this->GetCMakeInstance()->GetTrace()) { - cmOStringStream msg; - msg << lff.FilePath << "(" << lff.Line << "): "; - msg << lff.Name << "("; - for(std::vector<cmListFileArgument>::const_iterator i = - lff.Arguments.begin(); i != lff.Arguments.end(); ++i) - { - msg << i->Value; - msg << " "; - } - msg << ")"; - cmSystemTools::Message(msg.str().c_str()); + this->PrintCommandTrace(lff); } // Try invoking the command. if(!pcmd->InvokeInitialPass(lff.Arguments,status) || diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9fc64d6..8a0088b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -701,6 +701,11 @@ public: #endif /** + * Print a command's invocation + */ + void PrintCommandTrace(const cmListFileFunction& lff); + + /** * Execute a single CMake command. Returns true if the command * succeeded or false if it failed. */ diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 63ba58d..8b86a98 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -193,12 +193,13 @@ cmNinjaNormalTargetGenerator vars.LinkFlags = "$LINK_FLAGS"; std::string langFlags; - this->GetLocalGenerator()->AddLanguageFlags(langFlags, - this->TargetLinkLanguage, - this->GetConfigName()); - if (targetType != cmTarget::EXECUTABLE) + if (targetType != cmTarget::EXECUTABLE) { + this->GetLocalGenerator()->AddLanguageFlags(langFlags, + this->TargetLinkLanguage, + this->GetConfigName()); langFlags += " $ARCH_FLAGS"; - vars.LanguageCompileFlags = langFlags.c_str(); + vars.LanguageCompileFlags = langFlags.c_str(); + } // Rule for linking library. std::vector<std::string> linkCmds = this->ComputeLinkCmd(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 846aef5..2ffff42 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -70,6 +70,7 @@ # include "cmGlobalVisualStudio10Win64Generator.h" # include "cmGlobalVisualStudio11Generator.h" # include "cmGlobalVisualStudio11Win64Generator.h" +# include "cmGlobalVisualStudio11ARMGenerator.h" # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" @@ -2569,6 +2570,8 @@ void cmake::AddDefaultGenerators() &cmGlobalVisualStudio11Generator::New; this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] = &cmGlobalVisualStudio11Win64Generator::New; + this->Generators[cmGlobalVisualStudio11ARMGenerator::GetActualName()] = + &cmGlobalVisualStudio11ARMGenerator::New; this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] = &cmGlobalVisualStudio71Generator::New; this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] = |