From 0f8ae514592c46dc8465bc5830d7a830b68affe2 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 17 Oct 2015 19:05:00 +0100 Subject: Added support for include-what-you-use in a very simplistic fashion to the Scons build. This isn't exactly production ready because the qt headers are a nightmarish web of interdependencies but it's useful for checking. I've also removed a few unused include files it detected and corrected some things that upset clang in a big way. --- src/SConscript | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/SConscript') diff --git a/src/SConscript b/src/SConscript index f09db093..cd2d8a52 100644 --- a/src/SConscript +++ b/src/SConscript @@ -67,7 +67,6 @@ env.Uic(env.Glob('*.ui')) env.RequireLibraries('uibase', 'shared', 'bsatk', 'esptk') - env.AppendUnique(LIBS = [ 'shell32', 'user32', @@ -114,8 +113,9 @@ env.AppendUnique(LINKFLAGS = [ # modeltest is optional and it doesn't compile anyway... cpp_files = [ - x for x in Glob('*.cpp') - if x.name != 'modeltest.cpp' and x.name != 'aboutdialog.cpp' + x for x in env.Glob('*.cpp', source = True) + if x.name != 'modeltest.cpp' and x.name != 'aboutdialog.cpp' and \ + not x.name.startswith('moc_') # I think this is a strange bug ] about_env = env.Clone() @@ -143,6 +143,14 @@ env.AppendUnique(LIBS = 'zlibstatic') prog = env.Program('ModOrganizer', cpp_files + env.Glob('*.qrc') + other_sources) +############################################################################### +# I'd like to automatically add this to every .o generation. +if 'IWYU' in env: + for f in cpp_files + [ env.File('aboutdialog.cpp') ]: + env.AddPostAction(prog, "-$IWYU $IWYU_FLAGS -Xiwyu --mapping_file=$IWYU_MAPPING_FILE $IWYU_COMCOM " + str(f)) + env.Depends(prog, env['IWYU_MAPPING_FILE']) +############################################################################### + env.InstallModule(prog) for subdir in ('tutorials', 'stylesheets'): -- cgit v1.3.1