Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-25 Thread Adam Strzelecki
 I think the delayed-\n approach is the simplest.  In the
 case that the output is interrupted by other content it
 almost certainly means something is going wrong anyway.

Does CMake use popen to launch processes? Or it just spawns them providing them 
direct access to stdin/out/err? If it was using popen then we can circumvent 
that too.

--Adam
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Adam Strzelecki
FYI stage/compact-status-log was updated with more elegant C++ implementation 
introducing new cmStdoutFilter  cmThread utility classes enabled when certain 
headers are present in the system, so in cmakemain.cxx we simply put:

  cmStdoutFilter stdoutFilter(-- );


--Adam
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Brad King
On 09/24/2014 08:02 AM, Adam Strzelecki wrote:
 cmThread utility class

Introducing threads is exactly the too much infrastructure
to which I was referring in my previous response.  I'm sorry
to reject all the effort you put into the threads approach so
far, but I did say this earlier.

 cmake emits simply too much (redundant) information.

IIRC the original reason for having separate

   -- Looking for iconv.h
   -- Looking for iconv.h - Found

lines is that the first one prints what is about to be
done in case something happens (e.g. crash) that prevents
the second output from ever showing up.  That helps a lot
in tracking down the problem.  If another thread buffers
the first message then it might not show up at all.  The
terminal escape codes approach does not have that problem.

The same de-dup you do in the threaded filter could be done
with a shell alias that pipes 'cmake' output through a sed
script or something to de-dup it.  That would handle local
interactive terminal use of cmake without any upstream
changes.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Chuck Atkins
I like the idea of reducing the extra-verbose output, and maybe I'm missing
something here but could this possibly be done with a much simpler
approach?  It seems the way these double messages happen is with the
following CMake code:

message(STATUS Doing something)
# Do some stuff
message(STATUS Doing something - Result)

Couldn't the same thing be achieved in a platform agnostic way by adding a
NOENDL option (or something similar) to the message command?  Then you
could achieve the same result with:

message(STATUS Doing something NOENDL)
# Do some stuff
message(STATUS  - Result)

Just a bit of logic to add the NOENDL option and then another to omit the
message prefix if the previous call used NOENDL.  It seems this could
achieve the compact log result, do it in a platform agnostic way, and also
provide the useful feature to the message command for users.  It would be a
two-step process: first, enhance the message command, second, update the
various .cmake files in Sources/Modules to leverage the new syntax.

Just my 2 cents.

- Chuck

On Wed, Sep 24, 2014 at 8:36 AM, Brad King brad.k...@kitware.com wrote:

 On 09/24/2014 08:02 AM, Adam Strzelecki wrote:
  cmThread utility class

 Introducing threads is exactly the too much infrastructure
 to which I was referring in my previous response.  I'm sorry
 to reject all the effort you put into the threads approach so
 far, but I did say this earlier.

  cmake emits simply too much (redundant) information.

 IIRC the original reason for having separate

-- Looking for iconv.h
-- Looking for iconv.h - Found

 lines is that the first one prints what is about to be
 done in case something happens (e.g. crash) that prevents
 the second output from ever showing up.  That helps a lot
 in tracking down the problem.  If another thread buffers
 the first message then it might not show up at all.  The
 terminal escape codes approach does not have that problem.

 The same de-dup you do in the threaded filter could be done
 with a shell alias that pipes 'cmake' output through a sed
 script or something to de-dup it.  That would handle local
 interactive terminal use of cmake without any upstream
 changes.

 -Brad

 --

 Powered by www.kitware.com

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Kitware offers various services to support the CMake community. For more
 information on each offering, please visit:

 CMake Support: http://cmake.org/cmake/help/support.html
 CMake Consulting: http://cmake.org/cmake/help/consulting.html
 CMake Training Courses: http://cmake.org/cmake/help/training.html

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/mailman/listinfo/cmake-developers

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Brad King
On 09/24/2014 09:44 AM, Chuck Atkins wrote:
 message(STATUS Doing something NOENDL)
 # Do some stuff
 message(STATUS  - Result)

What happens if something else occurs in between that prints
a message?  Do we tolerate

 -- Doing something-- Unrelated Message
 - Result

instead of

 -- Doing something
 -- Unrelated Message
 -- Doing something - Result

? Also the approach needs to work in ccmake where only one
status line is shown at a time.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Chuck Atkins

 What happens if something else occurs in between that prints
 a message?  Do we tolerate

  -- Doing something-- Unrelated Message
  - Result

 instead of

  -- Doing something
  -- Unrelated Message
  -- Doing something - Result


