Re: [CMake] "cmake --build ." and colors
Hello, Ok tell me if I am wrong but what you're saying is that it is possible to enable a pass-thru mode for cmake --build but currently it is not implementer? Meanwhile I finally found a workaround using the "build_command" Command that I did not see before: http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:build_command During CMake phase I can output all the build commands I want: - one with "all" target - the other one with @_target_@ so I configure it later Then I use these files to build my .bat / .sh that I can launch. I seems to work fine, I have my colors and my compact ninja output. But now with MSVC_IDE the output is disabled, I can live with that for now :) Regards, Gregoire -Original Message- From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of Brad King Sent: vendredi 17 mai 2013 17:43 To: Leif Walsh Cc: cmake@cmake.org; Andreas Mohr Subject: Re: [CMake] "cmake --build ." and colors On 05/04/2013 08:12 AM, Leif Walsh wrote: > I think the colors and carriage returns (without line feeds) are lost > because the build tool sees its controlling terminal is cmake, not a > real terminal program capable of showing color or redrawing, so it > doesn't output them. Cmake may be logging this stuff too (to send to > cdash for example) so this is kind of a responsible choice. This is correct, but it doesn't have to be so. In the case of a direct "cmake --build ..." invocation from a terminal CMake is not doing any special logging so it should be able to share its host terminal such that isatty() returns true for the underlying tools. The "cmake --build ..." implementation ultimately runs through the cmSystemTools::RunSingleCommand code path: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmSystemTools.cxx;hb=v2.8.11#l615 in order to invoke the native build command. One could add an option to that code path to share the output pipes with the cmake process just like "ctest --launch" does in pass-thru mode: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/CTest/cmCTestLaunch.cxx;hb=v2.8.11#l221 cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1); cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1); One could then activate that from the "cmake --build" call site by passing the option through all the intermediate levels of the call stack (cmake::Build and cmGlobalGenerator::Build IIRC). -Brad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] "cmake --build ." and colors
On 05/04/2013 08:12 AM, Leif Walsh wrote: > I think the colors and carriage returns (without line feeds) are lost > because the build tool sees its controlling terminal is cmake, not a > real terminal program capable of showing color or redrawing, so it > doesn't output them. Cmake may be logging this stuff too (to send to > cdash for example) so this is kind of a responsible choice. This is correct, but it doesn't have to be so. In the case of a direct "cmake --build ..." invocation from a terminal CMake is not doing any special logging so it should be able to share its host terminal such that isatty() returns true for the underlying tools. The "cmake --build ..." implementation ultimately runs through the cmSystemTools::RunSingleCommand code path: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmSystemTools.cxx;hb=v2.8.11#l615 in order to invoke the native build command. One could add an option to that code path to share the output pipes with the cmake process just like "ctest --launch" does in pass-thru mode: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/CTest/cmCTestLaunch.cxx;hb=v2.8.11#l221 cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1); cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1); One could then activate that from the "cmake --build" call site by passing the option through all the intermediate levels of the call stack (cmake::Build and cmGlobalGenerator::Build IIRC). -Brad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] "cmake --build ." and colors
Hello, I am still trying to find a solution to get those colors displayed. Especially when I read that :) http://www.phoronix.com/scan.php?page=news_item&px=MTM2MzI I came to the conclusion that the only way to do so is to run the native build tool directly from the command line. So I thougth of a solution: an option could be added to cmake command line to output the native command corresponding to the cmake --build. Then I could write that output to a script and run it. cmake --build . --target foo -- -j3 Would output something like that when using Ninja generator: foo -j3 What do you think? Regards, Gregoire -Original Message- From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of Andreas Mohr Sent: samedi 4 mai 2013 14:48 To: Leif Walsh Cc: cmake@cmake.org; Andreas Mohr Subject: Re: [CMake] "cmake --build ." and colors On Sat, May 04, 2013 at 05:12:14AM -0700, Leif Walsh wrote: >cmake --build . -- -jN >Extra args after -- are passed through to the build tool. Doesn't work if >the tool expects something different though. Ah, cool (took note to improve my script). While -- is some pretty standard mechanism, CMake usage screen (dito man page! Likely same info source...) does not explicitly document it, though (will add docs, currently doing that anyway). It's of course somewhat bitter to have a nice tool-abstracted --build mechanism yet then still having to know tool-specific parameters in a script. Talk about incomplete abstraction. >I think the colors and carriage returns (without line feeds) are lost >because the build tool sees its controlling terminal is cmake, not a real >terminal program capable of showing color or redrawing, so it doesn't >output them. Cmake may be logging this stuff too (to send to cdash for >example) so this is kind of a responsible choice. Indeed, that possibly gets decided via the controlling terminal's features. Andreas Mohr -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] "cmake --build ." and colors
On Sat, May 04, 2013 at 05:12:14AM -0700, Leif Walsh wrote: >cmake --build . -- -jN >Extra args after -- are passed through to the build tool. Doesn't work if >the tool expects something different though. Ah, cool (took note to improve my script). While -- is some pretty standard mechanism, CMake usage screen (dito man page! Likely same info source...) does not explicitly document it, though (will add docs, currently doing that anyway). It's of course somewhat bitter to have a nice tool-abstracted --build mechanism yet then still having to know tool-specific parameters in a script. Talk about incomplete abstraction. >I think the colors and carriage returns (without line feeds) are lost >because the build tool sees its controlling terminal is cmake, not a real >terminal program capable of showing color or redrawing, so it doesn't >output them. Cmake may be logging this stuff too (to send to cdash for >example) so this is kind of a responsible choice. Indeed, that possibly gets decided via the controlling terminal's features. Andreas Mohr -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] "cmake --build ." and colors
cmake --build . -- -jN Extra args after -- are passed through to the build tool. Doesn't work if the tool expects something different though. I think the colors and carriage returns (without line feeds) are lost because the build tool sees its controlling terminal is cmake, not a real terminal program capable of showing color or redrawing, so it doesn't output them. Cmake may be logging this stuff too (to send to cdash for example) so this is kind of a responsible choice. -- Cheers, Leif On Sat, May 4, 2013 at 6:02 AM, Andreas Mohr wrote: > Hi, > On Fri, May 03, 2013 at 04:19:40PM -0400, cmake-requ...@cmake.org wrote: >> Date: Fri, 3 May 2013 17:46:06 + >> From: Gregoire Aujay >> Hello, >> >> I also found that using cmake --build . with ninja outputs all lines but if >> I directly use ninja to build it only outputs one line which is very cool >> (it clears current line before printing the new one if there is no >> warning/error). > Possibly that's both (colors, line clearing) related to ANSI color escape > codes > as used by the native build tool. > It's perhaps possible to analyze where exactly the augmented output gets > lost within the chain (doing analysis on source code side, of course). > Probably some CMake handling or adopting of tool output filters out that > markup. >> I am wondering if there is any trick to enable colors when running this >> command: >> cmake --build . >> >> The only way I manage to get the colors is to directly use the make program, >> e.g.: >> mingw32-make all >> >> >> The issue is that I am trying to use a script that runs cmake to build >> instead of the make program that may change (ninja, mingw-make, make, msvc, >> etc). > Yes, very much so. Dito for ninja and make here (and as launched by > some cross-platform [ruby/python/perl] script). > Somehow I failed to actively pick up that I could go through cmake --build . > rather than grabbing ${CMAKE_BUILD_TOOL} (formerly ${CMAKE_MAKE_PROGRAM}) > directly. > Also, one might want to pass e.g. parallelization (make -jX) configuration > through it > as well, so it might be useful to devise a standard parameterization > mechanism for --build to support *any* such attributes, in a generalized form. > Andreas Mohr > -- > Powered by www.kitware.com > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] "cmake --build ." and colors
Hi, On Fri, May 03, 2013 at 04:19:40PM -0400, cmake-requ...@cmake.org wrote: > Date: Fri, 3 May 2013 17:46:06 + > From: Gregoire Aujay > Hello, > > I also found that using cmake --build . with ninja outputs all lines but if I > directly use ninja to build it only outputs one line which is very cool (it > clears current line before printing the new one if there is no warning/error). Possibly that's both (colors, line clearing) related to ANSI color escape codes as used by the native build tool. It's perhaps possible to analyze where exactly the augmented output gets lost within the chain (doing analysis on source code side, of course). Probably some CMake handling or adopting of tool output filters out that markup. > I am wondering if there is any trick to enable colors when running this > command: > cmake --build . > > The only way I manage to get the colors is to directly use the make program, > e.g.: > mingw32-make all > > > The issue is that I am trying to use a script that runs cmake to build > instead of the make program that may change (ninja, mingw-make, make, msvc, > etc). Yes, very much so. Dito for ninja and make here (and as launched by some cross-platform [ruby/python/perl] script). Somehow I failed to actively pick up that I could go through cmake --build . rather than grabbing ${CMAKE_BUILD_TOOL} (formerly ${CMAKE_MAKE_PROGRAM}) directly. Also, one might want to pass e.g. parallelization (make -jX) configuration through it as well, so it might be useful to devise a standard parameterization mechanism for --build to support *any* such attributes, in a generalized form. Andreas Mohr -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] "cmake --build ." and colors
Hello, I also found that using cmake --build . with ninja outputs all lines but if I directly use ninja to build it only outputs one line which is very cool (it clears current line before printing the new one if there is no warning/error). Regards, Gregoire From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of Gregoire Aujay Sent: vendredi 3 mai 2013 16:39 To: cmake@cmake.org Subject: [CMake] "cmake --build ." and colors Hello, I am wondering if there is any trick to enable colors when running this command: cmake --build . The only way I manage to get the colors is to directly use the make program, e.g.: mingw32-make all The issue is that I am trying to use a script that runs cmake to build instead of the make program that may change (ninja, mingw-make, make, msvc, etc). Regards, Gregoire -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake