On 2011-09-01 18:00-0400 David Cole wrote:

Sounds like a great research project for somebody. Would be cool to
see CMake options visualized for some larger projects...

Not sure of its feasibility in terms of completeness, however. I'm
sure you could come up with something rudimentary that seems to work
for some cases.

There are some cases that you will simply never reach, even though the
code is in there.

For example, consider what happens when you have this code:

if(WIN32)
 option(SOME_WIN32_SPECIFIC_OPTION ...)
endif()

And then you run your tool on your Linux box. I don't care how many
iterations you do, you're simply never going to see the platform
specific option.

Also, in order to aim for completeness, you'd need to deal with
potential code like this:

if(optA AND optB AND optC AND optD OR NOT (optE AND optF))
 option(REALLY_WELL_HIDDEN_OPTION ...)
endif()

Basically, the "inner" option will only be triggered in a very
specific set of true-false values of all the "outer" options...

The combinatorial nature of the arbitrary logic enabled by the IF
command makes it very difficult for an analysis tool like this to
achieve "guaranteed completeness."

However, even without completeness, it would still be a neat tool, and
I'd love to see what sorts of graphs are out there in the wild.


Hi Dave:

Interesting examples.  I suspect that graphviz can handle all sorts of
different types of relationships, but if you just focus on
dependencies alone (and not what those dependencies are), then I
believe that all graphviz would need to know is that
SOME_WIN32_SPECIFIC_OPTION depended on the WIN32 variable and
REALLY_WELL_HIDDEN_OPTION depended on the optA, optB, etc., option
variables.  The cmake
parser presumably skips everything inside the if(WIN32) block on a
Linux system so I guess you would have to go to an external tool (or a
special CMake parsing mode) to parse every CMake logic branch to
discover all dependencies.  But that could obviously be done to
collect information on all option dependencies.

I think you will agree with me that the the interesting visualization
results would be for option dependencies since those dependencies are
the ones that complicate the art of CMake configuration. However, from
your first example the intrusion of non-option variables in the
dependency visualization system would obviously be a necessary
extension of my original idea.  So you would have to include
non-option variables in the dependency tree for options as well, but
to simplify the final graph concerning option dependencies it would
probably be a good idea to drop all variables from the results which
were not depended upon by option variables.


- 2 cents worth... :-)


Yeah, it is fun to speculate about something new like this that would
be of considerable benefit to help a project's developers and users
visualize the complete set of options and their dependencies for their
project's build system.  Unfortunately I don't have sufficient
knowledge of the CMake code base (or C++ for that matter) to do this
myself, and I assume nobody at Kitware has spare time to do such an
implementation. However, maybe someone else here or perhaps a GSOC
student next year might be interested in fleshing this idea out into
something useful.

Alan

__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
_______________________________________________
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

Reply via email to