Sure, why not?  There's no requirement to use the NOENDL, it would just be
an additional option.   The places where this happens is most in the
Modules/* code for system introspection.  If the code path allows for
extensive messaging in between status messages, then just don't use the
NOENDL option.  It would be entirely optional and up to whomever is writing
the CMake code whether or not to use it.  We could easily use it in most of
the system introspection modules without worry though.



 Also the approach needs to work in ccmake where only one
 status line is shown at a time.


Sure it would.  Nothing monumental would need to change though.  It
currently output's every message separately, but it could just output the
current message append to the previous message and then when an endline is
found then clear the append message buffer.

I'm not saying it should be done this way, just offering an alternate
approach that might be more flexible.  The details and tests would still
need to be worked out.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Adam Strzelecki
 What happens if something else occurs in between that prints
 a message?

That's why my solution is completely automatic, does not require any changes in 
existing modules, and it works as desired so only:


  -- Doing something
  -- Doing something - Result

That arrive to stdout are compacted to:

  -- Doing something - Result

When anything comes in between both to stdout and stderr then compaction does 
not occur.

Also the preliminary message -- Doing something is of course emitted, but 
cursor waits on end of line instead new line, just in case we get 2nd matching 
Result line.

If next line is anything else then new line gets appended and rest goes as 
usual.


Please try to build this stage branch and try to run cmake agains cmake :) (FYI 
fixed bug preventing compiling on Linux)

--Adam

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Brad King
On 09/24/2014 10:29 AM, Adam Strzelecki wrote:
 Please try to build this stage branch and try to run cmake

In case I was not clear the last two times:

We will *NOT* be introducing use of *THREADS* in CMake just
to filter our own output.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Adam Strzelecki
 We will *NOT* be introducing use of *THREADS* in CMake just
 to filter our own output.

Yeah, got it. Are subprocess allowed then?

 (…) just to filter our own output.

Please note that such solution that filters stdout low level is superior to 
doing it as CMake owns level because cmake may be launching some external 
program, library or whatever that also pushes something to stdout/stderr and if 
we don't take this into account then output will get likely broken.

--Adam
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-24 Thread Brad King
On 09/24/2014 10:47 AM, Adam Strzelecki wrote:
 Are subprocess allowed then?
 
 (…) just to filter our own output.
 
 Please note that such solution that filters stdout low level

Yes, but I do not think we should have to do any filtering
at all.  The output should just be written to match what
we want in the first place.

I think the delayed-\n approach is the simplest.  In the
case that the output is interrupted by other content it
almost certainly means something is going wrong anyway.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-22 Thread Brad King
On 09/21/2014 12:45 PM, Adam Strzelecki wrote:
 I have pushed new branch stage/compact-status-log for review.

Neat.

 Idea behind is to reduce cmake output when we are in terminal.
 When we are outputting message Trying feature we can later
 remove it when new output comes using ANSI escape codes.
 This is done by appending (but not flushing) \e[D\e[K
 to stdout.

What if stdout's buffer happens to fill up and flush anyway?
I think the text needs to be buffered somewhere for CMake
to decide whether to clear it.  The message()s have to be
paired somehow so that we clear the first one only if the
second one is the very next message to print.

 NOTE this behavior only applies to terminal (isatty check),
 so when piping cmake output to file is works as before.

Look at Source/kwsys/Terminal.c for detection of whether we
are actually working with a terminal capable of VT100 escapes.

Thanks,
-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-22 Thread Adam Strzelecki
 What if stdout's buffer happens to fill up and flush anyway?

I think I can provide other terminal-less solution via filtering stdout and 
stderr via pipe and background thread.

I got some proof-of-concept program already. Idea is:

stdout  stderr are duped and proxied by some background thread.

(1) When background thread finds a line beginning with '--' on stdout then it 
writes it to real stdout without trailing new line, and stores it in some 
lookup variable

(2a) When something new that comes to stdout begins exactly the same as 
previous line (previous line is prefix of new coming line) then only the 
difference suffix is wrote out to stdout

(2b) Otherwise when anything new comes to stderr or stdout that does not start 
exactly as previous line then suspended new line and new coming text is wrote 
to real stderr/stdout

This should effectively compact all successive try  success/fail lines 
together is there was no other output in between them. Also this will require 
absolutely no changes in .cmake files or any cmake commands.

WDYT?

--Adam
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-22 Thread Brad King
On 09/22/2014 12:26 PM, Adam Strzelecki wrote:
 stdout  stderr are duped and proxied by some background thread.

IMO that is too much infrastructure to solve what is essentially
a cosmetic problem.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] stage/compact-status-log

2014-09-22 Thread Adam Strzelecki
 IMO that is too much infrastructure to solve what is essentially
 a cosmetic problem.

Well, IMHO it is usability problem, because cmake emits simply too much 
(redundant) information.

FYI I have pushed new stage/compact-status-log which does include this 
automatic subsequent status log line merging facility without using any ANSI 
escape sequences or any changes to .cmake files and it works with any UNIX 
having pipe, select  pthreads. What's more good it works regardless if cmake 
output is piped to file or goes directly terminal.

Here's a commit log:

commit e464a698e773dcbaba26b5af0327561312717b58
Author: Adam Strzelecki o...@java.pl
Date:   Mon Sep 22 20:53:48 2014 +0200

Automatically compact two subsequent status lines

This is done with background thread acting as stdout/stderr proxy monitoring
subsequent lines emitted to stdout. Only lines beginning with -- (status
lines) are considered.

If previously emitted line is a prefix to currently emitted line then this 
line
gets merged, e.g.:

   -- Looking for iconv.h
   -- Looking for iconv.h - Found

Is replaced with:

   -- Looking for iconv.h - Found

However if there is any output both on stdout and stderr in between then the
merging is not executed, e.g:

   -- Looking for iconv.h
   -- Cannot compile test.c
   -- Looking for iconv.h - Not found

This currently works only on UNIX.


And the results when running cmake on cmake:

$ /tmp/cmake.PTeJch9J/bin/cmake ~/Code/SDK/cmake
-- The C compiler identification is AppleClang 6.0.0.654
-- The CXX compiler identification is AppleClang 6.0.0.654
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info - done
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info - done
-- Looking for C++ include iostream - found
-- Check for STD namespace - found
-- Check for ANSI scope - found
-- Check for sstream - found
-- Looking for unsetenv - found
-- Looking for environ - not found
-- Checking whether header cstdio is available - yes
-- Checking for Large File Support - yes
-- Checking whether STL classes are in std namespace - yes
-- Checking whether ANSI stream headers are available - yes
-- Checking whether ANSI streams are in std namespace - yes
-- Checking whether ANSI string stream is available - yes
-- Checking whether header cstddef is available - yes
-- Checking whether stl string has operator!= for char* - yes
-- Checking whether stl has iterator_traits - yes
-- Checking whether stl has standard template allocator - yes
-- Checking for rebind member of stl allocator - yes
-- Checking for non-standard argument to stl allocator::max_size - no
-- Checking whether stl containers support allocator objects. - yes
-- Checking whether ios has binary openmode - yes
-- Checking whether  is needed for template friends - yes
-- Checking for member template support - yes
-- Checking for standard template specialization syntax - yes
-- Checking whether argument dependent lookup is supported - yes
-- Checking whether struct stat has st_mtim member - no
-- Checking whether C++ compiler has 'long long' - yes
-- Checking whether C++ compiler has '__int64' - no
-- Checking for C type size macros - compiled
-- Looking for sys/types.h - found
-- Looking for stdint.h - found
-- Looking for stddef.h - found

Versus old non-compact cmake:

$ /Volumes/cmake-3.0.2-Darwin64-universal/CMake.app/Contents/bin/cmake 
~/Code/SDK/cmake
-- The C compiler identification is AppleClang 6.0.0.654
-- The CXX compiler identification is AppleClang 6.0.0.654
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for C++ include iostream
-- Looking for C++ include iostream - found
-- Check for STD namespace
-- Check for STD namespace - found
-- Check for ANSI scope
-- Check for ANSI scope - found
-- Check for sstream
-- Check for sstream - found
-- Looking for unsetenv
-- Looking for unsetenv - found
-- Looking for environ
-- Looking for environ - not found
-- Checking whether header cstdio is available
-- Checking whether header cstdio is available - yes
-- Checking for Large File Support
-- Checking for Large File Support - yes
-- Checking whether STL classes are in std namespace
-- Checking whether STL classes are in std namespace - yes
-- Checking whether ANSI stream headers are available
-- Checking whether ANSI stream headers are available - yes
-- Checking whether ANSI streams are in std namespace
-- Checking whether ANSI streams are in std namespace - yes
-- Checking whether ANSI string stream is available
--