[vtk-developers] And one include to rule them all

David Thompson david.thompson at kitware.com
Tue Sep 4 19:52:51 EDT 2012


Hi all,

> +1 for timings.

I will be happy to do timings once things get to the point where most or all of VTK compiles after the conversion script gets run. I am not there yet.

> Also, if code moves from one module to another, the API breaks.

I agree this could be a problem, but the same script that converts VTK to the new technique could easily be modified to change code across relocations.

As for the questions about why some of us want to make the change... I can only offer my reasons -- but I have a good many:

+  It improves compile line legibility. For instance, in order to understand the vtkObjectFactory override auto-initialization recently, I ended up having to paste the compile line in an editor and use *search* to find the flags I was looking for amid all of the include directives.

+ I think it improves legibility of the source code. Actually seeing what modules your header files come from provides me with a better sense of what the dependencies of new classes I am developing are -- and ultimately helps determine where new classes should go.

+ It makes life *much* easier if you want to compile one file in a project with different flags than all the others for debugging purposes (e.g., "I just want to see if adding one flag will get it compiling correctly or including some symbol so I can diagnose the problem."). Debugging a single file this way is much more friendly than adding "set_source_files_properties(...)" to the CMakeLists.txt, re-running CMake, and then rebuilding. There are advantages to both methods, but the length of compile lines these days is turning into a barrier for the short, quick debug.

+ It makes life *much* easier if you want to use things like clang-complete to get compiler completions live in your editor while writing new code.

+ It makes the build process much less opaque to people who are not steeped in the tool chain.

+ Finally, it satisfies the Principle of Least Astonishment for open-source software development, where usually there is a single include directive per project (excluding external dependencies).

	David


More information about the vtk-developers mailing list