From 197c49e996ba6f1284a7b7369b294000450b4453 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 31 Dec 2015 23:06:52 +0000 Subject: Fixes for building with qt5.5 --- SConstruct | 22 +++++++++++++--------- massage_messages.py | 14 +++++++++++--- qt5_4.imp | 2 +- win.imp | 10 +++++++++- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/SConstruct b/SConstruct index 76852c41..b52cf509 100644 --- a/SConstruct +++ b/SConstruct @@ -431,16 +431,24 @@ msvs_version = int(env['MSVS_VERSION'].split('.')[0]) + 2000 if msvs_version > 2010: msvs_version += 1 -# Need more work on the qt version stuff -#build-ModOrganizer-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug -build_dir = 'scons-ModOrganizer-QT_%s_for_MSVS%d_32bit-%s' % ( - #os.path.basename(env['QTDIR']).replace('.', '_'), - '5_4_1_OpenGL', +# Read the QT version info +with open(os.path.join(env['QTDIR'], 'mkspecs', 'qconfig.pri')) as qtinfo: + for line in qtinfo: + info = re.split(r'\s*=\s*', line.rstrip()) + if info[0] == 'QT_VERSION': + env[info[0]] = info[1] + elif '_VERSION' in info[0]: + env[info[0]] = int(info[1]) + +build_dir = 'scons-ModOrganizer-QT_%s_%sfor_MSVS%d_32bit-%s' % ( + env['QT_VERSION'].replace('.', '_'), + 'OpenGL_' if 'opengl' in env['QTDIR'] else '', msvs_version, config.title()) # Put the sconsign file somewhere sane env.SConsignFile(os.path.join(build_dir, '.sconsign.dblite')) +env.CacheDir(os.path.join(build_dir, '.cache')) #this doesn't seem to work #env.VariantDir('build/$CONFIG', 'source') @@ -531,10 +539,6 @@ qt_env = env.Clone() if qt_env['CONFIG'] != 'debug': qt_env.AppendUnique(CPPDEFINES = [ 'QT_NO_DEBUG' ]) -# Better way of working this out -qt_env['QT_MAJOR_VERSION'] = int(os.path.basename(os.path.dirname(env['QTDIR'])).split('.')[0]) -qt_env['QT_MINOR_VERSION'] = int(os.path.basename(os.path.dirname(env['QTDIR'])).split('.')[1]) - qt_env.Tool('qt%d' % qt_env['QT_MAJOR_VERSION']) # FIXME See if I can work out how to get official scons qt to work. Appears diff --git a/massage_messages.py b/massage_messages.py index d79f4cea..0a3ee9ad 100644 --- a/massage_messages.py +++ b/massage_messages.py @@ -36,6 +36,7 @@ includes = dict() adding = None added = dict() +lcadded = dict() foundline = None @@ -70,6 +71,7 @@ def process_next_line(line, outfile): m = re.match(r'.*class (.*);', line) if m: added[m.group(1)] = (adding, line) + lcadded[m.group(1).lower() + '.h'] = m.group(1) else: added[line] = (adding, line) elif removing: @@ -79,12 +81,18 @@ def process_next_line(line, outfile): m = re.match(r'- #include [<"](.*)[">] +// lines (.*)-', line) if m: foundline = m.group(2) - if m.group(1) in added: + # Note: In this project at least we have a naming convention of + # lower case filename and upper case classname. + clname = m.group(1) + if clname not in added: + if clname in lcadded: + clname = lcadded[clname] + if clname in added: messages[removing].append( '%s(%s) : warning I0004: Replace include of %s with ' 'forward reference %s' % ( - removing, m.group(2), m.group(1), added[m.group(1)][1])) - del added[m.group(1)] + removing, m.group(2), m.group(1), added[clname][1])) + del added[clname] else: messages[removing].append( '%s(%s) : warning I0001: Unnecessary include of %s' % ( diff --git a/qt5_4.imp b/qt5_4.imp index 22553b0e..5f919085 100644 --- a/qt5_4.imp +++ b/qt5_4.imp @@ -2463,7 +2463,7 @@ { include: [ "@\"(QtCore/)?qglobal\\.h\"", "private", "", "public" ] }, { include: [ "@\"(QtCore/)?qnamespace\\.h\"", "private", "", "public" ] }, { include: [ "@\"(QtCore/)?qlogging\\.h\"", "private", "", "public" ] }, #qDebug, qWarning, etc - { include: [ "@\"(QtCore/)?qalgorithms\\.h\"", "private", "", "public" ] }, #qSort, etc + { include: [ "@\"(QtCore/)?qalgorithms\\.h\"", "private", "", "public" ] }, #qSort, etc { include: [ "@\"(QtWinExtras/)?qwinfunctions\\.h\"", "private", "", "public" ] }, # for fromHICON # These ones are just madness. For instance, why with the above do we get diff --git a/win.imp b/win.imp index cbecdc43..24635775 100644 --- a/win.imp +++ b/win.imp @@ -54,10 +54,18 @@ { include: [ "", "private", "", "public" ] }, # official name according to website { include: [ "", "private", "", "public" ] }, # - { include: [ "", "private", "", "public" ] }, { include: [ "", "private", "", "public" ] }, { include: [ "", "private", "", "public" ] }, +# These ones are in shtypes.h but the only documentation I can find says +# to include Knownfolders.h for these + { symbol: [ "REFKNOWNFOLDERID", "private", "", "public" ] }, + { symbol: [ "KNOWNFOLDERID", "private", "", "public" ] }, + +# IWYU doesn't understand upper/lower case which is *really* annoying on +# windows, though to be fair I'm not sure M/S understand it either. + { include: [ "", "private", "", "public" ] }, + # Files that are included by other files which seem to then come for free in Windows.h but # shouldn't. Again, should be cleaned up. -- cgit v1.3.1