diff options
-rw-r--r-- | Source/cmGlobalBorlandMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalKdevelopGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalMSYSMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalMinGWMakefileGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalNMakeMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalWatcomWMakeGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 64 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.h | 5 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 10 |
14 files changed, 89 insertions, 9 deletions
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 61cd883..e33c518 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -24,6 +24,7 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() this->EmptyRuleHackDepends = "NUL"; this->FindMakeProgramFile = "CMakeBorlandFindMake.cmake"; this->ForceUnixPaths = false; + this->ToolSupportsColorVT100 = false; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b8ae64b..29ac5b1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -33,6 +33,9 @@ cmGlobalGenerator::cmGlobalGenerator() { // by default use the native paths this->ForceUnixPaths = false; + + // By default do not try to support color. + this->ToolSupportsColorVT100 = false; } cmGlobalGenerator::~cmGlobalGenerator() diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 0490611..c5a5f78 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -127,6 +127,7 @@ public: static int s_TryCompileTimeout; bool GetForceUnixPaths() {return this->ForceUnixPaths;} + bool GetToolSupportsColorVT100() { return this->ToolSupportsColorVT100; } ///! return the language for the given extension const char* GetLanguageFromExtension(const char* ext); ///! is an extension to be ignored @@ -193,6 +194,7 @@ protected: virtual const char* GetRebuildCacheTargetName() { return 0; } bool ForceUnixPaths; + bool ToolSupportsColorVT100; cmStdString FindMakeProgramFile; cmStdString ConfiguredFilesPath; cmake *CMakeInstance; diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 5e0a46d..527aea5 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -28,6 +28,7 @@ cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator() // This type of makefile always requires unix style paths this->ForceUnixPaths = true; this->FindMakeProgramFile = "CMakeUnixFindMake.cmake"; + this->ToolSupportsColorVT100 = false; } ///! Create a local generator appropriate to this Global Generator diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 8e118bd..a94a1b5 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -23,6 +23,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator() { this->FindMakeProgramFile = "CMakeMSYSFindMake.cmake"; this->ForceUnixPaths = true; + this->ToolSupportsColorVT100 = true; } std::string diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index 10da93c..e924ca0 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -22,7 +22,7 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator() { this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake"; this->ForceUnixPaths = true; - + this->ToolSupportsColorVT100 = false; } void cmGlobalMinGWMakefileGenerator::EnableLanguage(std::vector<std::string>const& l, diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index f3c91eb..bd9952b 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -22,6 +22,7 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() { this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake"; this->ForceUnixPaths = false; + this->ToolSupportsColorVT100 = false; } void cmGlobalNMakeMakefileGenerator::EnableLanguage(std::vector<std::string>const& l, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a8b1aef..0baa494 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -26,6 +26,7 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() // This type of makefile always requires unix style paths this->ForceUnixPaths = true; this->FindMakeProgramFile = "CMakeUnixFindMake.cmake"; + this->ToolSupportsColorVT100 = true; } void cmGlobalUnixMakefileGenerator3 diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 81ca741..fd3af68 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -22,6 +22,7 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() { this->FindMakeProgramFile = "CMakeFindWMake.cmake"; this->ForceUnixPaths = false; + this->ToolSupportsColorVT100 = false; } void cmGlobalWatcomWMakeGenerator::EnableLanguage(std::vector<std::string>const& l, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 19ba3a3..2068fce 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -35,6 +35,28 @@ #include <memory> // auto_ptr #include <queue> +#define CMAKE_VT100_NORMAL "\33[0m" +#define CMAKE_VT100_BOLD "\33[1m" +#define CMAKE_VT100_UNDERLINE "\33[4m" +#define CMAKE_VT100_BLINK "\33[5m" +#define CMAKE_VT100_INVERSE "\33[7m" +#define CMAKE_VT100_FRONT_BLACK "\33[30m" +#define CMAKE_VT100_FRONT_RED "\33[31m" +#define CMAKE_VT100_FRONT_GREEN "\33[32m" +#define CMAKE_VT100_FRONT_YELLOW "\33[33m" +#define CMAKE_VT100_FRONT_BLUE "\33[34m" +#define CMAKE_VT100_FRONT_MAGENTA "\33[35m" +#define CMAKE_VT100_FRONT_CYAN "\33[36m" +#define CMAKE_VT100_FRONT_WHITE "\33[37m" +#define CMAKE_VT100_BACK_BLACK "\33[40m" +#define CMAKE_VT100_BACK_RED "\33[41m" +#define CMAKE_VT100_BACK_GREEN "\33[42m" +#define CMAKE_VT100_BACK_YELLOW "\33[43m" +#define CMAKE_VT100_BACK_BLUE "\33[44m" +#define CMAKE_VT100_BACK_MAGENTA "\33[45m" +#define CMAKE_VT100_BACK_CYAN "\33[46m" +#define CMAKE_VT100_BACK_WHITE "\33[47m" + //---------------------------------------------------------------------------- cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() { @@ -851,8 +873,37 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, - const char* text) + const char* text, + EchoColor color) { + // Choose the color for the text. + const char* prefix = 0; + if(this->GlobalGenerator->GetToolSupportsColorVT100() && + this->Makefile->IsOn("CMAKE_COLOR_MAKEFILE")) + { + switch(color) + { + case EchoNormal: + break; + case EchoDepend: + prefix = CMAKE_VT100_FRONT_MAGENTA CMAKE_VT100_BOLD; + break; + case EchoBuild: + prefix = CMAKE_VT100_FRONT_GREEN CMAKE_VT100_BOLD; + break; + case EchoLink: + prefix = CMAKE_VT100_FRONT_YELLOW CMAKE_VT100_BOLD; + break; + case EchoGenerate: + prefix = CMAKE_VT100_FRONT_BLUE CMAKE_VT100_BOLD; + break; + case EchoGlobal: + prefix = CMAKE_VT100_FRONT_CYAN CMAKE_VT100_BOLD; + break; + } + } + const char* suffix = prefix? CMAKE_VT100_NORMAL : 0; + // Echo one line at a time. std::string line; for(const char* c = text;; ++c) @@ -868,7 +919,15 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, { cmd += "\""; } + if(prefix) + { + cmd += prefix; + } cmd += line; + if(suffix) + { + cmd += suffix; + } if(this->EchoNeedsQuote) { cmd += "\""; @@ -1320,7 +1379,8 @@ void cmLocalUnixMakefileGenerator3 { depends.push_back(dit->c_str()); } - this->AppendEcho(commands, text); + this->AppendEcho(commands, text, + cmLocalUnixMakefileGenerator3::EchoGlobal); // Utility targets store their rules in pre- and post-build commands. this->AppendCustomDepends(depends, diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 47f31db..69e4900 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -152,7 +152,10 @@ public: std::string GetRecursiveMakeCall(const char *makefile, const char* tgt); // append an echo command - void AppendEcho(std::vector<std::string>& commands, const char* text); + enum EchoColor { EchoNormal, EchoDepend, EchoBuild, EchoLink, + EchoGenerate, EchoGlobal }; + void AppendEcho(std::vector<std::string>& commands, const char* text, + EchoColor color = EchoNormal); static std::string GetTargetDirectory(cmTarget& target); diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 6922cf0..7388862 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -196,7 +196,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) buildEcho += linkLanguage; buildEcho += " executable "; buildEcho += targetOutPath; - this->LocalGenerator->AppendEcho(commands, buildEcho.c_str()); + this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(), + cmLocalUnixMakefileGenerator3::EchoLink); // Build a list of compiler flags and linker flags. std::string flags; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 585d025..6cf5be9 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -265,7 +265,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules break; } buildEcho += targetOutPath.c_str(); - this->LocalGenerator->AppendEcho(commands, buildEcho.c_str()); + this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(), + cmLocalUnixMakefileGenerator3::EchoLink); // Construct a list of files associated with this library that may // need to be cleaned. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2f5e120..1f7c17f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -374,7 +374,8 @@ cmMakefileTargetGenerator buildEcho += lang; buildEcho += " object "; buildEcho += relativeObj; - this->LocalGenerator->AppendEcho(commands, buildEcho.c_str()); + this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(), + cmLocalUnixMakefileGenerator3::EchoBuild); // Construct the compile rules. std::string compileRuleVar = "CMAKE_"; @@ -540,7 +541,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() // Write the dependency generation rule. std::string depEcho = "Scanning dependencies of target "; depEcho += this->Target->GetName(); - this->LocalGenerator->AppendEcho(commands, depEcho.c_str()); + this->LocalGenerator->AppendEcho(commands, depEcho.c_str(), + cmLocalUnixMakefileGenerator3::EchoDepend); // Add a command to call CMake to scan dependencies. CMake will // touch the corresponding depends file after scanning dependencies. @@ -627,7 +629,9 @@ void cmMakefileTargetGenerator std::vector<std::string> commands; std::string preEcho = "Generating "; preEcho += output; - this->LocalGenerator->AppendEcho(commands, preEcho.c_str()); + this->LocalGenerator + ->AppendEcho(commands, preEcho.c_str(), + cmLocalUnixMakefileGenerator3::EchoGenerate); this->LocalGenerator->AppendCustomCommand(commands, cc); // Collect the dependencies. |